Skip to content

Commit 2df9630

Browse files
authored
Merge pull request webpack#7171 from webpack/wasm/watch
add test case to verify that webpack/webpack-dev-server#1376 is fixed
2 parents 5c8a0d2 + 4769dc6 commit 2df9630

File tree

7 files changed

+38
-0
lines changed

7 files changed

+38
-0
lines changed

test/WatchTestCases.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ describe("WatchTestCases", () => {
5555
tests: fs
5656
.readdirSync(path.join(casesPath, cat))
5757
.filter(folder => folder.indexOf("_") < 0)
58+
.filter(testName => {
59+
const testDirectory = path.join(casesPath, cat, testName);
60+
const filterPath = path.join(testDirectory, "test.filter.js");
61+
if (fs.existsSync(filterPath) && !require(filterPath)()) {
62+
describe.skip(testName, () => it("filtered"));
63+
return false;
64+
}
65+
return true;
66+
})
5867
.sort()
5968
};
6069
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
it("should allow to run a WebAssembly module with imports", function() {
2+
return import("./wasm.wasm").then(function(wasm) {
3+
const result = wasm.get();
4+
switch(WATCH_STEP) {
5+
case "0":
6+
expect(result).toEqual(9);
7+
break;
8+
case "1":
9+
expect(result).toEqual(10);
10+
break;
11+
case "2":
12+
expect(result).toEqual(42);
13+
break;
14+
default:
15+
throw new Error("should not happen");
16+
}
17+
});
18+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function getNumber() {
2+
return 8;
3+
}
102 Bytes
Binary file not shown.
102 Bytes
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function getNumber() {
2+
return 40;
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
2+
3+
module.exports = function(config) {
4+
return supportsWebAssembly();
5+
};

0 commit comments

Comments
 (0)