Skip to content

Commit

Permalink
file name was changed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffin143 committed Apr 25, 2020
1 parent d0f7b8f commit b862d6d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 314 deletions.
275 changes: 0 additions & 275 deletions test/HotTestCases.template.js

This file was deleted.

28 changes: 24 additions & 4 deletions test/HotTestCases.test.js
Expand Up @@ -59,6 +59,8 @@ describe("HotTestCases", () => {
options.output.filename = "bundle.js";
if (options.output.pathinfo === undefined)
options.output.pathinfo = true;
if (options.output.library === undefined)
options.output.library = ["commonjs2"];
if (!options.module) options.module = {};
if (!options.module.rules) options.module.rules = [];
options.module.rules.push({
Expand Down Expand Up @@ -170,11 +172,29 @@ describe("HotTestCases", () => {
return m.exports;
} else return require(module);
}
_require("./bundle.js");
if (getNumberOfTests() < 1)
return done(new Error("No tests exported by test case"));
let promise = Promise.resolve();
const info = stats.toJson({ all: false, entrypoints: true });
if (category.target === "web") {
for (const file of info.entrypoints.main.assets)
_require(`./${file}`);
} else {
const assets = info.entrypoints.main.assets;
const result = _require(`./${assets[assets.length - 1]}`);
if (typeof result === "object" && "then" in result)
promise = promise.then(() => result);
}
promise.then(
() => {
if (getNumberOfTests() < 1)
return done(new Error("No tests exported by test case"));

done();
done();
},
err => {
console.log(err);
done(err);
}
);
});
},
10000
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/ConfigTestCases.test.js.snap
Expand Up @@ -21,7 +21,7 @@ exports[`ConfigTestCases records issue-2991 exported tests should write relative
\\"main\\": 0
},
\\"bySource\\": {
\\"0 main\\": 179
\\"0 main\\": 0
},
\\"usedIds\\": [
0
Expand Down Expand Up @@ -55,7 +55,7 @@ exports[`ConfigTestCases records issue-7339 exported tests should write relative
\\"main\\": 0
},
\\"bySource\\": {
\\"0 main\\": 179
\\"0 main\\": 0
},
\\"usedIds\\": [
0
Expand Down

0 comments on commit b862d6d

Please sign in to comment.