Merge pull request #6529 from webpack/test/wasm-order

add wasm order test case
This commit is contained in:
Tobias Koppers 2018-02-21 14:22:09 +01:00 committed by GitHub
commit 7abe26ee3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import { trackA, results } from "./tracker";
import "./b.js";
import "./wasm.wasm";
trackA();
export default results;

View File

@ -0,0 +1,3 @@
import { trackB } from "./tracker";
trackB();

View File

@ -0,0 +1,5 @@
import { trackC } from "./tracker";
trackC();
export const magicNumber = 42;

View File

@ -0,0 +1,7 @@
it("should be evaluated in the correct order", () => {
return import("./a").then(({ default: results }) => {
return Promise.resolve().then(() => { // wait an extra tick to get the tick from the tracker
results.should.be.eql(["b", "c", "wasm42", "a", "tick"]);
});
});
});

View File

@ -0,0 +1,5 @@
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly");
module.exports = function(config) {
return supportsWebAssembly();
};

View File

@ -0,0 +1,8 @@
export let results = [];
export function trackA() { results.push("a"); }
export function trackB() { results.push("b"); }
export function trackC() { results.push("c"); }
export function trackWasm(number) { results.push("wasm" + number); }
Promise.resolve().then(() => results.push("tick"));

Binary file not shown.

View File

@ -0,0 +1,9 @@
(module
(func $trackWasm (import "./tracker" "trackWasm") (param i32))
(global $magicNumber (import "./c.js" "magicNumber") i32)
(func $start
get_global $magicNumber
call $trackWasm
)
(start $start)
)