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
});

0 commit comments

Comments
 (0)