Skip to content

Commit 2f6fc4d

Browse files
committed
sort modules in warning for more consistent warnings
1 parent b2420d1 commit 2f6fc4d

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lib/CaseSensitiveModulesWarning.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ function CaseSensitiveModulesWarning(modules) {
66
Error.call(this);
77
Error.captureStackTrace(this, CaseSensitiveModulesWarning);
88
this.name = "CaseSensitiveModulesWarning";
9-
var modulesList = modules.map(function(m) {
9+
var modulesList = modules.slice().sort(function(a, b) {
10+
a = a.identifier();
11+
b = b.identifier();
12+
if(a < b) return -1;
13+
if(a > b) return 1;
14+
return 0;
15+
}).map(function(m) {
1016
var message = "* " + m.identifier();
1117
var validReasons = m.reasons.filter(function(r) {
1218
return r.module;

test/Errors.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ describe("Errors", function() {
7979
if(errors.length === 0) {
8080
warnings.length.should.be.eql(1);
8181
var lines = warnings[0].split("\n");
82-
lines[0].should.match(/file\.js/);
83-
lines[4].should.match(/file\.js/);
82+
lines[4].should.match(/FILE\.js/);
8483
lines[5].should.match(/Used by/);
8584
lines[6].should.match(/case-sensitive/);
86-
lines[7].should.match(/FILE\.js/);
85+
lines[7].should.match(/file\.js/);
8786
lines[8].should.match(/Used by/);
8887
lines[9].should.match(/case-sensitive/);
8988
} else {

0 commit comments

Comments
 (0)