migration of new tests and changes after merge of master
This commit is contained in:
parent
75253e7154
commit
09ee9f4883
|
@ -289,9 +289,12 @@ describe("BenchmarkTestCases", function() {
|
|||
`baseline-${baseline.name}`,
|
||||
testName
|
||||
);
|
||||
const config = Object.create(require.requireActual(
|
||||
path.join(testDirectory, "webpack.config.js")
|
||||
)) || {};
|
||||
const config =
|
||||
Object.create(
|
||||
require.requireActual(
|
||||
path.join(testDirectory, "webpack.config.js")
|
||||
)
|
||||
) || {};
|
||||
config.output = Object.create(config.output || {});
|
||||
if (!config.context) config.context = testDirectory;
|
||||
if (!config.output.path) config.output.path = outputDirectory;
|
||||
|
|
|
@ -35,10 +35,14 @@ describe("HotModuleReplacementPlugin", () => {
|
|||
);
|
||||
try {
|
||||
mkdirp.sync(path.join(__dirname, "js", "HotModuleReplacementPlugin"));
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
try {
|
||||
fs.unlinkSync(recordsFile);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
const compiler = webpack({
|
||||
cache: false,
|
||||
entry: entryFile,
|
||||
|
|
|
@ -21,7 +21,7 @@ describe(
|
|||
"./node_modules/ts-loader!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/app.vue";
|
||||
const expectPath = `./src/app.vue (${inputPath})\n`;
|
||||
|
||||
mockStats.formatFilePath(inputPath).should.be.exactly(expectPath);
|
||||
expect(mockStats.formatFilePath(inputPath)).toBe(expectPath);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ const describeCases = config => {
|
|||
{},
|
||||
config.optimization,
|
||||
DEFAULT_OPTIMIZATIONS
|
||||
),
|
||||
),
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const { describeCases } = require("./TestCases.template");
|
||||
const Stats = require("../lib/Stats");
|
||||
const webpack = require("../lib/webpack");
|
||||
|
||||
describe("TestCases", () => {
|
||||
describeCases({
|
||||
|
|
|
@ -36,7 +36,9 @@ describe("WatchDetection", () => {
|
|||
beforeAll(() => {
|
||||
try {
|
||||
fs.mkdirSync(fixturePath);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
fs.writeFileSync(filePath, "require('./file2')", "utf-8");
|
||||
fs.writeFileSync(file2Path, "original", "utf-8");
|
||||
});
|
||||
|
@ -45,13 +47,19 @@ describe("WatchDetection", () => {
|
|||
setTimeout(() => {
|
||||
try {
|
||||
fs.unlinkSync(filePath);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
try {
|
||||
fs.unlinkSync(file2Path);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
try {
|
||||
fs.rmdirSync(fixturePath);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
done();
|
||||
}, 100); // cool down a bit
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
import {x, y} from "./a";
|
||||
import { x, y } from "./a";
|
||||
|
||||
it("namespace export as from commonjs should override named export", function() {
|
||||
x.should.be.eql(1);
|
||||
y.should.be.eql(3);
|
||||
expect(x).toBe(1);
|
||||
expect(y).toBe(3);
|
||||
});
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
define("local-module-object", function () {
|
||||
define("local-module-object", function() {
|
||||
return {
|
||||
foo: "bar"
|
||||
};
|
||||
});
|
||||
|
||||
define("local-side-effect", function () {
|
||||
define("local-side-effect", function() {
|
||||
return {
|
||||
foo: null
|
||||
};
|
||||
});
|
||||
|
||||
define("local-module-non-object", ["local-side-effect"], function (sideEffect) {
|
||||
sideEffect.foo = "bar"
|
||||
define("local-module-non-object", ["local-side-effect"], function(sideEffect) {
|
||||
sideEffect.foo = "bar";
|
||||
return 1;
|
||||
});
|
||||
|
||||
it("should create dependency when require is called with 'new' (object export)", function() {
|
||||
const result = new require("./object-export");
|
||||
result.foo.should.equal("bar");
|
||||
result.should.equal(require("./object-export"));
|
||||
expect(result.foo).toBe("bar");
|
||||
expect(result).toEqual(require("./object-export"));
|
||||
});
|
||||
|
||||
it("should create dependency when require is called with 'new' (non-object export)", function() {
|
||||
const sideEffect = require("./sideEffect");
|
||||
const result = new require("./non-object-export");
|
||||
result.should.instanceof(__webpack_require__);
|
||||
sideEffect.foo.should.equal("bar");
|
||||
result.should.not.equal(require("./non-object-export"));
|
||||
expect(result instanceof __webpack_require__).toBe(true);
|
||||
expect(sideEffect.foo).toBe("bar");
|
||||
expect(result).not.toEqual(require("./non-object-export"));
|
||||
});
|
||||
|
||||
it("should create dependency with 'new' on a local dependency (object export)", function() {
|
||||
const result = new require("local-module-object");
|
||||
result.foo.should.equal("bar");
|
||||
result.should.equal(require("local-module-object"));
|
||||
expect(result.foo).toBe("bar");
|
||||
expect(result).toEqual(require("local-module-object"));
|
||||
});
|
||||
|
||||
it("shouldn't fail with a local dependency (non-object export)", function() {
|
||||
const sideEffect = require("local-side-effect");
|
||||
const result = new require("local-module-non-object");
|
||||
result.should.not.equal(1);
|
||||
sideEffect.foo.should.equal("bar");
|
||||
result.should.not.equal(require("local-module-non-object"));
|
||||
expect(result).not.toBe(1);
|
||||
expect(sideEffect.foo).toBe("bar");
|
||||
expect(result).not.toEqual(require("local-module-non-object"));
|
||||
});
|
||||
|
||||
it("should work with 'require' in parentheses", function () {
|
||||
const result = new (require)("./object-export");
|
||||
result.foo.should.equal("bar");
|
||||
it("should work with 'require' in parentheses", function() {
|
||||
const result = new require("./object-export");
|
||||
expect(result.foo).toBe("bar");
|
||||
});
|
||||
|
||||
it("should work with local module 'require' in parentheses", function () {
|
||||
const result = new (require)("local-module-object");
|
||||
result.foo.should.equal("bar");
|
||||
it("should work with local module 'require' in parentheses", function() {
|
||||
const result = new require("local-module-object");
|
||||
expect(result.foo).toBe("bar");
|
||||
});
|
||||
|
||||
it("shouldn't fail with non-object local module 'require' in parentheses", function () {
|
||||
new (require)("local-module-non-object");
|
||||
it("shouldn't fail with non-object local module 'require' in parentheses", function() {
|
||||
new require("local-module-non-object");
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { a, b, aa, bb } from './json.js'
|
||||
|
||||
it("should reexport json data correctly", () => {
|
||||
aa.should.be.eql({ a: "A" });
|
||||
bb.should.be.eql({ b: "B" });
|
||||
a.should.be.eql("A");
|
||||
b.should.be.eql("B");
|
||||
expect(aa).toEqual({ a: "A" });
|
||||
expect(bb).toEqual({ b: "B" });
|
||||
expect(a).toBe("A");
|
||||
expect(b).toBe("B");
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ it("bundle0 should include sourcemapped test.js", function() {
|
|||
var fs = require("fs");
|
||||
var source = fs.readFileSync(__filename + ".map", "utf-8");
|
||||
var map = JSON.parse(source);
|
||||
map.sources.should.containEql("webpack:///./test.js");
|
||||
expect(map.sources).toContain("webpack:///./test.js");
|
||||
});
|
||||
|
||||
require.include("./test.js");
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require("should");
|
||||
|
||||
it("should run", function() {
|
||||
Promise.all(
|
||||
[
|
||||
|
@ -12,5 +10,5 @@ it("should run", function() {
|
|||
const files = require("fs").readdirSync(__dirname);
|
||||
const hasFile = files.indexOf('a~b~c.bundle.js') !== -1;
|
||||
|
||||
hasFile.should.be.eql(true);
|
||||
expect(hasFile).toBe(true);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
require("should");
|
||||
|
||||
it("should run", function() {
|
||||
Promise.all(
|
||||
[
|
||||
|
@ -12,5 +10,5 @@ it("should run", function() {
|
|||
const files = require("fs").readdirSync(__dirname);
|
||||
const hasFile = files.indexOf('a-b-c.bundle.js') !== -1;
|
||||
|
||||
hasFile.should.be.eql(true);
|
||||
expect(hasFile).toBe(true);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const foo = require("foo");
|
||||
|
||||
it("should use browser main field", () => {
|
||||
foo.should.be.eql("browser");
|
||||
expect(foo).toBe("browser");
|
||||
});
|
||||
|
|
|
@ -3,13 +3,13 @@ chunk {0} 0.js 21 bytes <{3}> ={1}= ={2}= [rendered] reused as split chunk (c
|
|||
> [3] ./index.js 17:1-21:3
|
||||
> [3] ./index.js 2:1-5:3
|
||||
> ./a ./b [3] ./index.js 9:1-13:3
|
||||
[0] ./a.js 21 bytes {0} [built]
|
||||
[0] ./a.js 21 bytes {0} [built]
|
||||
chunk {1} 1.js 21 bytes <{3}> ={0}= [rendered]
|
||||
> ./a ./b [3] ./index.js 9:1-13:3
|
||||
[1] ./b.js 21 bytes {1} [built]
|
||||
[1] ./b.js 21 bytes {1} [built]
|
||||
chunk {2} 2.js 21 bytes <{3}> ={0}= [rendered]
|
||||
> [3] ./index.js 17:1-21:3
|
||||
[2] ./c.js 21 bytes {2} [built]
|
||||
[2] ./c.js 21 bytes {2} [built]
|
||||
chunk {3} main.js (main) 515 bytes >{0}< >{1}< >{2}< [entry] [rendered]
|
||||
> ./ main
|
||||
[3] ./index.js 515 bytes {3} [built]
|
||||
[3] ./index.js 515 bytes {3} [built]
|
Loading…
Reference in New Issue