diff --git a/package.json b/package.json index 65a20320a..2cc975b47 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "react-dom": "^15.2.1", "rimraf": "^2.6.2", "script-loader": "~0.7.0", - "should": "^11.1.1", "simple-git": "^1.65.0", "sinon": "^2.3.2", "style-loader": "^0.19.1", diff --git a/test/Integration.test.js b/test/Integration.test.js index 256f5f966..64e2bb64b 100644 --- a/test/Integration.test.js +++ b/test/Integration.test.js @@ -1,11 +1,9 @@ "use strict"; -require("should"); const path = require("path"); - const webpack = require("../lib/webpack"); -describe("Integration", function() { +describe("Integration", () => { jest.setTimeout(5000); it("should compile library1", (done) => { webpack({ @@ -52,13 +50,6 @@ describe("Integration", function() { optimization: { minimize: false }, - resolve: { - // cannot resolve should outside the outermost node_modules - // so it is injected here - alias: { - should: require.resolve("should") - } - }, plugins: [ new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 diff --git a/test/RuleSet.unittest.js b/test/RuleSet.unittest.js index db08afa40..d68023ead 100644 --- a/test/RuleSet.unittest.js +++ b/test/RuleSet.unittest.js @@ -1,7 +1,5 @@ "use strict"; -const should = require("should"); - const RuleSet = require("../lib/RuleSet"); function match(ruleSet, resource) { diff --git a/test/WatchDetection.test.js b/test/WatchDetection.test.js index fdd90d048..1e8c1217c 100644 --- a/test/WatchDetection.test.js +++ b/test/WatchDetection.test.js @@ -13,7 +13,9 @@ describe("WatchDetection", () => { return; } - for(let changeTimeout = 0; changeTimeout < 100; changeTimeout += 10) { + jest.setTimeout(10000); + + for(let changeTimeout = 10; changeTimeout < 100; changeTimeout += 10) { createTestCase(changeTimeout); } for(let changeTimeout = 200; changeTimeout <= 2000; changeTimeout += 200) { @@ -21,9 +23,7 @@ describe("WatchDetection", () => { } function createTestCase(changeTimeout) { - describe("time between changes " + changeTimeout + "ms", function() { - jest.setTimeout(10000); - + describe(`time between changes ${changeTimeout}ms`, () => { const fixturePath = path.join(__dirname, "fixtures", "temp-" + changeTimeout); const filePath = path.join(fixturePath, "file.js"); const file2Path = path.join(fixturePath, "file2.js"); diff --git a/test/WatchTestCases.test.js b/test/WatchTestCases.test.js index 33bbbb983..ea9119117 100644 --- a/test/WatchTestCases.test.js +++ b/test/WatchTestCases.test.js @@ -70,7 +70,7 @@ describe("WatchTestCases", () => { fs.mkdirSync(dest); }); categories.forEach((category) => { - before(() => { + beforeAll(() => { const dest = path.join(__dirname, "js", "watch-src", category.name); if(!fs.existsSync(dest)) fs.mkdirSync(dest); @@ -88,7 +88,9 @@ describe("WatchTestCases", () => { suite: describe(name, () => {}) }; }); - before(() => remove(tempDirectory)); + beforeAll(() => { + remove(tempDirectory); + }); it("should compile", function(done) { const outputDirectory = path.join(__dirname, "js", "watch", category.name, testName); diff --git a/test/browsertest/lib/index.web.js b/test/browsertest/lib/index.web.js index 0a9541f12..e95147bee 100644 --- a/test/browsertest/lib/index.web.js +++ b/test/browsertest/lib/index.web.js @@ -20,8 +20,8 @@ describe("main", function() { expect(window.library2common.ok2).toEqual(expect.anything()); expect(window.library2common.ok2).toBe(true); expect(window.library2).toEqual(expect.anything()); - expect(window.toBeTruthy()).toEqual(expect.anything()); - expect(window.toBeTruthy()).toBe(true); + expect(window.library2.ok).toEqual(expect.anything()); + expect(window.library2.ok).toBe(true); }); describe("web resolving", function() { @@ -32,7 +32,7 @@ describe("main", function() { it("should load correct replacements for files", function(done) { require.ensure(["subcontent"], function(require) { // Comments work! - exports.toBeTruthy() = true; + exports.ok = true; test(require("subcontent") === "replaced", "node_modules should be replaced with web_modules"); test(require("subcontent2/file.js") === "orginal", "node_modules should still work when web_modules exists"); done(); @@ -40,8 +40,8 @@ describe("main", function() { }); after(function() { - expect(exports.toBeTruthy()).toEqual(expect.anything()); - expect(exports.toBeTruthy()).toBe(true); + expect(exports.ok).toEqual(expect.anything()); + expect(exports.ok).toBe(true); }); }); diff --git a/test/browsertest/library2config.coffee b/test/browsertest/library2config.coffee index 8e946bc36..254425bb6 100644 --- a/test/browsertest/library2config.coffee +++ b/test/browsertest/library2config.coffee @@ -12,11 +12,6 @@ exports.default = new Promise (resolve, reject) -> ] amd: fromOptions: true - resolve: - # cannot resolve should outside the outermost node_modules - # so it is injected here - alias: - should: require.resolve "should" plugins: [ new webpack.optimize.LimitChunkCountPlugin maxChunks: 3 diff --git a/test/browsertest/node_modules/library2/lib/main.js b/test/browsertest/node_modules/library2/lib/main.js index 73728aa6a..d026078f4 100644 --- a/test/browsertest/node_modules/library2/lib/main.js +++ b/test/browsertest/node_modules/library2/lib/main.js @@ -1,13 +1,11 @@ // Chunked File library -var should = require("should"); - var library2commonValue = library2common; describe("library2", function() { var tickExtra, tickEmpty, tickMerged; var extraValue, testValue; - before(function(done) { + beforeAll(function(done) { var asnycOk = false, asnycOk2 = false; var sameTick1 = true; require.ensure(["./extra"], function(require) { diff --git a/test/cases/context/issue-524/index.js b/test/cases/context/issue-524/index.js index 3028e93f1..4c0c7721c 100644 --- a/test/cases/context/issue-524/index.js +++ b/test/cases/context/issue-524/index.js @@ -9,17 +9,3 @@ it("should support an empty context", function() { }).toThrowError(); expect(c.keys()).toEqual([]); }); - -// This would be a useful testcase, but it requires an (really) empty directory. -// **but** you cannot commit empty directories into git -/*it("should support an empty context (empty dir)", function() { - var c = require.context("./empty", true, /^nothing$/); - c.id.should.be.type("number"); - (function() { - c.resolve(""); - }).should.throw(); - (function() { - c(""); - }).should.throw(); - expect(c.keys()).toEqual([]); -});*/ diff --git a/test/cases/mjs/esm-by-default/index.mjs b/test/cases/mjs/esm-by-default/index.mjs index 839b81030..701d602ab 100644 --- a/test/cases/mjs/esm-by-default/index.mjs +++ b/test/cases/mjs/esm-by-default/index.mjs @@ -1,8 +1,8 @@ it("should not have commonjs stuff available", function() { if(typeof module !== "undefined") { // If module is available - module.should.have.property("webpackTestSuiteModule"); // it must be the node.js module + expect(module).toHaveProperty("webpackTestSuiteModule"); // it must be the node.js module } if(typeof require !== "undefined") { // If require is available - require.should.have.property("webpackTestSuiteRequire"); // it must be the node.js require + expect(require).toHaveProperty("webpackTestSuiteRequire"); // it must be the node.js require } }); diff --git a/test/configCases/async-commons-chunk/existing-name/index.js b/test/configCases/async-commons-chunk/existing-name/index.js index 31da0708a..06b48d9a2 100644 --- a/test/configCases/async-commons-chunk/existing-name/index.js +++ b/test/configCases/async-commons-chunk/existing-name/index.js @@ -1,4 +1,3 @@ -require("should"); const sinon = require("sinon"); const chunkLoadingSpy = sinon.spy(__webpack_require__, "e"); diff --git a/test/configCases/commons-chunk-plugin/correct-order/index.js b/test/configCases/commons-chunk-plugin/correct-order/index.js index 10eaf4c6e..112e38a78 100644 --- a/test/configCases/commons-chunk-plugin/correct-order/index.js +++ b/test/configCases/commons-chunk-plugin/correct-order/index.js @@ -1,5 +1,3 @@ -require("should"); - var a = require("./a"); it("should run", function() { diff --git a/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js b/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js index f53987e50..cbab26b2d 100644 --- a/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js +++ b/test/configCases/commons-chunk-plugin/extract-async-from-entry/index.js @@ -1,4 +1 @@ -require("should"); - -it("should run successful", function() { -}); +it("should run successful", function() {}); diff --git a/test/configCases/commons-chunk-plugin/hot-multi/first.js b/test/configCases/commons-chunk-plugin/hot-multi/first.js index 034fd5fe3..751a8042f 100644 --- a/test/configCases/commons-chunk-plugin/hot-multi/first.js +++ b/test/configCases/commons-chunk-plugin/hot-multi/first.js @@ -1,5 +1,3 @@ -require("should"); - require("./common"); it("should have the correct main flag for multi first module", function() { diff --git a/test/configCases/commons-chunk-plugin/hot-multi/second.js b/test/configCases/commons-chunk-plugin/hot-multi/second.js index 12da2578a..fd42f8148 100644 --- a/test/configCases/commons-chunk-plugin/hot-multi/second.js +++ b/test/configCases/commons-chunk-plugin/hot-multi/second.js @@ -1,5 +1,3 @@ -require("should"); - require("./common"); it("should have the correct main flag for multi second module", function() { diff --git a/test/configCases/commons-chunk-plugin/hot/index.js b/test/configCases/commons-chunk-plugin/hot/index.js index 7179d70f8..105978c4e 100644 --- a/test/configCases/commons-chunk-plugin/hot/index.js +++ b/test/configCases/commons-chunk-plugin/hot/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should have the correct main flag", function() { var a = require("./vendor"); expect(a._main).toBe(false); diff --git a/test/configCases/commons-chunk-plugin/inverted-order/index.js b/test/configCases/commons-chunk-plugin/inverted-order/index.js index 10eaf4c6e..112e38a78 100644 --- a/test/configCases/commons-chunk-plugin/inverted-order/index.js +++ b/test/configCases/commons-chunk-plugin/inverted-order/index.js @@ -1,5 +1,3 @@ -require("should"); - var a = require("./a"); it("should run", function() { diff --git a/test/configCases/commons-chunk-plugin/simple/index.js b/test/configCases/commons-chunk-plugin/simple/index.js index 11ff8ad6d..ca28fa41f 100644 --- a/test/configCases/commons-chunk-plugin/simple/index.js +++ b/test/configCases/commons-chunk-plugin/simple/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should run", function() { var a = require("./a"); expect(a).toBe("a"); diff --git a/test/configCases/dll-plugin/1-use-dll/index.js b/test/configCases/dll-plugin/1-use-dll/index.js index 69fe8e20f..a98f68d5e 100644 --- a/test/configCases/dll-plugin/1-use-dll/index.js +++ b/test/configCases/dll-plugin/1-use-dll/index.js @@ -1,4 +1,3 @@ -var should = require("should"); import d from "dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "dll/e"; diff --git a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js index 8204c841b..f89624fd3 100644 --- a/test/configCases/dll-plugin/2-use-dll-without-scope/index.js +++ b/test/configCases/dll-plugin/2-use-dll-without-scope/index.js @@ -1,4 +1,3 @@ -var should = require("should"); import d from "../0-create-dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "../0-create-dll/e"; diff --git a/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js b/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js index bc2322ba7..e3779fe1e 100644 --- a/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js +++ b/test/configCases/dll-plugin/3-use-dll-with-hashid/index.js @@ -1,4 +1,3 @@ -var should = require("should"); import d from "../0-create-dll/d"; import { x1, y2 } from "./e"; import { x2, y1 } from "../0-create-dll/e"; @@ -28,5 +27,3 @@ it("should load an harmony module from dll (star export)", function() { it("should load a module with loader applied", function() { expect(require("../0-create-dll/g.abc.js")).toBe("number"); }); - - diff --git a/test/configCases/parsing/node-source-plugin-off/index.js b/test/configCases/parsing/node-source-plugin-off/index.js index a31f12595..322337ef3 100644 --- a/test/configCases/parsing/node-source-plugin-off/index.js +++ b/test/configCases/parsing/node-source-plugin-off/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should not load node-libs-browser when node option is false", function() { expect((typeof process)).toBe("undefined"); }); diff --git a/test/configCases/parsing/node-source-plugin/index.js b/test/configCases/parsing/node-source-plugin/index.js index 105368218..c1671f16f 100644 --- a/test/configCases/parsing/node-source-plugin/index.js +++ b/test/configCases/parsing/node-source-plugin/index.js @@ -1,5 +1,3 @@ -require("should"); - it("should add node-libs-browser to target web by default", function() { expect(process.browser).toBe(true); }); diff --git a/test/configCases/target/buffer/index.js b/test/configCases/target/buffer/index.js index e4c7cf689..570c0e343 100644 --- a/test/configCases/target/buffer/index.js +++ b/test/configCases/target/buffer/index.js @@ -1,11 +1,3 @@ it("should provide a global Buffer shim", function () { expect(Buffer).toBeInstanceOf(Function); }); - -it("should fail on the buffer module"/*, function () { - (function(argument) { - try { - require("buffer"); - } catch(e) { throw e; } - }).should.throw(); -}*/); diff --git a/test/configCases/target/strict-mode-global/index.js b/test/configCases/target/strict-mode-global/index.js index 1ac581718..ba0b15cfa 100644 --- a/test/configCases/target/strict-mode-global/index.js +++ b/test/configCases/target/strict-mode-global/index.js @@ -1,7 +1,5 @@ "use strict"; -require("should"); - it("should be able to use global in strict mode", function() { expect((typeof global)).toBe("object"); expect((global === null)).toBe(false) diff --git a/test/configCases/target/web/index.js b/test/configCases/target/web/index.js index 50f6b832c..9e30bd08e 100644 --- a/test/configCases/target/web/index.js +++ b/test/configCases/target/web/index.js @@ -5,14 +5,6 @@ it("should provide a global Buffer constructor", function() { expect(Buffer).toBeInstanceOf(Function); }); -// Webpack is not providing a console shim by default -// @see lib/WebpackOptionsDefaulter.js -// Uncomment this when defaults are changed -//it("should provide a global console shim", function () { -// console.should.be.an.Object(); -// console.time.should.be.a.Function(); -//}); - it("should provide a global process shim", function () { expect(process).toBeInstanceOf(Object); }); diff --git a/test/setupTestFramework.js b/test/setupTestFramework.js index cba42da25..a03e56ef9 100644 --- a/test/setupTestFramework.js +++ b/test/setupTestFramework.js @@ -12,16 +12,13 @@ expect.extend({ ` ${this.utils.printExpected(expected)}\n` + "Received:\n" + ` ${this.utils.printReceived(objType)}` - : () => { - return ( - this.utils.matcherHint(".toBeTypeOf") + - "\n\n" + - "Expected value to be (using typeof):\n" + - ` ${this.utils.printExpected(expected)}\n` + - "Received:\n" + - ` ${this.utils.printReceived(objType)}` - ); - }; + : () => + this.utils.matcherHint(".toBeTypeOf") + + "\n\n" + + "Expected value to be (using typeof):\n" + + ` ${this.utils.printExpected(expected)}\n` + + "Received:\n" + + ` ${this.utils.printReceived(objType)}`; return { message, pass }; } diff --git a/yarn.lock b/yarn.lock index 96f4565d7..abf62b8d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4737,44 +4737,6 @@ shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" -should-equal@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-1.0.1.tgz#0b6e9516f2601a9fb0bb2dcc369afa1c7e200af7" - dependencies: - should-type "^1.0.0" - -should-format@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1" - dependencies: - should-type "^1.3.0" - should-type-adaptors "^1.0.1" - -should-type-adaptors@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a" - dependencies: - should-type "^1.3.0" - should-util "^1.0.0" - -should-type@^1.0.0, should-type@^1.3.0, should-type@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3" - -should-util@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063" - -should@^11.1.1: - version "11.2.1" - resolved "https://registry.yarnpkg.com/should/-/should-11.2.1.tgz#90f55145552d01cfc200666e4e818a1c9670eda2" - dependencies: - should-equal "^1.0.0" - should-format "^3.0.2" - should-type "^1.4.0" - should-type-adaptors "^1.0.1" - should-util "^1.0.0" - sigmund@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"