forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaseSensitiveModulesWarning.test.js
54 lines (45 loc) · 1.46 KB
/
CaseSensitiveModulesWarning.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"use strict";
const should = require("should");
const CaseSensitiveModulesWarning = require("../lib/CaseSensitiveModulesWarning");
const createModule = function(identifier, numberOfReasons) {
const reasons = new Array(numberOfReasons || 0).fill(null).map((value, index) => {
return {
module: createModule(`${identifier}-reason-${index}`)
};
});
return {
identifier: () => identifier,
reasons
};
};
describe("CaseSensitiveModulesWarning", () => {
let myCaseSensitiveModulesWarning;
let modules;
beforeEach(() => {
modules = [
createModule("FOOBAR"),
createModule("FooBar", 1),
createModule("foobar", 2)
];
myCaseSensitiveModulesWarning = new CaseSensitiveModulesWarning(modules);
});
it("has the a name", () => myCaseSensitiveModulesWarning.name.should.be.exactly("CaseSensitiveModulesWarning"));
it("has the a message", () => {
myCaseSensitiveModulesWarning.message.should.be.exactly(`
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* FOOBAR
* FooBar
Used by 1 module(s), i. e.
FooBar-reason-0
* foobar
Used by 2 module(s), i. e.
foobar-reason-0
`.trim());
});
it("has the an origin", () =>
myCaseSensitiveModulesWarning.origin.should.be.exactly(modules[0]));
it('has the a module', () =>
myCaseSensitiveModulesWarning.module.should.be.exactly(modules[0]));
});