mirror of https://github.com/webpack/webpack.git
fix tests
This commit is contained in:
parent
25af83f288
commit
ff3bfa157d
|
@ -34,7 +34,7 @@ it("should detect query strings in dynamic import as a static value 2", function
|
|||
]);
|
||||
});
|
||||
|
||||
it("should detect query strings in dynamic import as a static value 2", function() {
|
||||
it("should detect query strings in dynamic import as a static value 3", function() {
|
||||
var testFileName = "a";
|
||||
|
||||
return Promise.all([
|
||||
|
|
|
@ -8,12 +8,31 @@ const path = require("path");
|
|||
path.join(__dirname, `bundle-${method}.js`),
|
||||
"utf-8"
|
||||
);
|
||||
expect(source).toContain(`\`./\${foobar}/\${"suffix0"}\``);
|
||||
// buggy for param.isConditional() cases, big work, resolve in later PRs
|
||||
// expect(source).toContain(`\`./\${foobar}/\${"suffix1"}\``);
|
||||
// expect(source).toContain(`\`./\${foobar}/\${"suffix2"}\``);
|
||||
expect(source).toContain(`\`./\${foobar}/\${"suffix3"}\``);
|
||||
expect(source).not.toContain(`\`./\${foobar}/\${"suffix4"}\``);
|
||||
expect(source).toContain(`\`./\${foobar}/suffix0`);
|
||||
expect(source).toContain(`\`./\${foobar}/suffix3`);
|
||||
expect(source).not.toContain(`\`./\${foobar}/suffix4`);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
["import", "commonjs"].forEach(method => {
|
||||
it(`should be able to replace ${method} param in DefinePlugin for conditional expression`, function() {
|
||||
const source = fs.readFileSync(
|
||||
path.join(__dirname, `bundle-${method}.js`),
|
||||
"utf-8"
|
||||
);
|
||||
expect(source).toContain(`\`./\${"prefix1"}/\${foobar}/\${"suffix1"}`);
|
||||
expect(source).toContain(`\`./\${"prefix2"}/\${foobar}/\${"suffix2"}`);
|
||||
});
|
||||
});
|
||||
|
||||
["amd-require", "amd-define", "require.resolve"].forEach(method => {
|
||||
it(`should be able to replace ${method} param in DefinePlugin for conditional expression`, function() {
|
||||
const source = fs.readFileSync(
|
||||
path.join(__dirname, `bundle-${method}.js`),
|
||||
"utf-8"
|
||||
);
|
||||
expect(source).toContain(`\`./\${foobar}/suffix1`);
|
||||
expect(source).toContain(`\`./\${foobar}/suffix2`);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue