Skip to content

Commit 8ee43c8

Browse files
committed
improve case sensitive warning
1 parent a90b968 commit 8ee43c8

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/CaseSensitiveModulesWarning.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ function CaseSensitiveModulesWarning(modules) {
77
Error.captureStackTrace(this, CaseSensitiveModulesWarning);
88
this.name = "CaseSensitiveModulesWarning";
99
var modulesList = modules.map(function(m) {
10-
return "* " + m.identifier();
10+
var message = "* " + m.identifier();
11+
var validReasons = m.reasons.filter(function(r) { return r.module; });
12+
if(validReasons.length > 0) {
13+
message += "\n Used by " + validReasons.length + " module(s), i. e.";
14+
message += "\n " + validReasons[0].module.identifier();
15+
}
16+
return message;
1117
}).join("\n");
1218
this.message = "There are multiple modules with names that only differ in casing.\n" +
1319
"This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\n" +

test/Errors.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ describe("Errors", function() {
8181
var lines = warnings[0].split("\n");
8282
lines[0].should.match(/file\.js/);
8383
lines[4].should.match(/file\.js/);
84-
lines[5].should.match(/FILE\.js/);
84+
lines[5].should.match(/Used by/);
85+
lines[6].should.match(/case-sensitive/);
86+
lines[7].should.match(/FILE\.js/);
87+
lines[8].should.match(/Used by/);
88+
lines[9].should.match(/case-sensitive/);
8589
} else {
8690
errors.length.should.be.eql(1);
8791
warnings.length.should.be.eql(0);

0 commit comments

Comments
 (0)