Skip to content

Commit aa217e9

Browse files
committed
Fix wrong regexp replacements
1 parent b7ce843 commit aa217e9

File tree

28 files changed

+25
-140
lines changed

28 files changed

+25
-140
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"react-dom": "^15.2.1",
5757
"rimraf": "^2.6.2",
5858
"script-loader": "~0.7.0",
59-
"should": "^11.1.1",
6059
"simple-git": "^1.65.0",
6160
"sinon": "^2.3.2",
6261
"style-loader": "^0.19.1",

test/Integration.test.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"use strict";
22

3-
require("should");
43
const path = require("path");
5-
64
const webpack = require("../lib/webpack");
75

8-
describe("Integration", function() {
6+
describe("Integration", () => {
97
jest.setTimeout(5000);
108
it("should compile library1", (done) => {
119
webpack({
@@ -52,13 +50,6 @@ describe("Integration", function() {
5250
optimization: {
5351
minimize: false
5452
},
55-
resolve: {
56-
// cannot resolve should outside the outermost node_modules
57-
// so it is injected here
58-
alias: {
59-
should: require.resolve("should")
60-
}
61-
},
6253
plugins: [
6354
new webpack.optimize.LimitChunkCountPlugin({
6455
maxChunks: 1

test/RuleSet.unittest.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use strict";
22

3-
const should = require("should");
4-
53
const RuleSet = require("../lib/RuleSet");
64

75
function match(ruleSet, resource) {

test/WatchDetection.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ describe("WatchDetection", () => {
1313
return;
1414
}
1515

16-
for(let changeTimeout = 0; changeTimeout < 100; changeTimeout += 10) {
16+
jest.setTimeout(10000);
17+
18+
for(let changeTimeout = 10; changeTimeout < 100; changeTimeout += 10) {
1719
createTestCase(changeTimeout);
1820
}
1921
for(let changeTimeout = 200; changeTimeout <= 2000; changeTimeout += 200) {
2022
createTestCase(changeTimeout);
2123
}
2224

2325
function createTestCase(changeTimeout) {
24-
describe("time between changes " + changeTimeout + "ms", function() {
25-
jest.setTimeout(10000);
26-
26+
describe(`time between changes ${changeTimeout}ms`, () => {
2727
const fixturePath = path.join(__dirname, "fixtures", "temp-" + changeTimeout);
2828
const filePath = path.join(fixturePath, "file.js");
2929
const file2Path = path.join(fixturePath, "file2.js");

test/WatchTestCases.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe("WatchTestCases", () => {
7070
fs.mkdirSync(dest);
7171
});
7272
categories.forEach((category) => {
73-
before(() => {
73+
beforeAll(() => {
7474
const dest = path.join(__dirname, "js", "watch-src", category.name);
7575
if(!fs.existsSync(dest))
7676
fs.mkdirSync(dest);
@@ -88,7 +88,9 @@ describe("WatchTestCases", () => {
8888
suite: describe(name, () => {})
8989
};
9090
});
91-
before(() => remove(tempDirectory));
91+
beforeAll(() => {
92+
remove(tempDirectory);
93+
});
9294
it("should compile", function(done) {
9395
const outputDirectory = path.join(__dirname, "js", "watch", category.name, testName);
9496

test/browsertest/lib/index.web.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe("main", function() {
2020
expect(window.library2common.ok2).toEqual(expect.anything());
2121
expect(window.library2common.ok2).toBe(true);
2222
expect(window.library2).toEqual(expect.anything());
23-
expect(window.toBeTruthy()).toEqual(expect.anything());
24-
expect(window.toBeTruthy()).toBe(true);
23+
expect(window.library2.ok).toEqual(expect.anything());
24+
expect(window.library2.ok).toBe(true);
2525
});
2626

2727
describe("web resolving", function() {
@@ -32,16 +32,16 @@ describe("main", function() {
3232
it("should load correct replacements for files", function(done) {
3333
require.ensure(["subcontent"], function(require) {
3434
// Comments work!
35-
exports.toBeTruthy() = true;
35+
exports.ok = true;
3636
test(require("subcontent") === "replaced", "node_modules should be replaced with web_modules");
3737
test(require("subcontent2/file.js") === "orginal", "node_modules should still work when web_modules exists");
3838
done();
3939
});
4040
});
4141

4242
after(function() {
43-
expect(exports.toBeTruthy()).toEqual(expect.anything());
44-
expect(exports.toBeTruthy()).toBe(true);
43+
expect(exports.ok).toEqual(expect.anything());
44+
expect(exports.ok).toBe(true);
4545
});
4646
});
4747

test/browsertest/library2config.coffee

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ exports.default = new Promise (resolve, reject) ->
1212
]
1313
amd:
1414
fromOptions: true
15-
resolve:
16-
# cannot resolve should outside the outermost node_modules
17-
# so it is injected here
18-
alias:
19-
should: require.resolve "should"
2015
plugins: [
2116
new webpack.optimize.LimitChunkCountPlugin
2217
maxChunks: 3

test/browsertest/node_modules/library2/lib/main.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cases/context/issue-524/index.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,3 @@ it("should support an empty context", function() {
99
}).toThrowError();
1010
expect(c.keys()).toEqual([]);
1111
});
12-
13-
// This would be a useful testcase, but it requires an (really) empty directory.
14-
// **but** you cannot commit empty directories into git
15-
/*it("should support an empty context (empty dir)", function() {
16-
var c = require.context("./empty", true, /^nothing$/);
17-
c.id.should.be.type("number");
18-
(function() {
19-
c.resolve("");
20-
}).should.throw();
21-
(function() {
22-
c("");
23-
}).should.throw();
24-
expect(c.keys()).toEqual([]);
25-
});*/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
it("should not have commonjs stuff available", function() {
22
if(typeof module !== "undefined") { // If module is available
3-
module.should.have.property("webpackTestSuiteModule"); // it must be the node.js module
3+
expect(module).toHaveProperty("webpackTestSuiteModule"); // it must be the node.js module
44
}
55
if(typeof require !== "undefined") { // If require is available
6-
require.should.have.property("webpackTestSuiteRequire"); // it must be the node.js require
6+
expect(require).toHaveProperty("webpackTestSuiteRequire"); // it must be the node.js require
77
}
88
});

test/configCases/async-commons-chunk/existing-name/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require("should");
21
const sinon = require("sinon");
32
const chunkLoadingSpy = sinon.spy(__webpack_require__, "e");
43

test/configCases/commons-chunk-plugin/correct-order/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
var a = require("./a");
42

53
it("should run", function() {
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
require("should");
2-
3-
it("should run successful", function() {
4-
});
1+
it("should run successful", function() {});

test/configCases/commons-chunk-plugin/hot-multi/first.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
require("./common");
42

53
it("should have the correct main flag for multi first module", function() {

test/configCases/commons-chunk-plugin/hot-multi/second.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
require("./common");
42

53
it("should have the correct main flag for multi second module", function() {

test/configCases/commons-chunk-plugin/hot/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
it("should have the correct main flag", function() {
42
var a = require("./vendor");
53
expect(a._main).toBe(false);

test/configCases/commons-chunk-plugin/inverted-order/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
var a = require("./a");
42

53
it("should run", function() {

test/configCases/commons-chunk-plugin/simple/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
it("should run", function() {
42
var a = require("./a");
53
expect(a).toBe("a");

test/configCases/dll-plugin/1-use-dll/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var should = require("should");
21
import d from "dll/d";
32
import { x1, y2 } from "./e";
43
import { x2, y1 } from "dll/e";

test/configCases/dll-plugin/2-use-dll-without-scope/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var should = require("should");
21
import d from "../0-create-dll/d";
32
import { x1, y2 } from "./e";
43
import { x2, y1 } from "../0-create-dll/e";

test/configCases/dll-plugin/3-use-dll-with-hashid/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var should = require("should");
21
import d from "../0-create-dll/d";
32
import { x1, y2 } from "./e";
43
import { x2, y1 } from "../0-create-dll/e";
@@ -28,5 +27,3 @@ it("should load an harmony module from dll (star export)", function() {
2827
it("should load a module with loader applied", function() {
2928
expect(require("../0-create-dll/g.abc.js")).toBe("number");
3029
});
31-
32-
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
it("should not load node-libs-browser when node option is false", function() {
42
expect((typeof process)).toBe("undefined");
53
});
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require("should");
2-
31
it("should add node-libs-browser to target web by default", function() {
42
expect(process.browser).toBe(true);
53
});
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
it("should provide a global Buffer shim", function () {
22
expect(Buffer).toBeInstanceOf(Function);
33
});
4-
5-
it("should fail on the buffer module"/*, function () {
6-
(function(argument) {
7-
try {
8-
require("buffer");
9-
} catch(e) { throw e; }
10-
}).should.throw();
11-
}*/);

test/configCases/target/strict-mode-global/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use strict";
22

3-
require("should");
4-
53
it("should be able to use global in strict mode", function() {
64
expect((typeof global)).toBe("object");
75
expect((global === null)).toBe(false)

test/configCases/target/web/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ it("should provide a global Buffer constructor", function() {
55
expect(Buffer).toBeInstanceOf(Function);
66
});
77

8-
// Webpack is not providing a console shim by default
9-
// @see lib/WebpackOptionsDefaulter.js
10-
// Uncomment this when defaults are changed
11-
//it("should provide a global console shim", function () {
12-
// console.should.be.an.Object();
13-
// console.time.should.be.a.Function();
14-
//});
15-
168
it("should provide a global process shim", function () {
179
expect(process).toBeInstanceOf(Object);
1810
});

test/setupTestFramework.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ expect.extend({
1212
` ${this.utils.printExpected(expected)}\n` +
1313
"Received:\n" +
1414
` ${this.utils.printReceived(objType)}`
15-
: () => {
16-
return (
17-
this.utils.matcherHint(".toBeTypeOf") +
18-
"\n\n" +
19-
"Expected value to be (using typeof):\n" +
20-
` ${this.utils.printExpected(expected)}\n` +
21-
"Received:\n" +
22-
` ${this.utils.printReceived(objType)}`
23-
);
24-
};
15+
: () =>
16+
this.utils.matcherHint(".toBeTypeOf") +
17+
"\n\n" +
18+
"Expected value to be (using typeof):\n" +
19+
` ${this.utils.printExpected(expected)}\n` +
20+
"Received:\n" +
21+
` ${this.utils.printReceived(objType)}`;
2522

2623
return { message, pass };
2724
}

yarn.lock

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,44 +4737,6 @@ shellwords@^0.1.1:
47374737
version "0.1.1"
47384738
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
47394739

4740-
should-equal@^1.0.0:
4741-
version "1.0.1"
4742-
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-1.0.1.tgz#0b6e9516f2601a9fb0bb2dcc369afa1c7e200af7"
4743-
dependencies:
4744-
should-type "^1.0.0"
4745-
4746-
should-format@^3.0.2:
4747-
version "3.0.3"
4748-
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
4749-
dependencies:
4750-
should-type "^1.3.0"
4751-
should-type-adaptors "^1.0.1"
4752-
4753-
should-type-adaptors@^1.0.1:
4754-
version "1.1.0"
4755-
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
4756-
dependencies:
4757-
should-type "^1.3.0"
4758-
should-util "^1.0.0"
4759-
4760-
should-type@^1.0.0, should-type@^1.3.0, should-type@^1.4.0:
4761-
version "1.4.0"
4762-
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
4763-
4764-
should-util@^1.0.0:
4765-
version "1.0.0"
4766-
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063"
4767-
4768-
should@^11.1.1:
4769-
version "11.2.1"
4770-
resolved "https://registry.yarnpkg.com/should/-/should-11.2.1.tgz#90f55145552d01cfc200666e4e818a1c9670eda2"
4771-
dependencies:
4772-
should-equal "^1.0.0"
4773-
should-format "^3.0.2"
4774-
should-type "^1.4.0"
4775-
should-type-adaptors "^1.0.1"
4776-
should-util "^1.0.0"
4777-
47784740
sigmund@^1.0.1:
47794741
version "1.0.1"
47804742
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"

0 commit comments

Comments
 (0)