fix test cases

This commit is contained in:
Tobias Koppers 2018-11-29 15:45:08 +01:00
parent 5c7d6d2db6
commit a54645ab5b
7 changed files with 11 additions and 23 deletions

View File

@ -46,14 +46,6 @@ class RuntimeModule extends Module {
return `webpack/runtime/${this.name}`;
}
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return `webpack/runtime/${this.name}`;
}
/**
* @param {NeedBuildContext} context context info
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild

View File

@ -172,7 +172,7 @@ describe("ConfigTestCases", () => {
}
};
function _require(currentDirectory, module) {
function _require(currentDirectory, options, module) {
if (Array.isArray(module) || /^\.\.?\//.test(module)) {
let fn;
let content;
@ -194,7 +194,7 @@ describe("ConfigTestCases", () => {
options.target === "webworker"
) {
fn = vm.runInNewContext(
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, window) {" +
"(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, window, self) {" +
'function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }' +
content +
"\n})",
@ -216,7 +216,7 @@ describe("ConfigTestCases", () => {
};
fn.call(
m.exports,
_require.bind(null, path.dirname(p)),
_require.bind(null, path.dirname(p), options),
m,
m.exports,
path.dirname(p),
@ -226,6 +226,7 @@ describe("ConfigTestCases", () => {
_afterEach,
expect,
jest,
globalContext,
globalContext
);
return m.exports;
@ -243,7 +244,7 @@ describe("ConfigTestCases", () => {
const bundlePath = testConfig.findBundle(i, optionsArr[i]);
if (bundlePath) {
filesCount++;
_require(outputDirectory, bundlePath);
_require(outputDirectory, optionsArr[i], bundlePath);
}
}
// give a free pass to compilation that generated an error

View File

@ -19,6 +19,8 @@ it("should include only one use strict per module", function() {
expect(matches).toEqual([
"/* unused harmony default export */ var _unused_webpack_default_export = (\"a\");",
"/* webpack/runtime/make namespace object */",
"/******/ \t// The module cache",
"__webpack_require__.r(__webpack_exports__);",
"__webpack_require__.r(__webpack_exports__);",
"__webpack_require__.r(__webpack_exports__);",

View File

@ -17,6 +17,5 @@ it("should give modules the correct ids", function() {
"./index.js",
"dll-reference ../0-create-dll/dll.js",
"dll/index.js",
"webpack/runtime/make namespace object",
]);
});

View File

@ -44,8 +44,5 @@ it("should give modules the correct ids", function() {
"dll/e2.js",
"dll/f.jsx",
"dll/g.abc.js",
"webpack/runtime/compat get default export",
"webpack/runtime/define property getter",
"webpack/runtime/make namespace object",
]);
});

View File

@ -44,8 +44,5 @@ it("should give modules the correct ids", function() {
"../0-create-dll/g.abc.js",
"./index.js",
"dll-reference ../0-create-dll/dll.js",
"webpack/runtime/compat get default export",
"webpack/runtime/define property getter",
"webpack/runtime/make namespace object",
]);
});

View File

@ -170,7 +170,7 @@ module.exports = [
output: {
filename: "bundle14.[contenthash].js",
chunkFilename: "[id].bundle14.[contenthash].js",
globalObject: "this"
globalObject: "window"
},
target: "web",
amd: {
@ -184,7 +184,7 @@ module.exports = [
output: {
filename: "bundle15.[contenthash:7].js",
chunkFilename: "[id].bundle15.[contenthash:7].js",
globalObject: "this"
globalObject: "window"
},
target: "web",
amd: {
@ -198,7 +198,7 @@ module.exports = [
output: {
filename: "bundle16.[contenthash].js",
chunkFilename: "[id].bundle16.[contenthash].js",
globalObject: "this"
globalObject: "self"
},
target: "webworker",
amd: {
@ -212,7 +212,7 @@ module.exports = [
output: {
filename: "bundle17.[contenthash:7].js",
chunkFilename: "[id].bundle17.[contenthash:7].js",
globalObject: "this"
globalObject: "self"
},
target: "webworker",
amd: {