Skip to content

Commit d803bc1

Browse files
timseTheLarkInn
authored andcommitted
give hint what warnings were expected and which file (webpack#3842)
currently if you "break" warnings you have no idea which ones where supposed to show or which module actually failed.
1 parent 86c0020 commit d803bc1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎test/checkArrayExpectation.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ module.exports = function checkArrayExpectation(testDirectory, object, kind, fil
1212
return !/from UglifyJs/.test(item);
1313
});
1414
if(fs.existsSync(path.join(testDirectory, filename + ".js"))) {
15-
var expected = require(path.join(testDirectory, filename + ".js"));
15+
var expectedFilename = path.join(testDirectory, filename + ".js");
16+
var expected = require(expectedFilename);
1617
if(expected.length < array.length)
17-
return done(new Error("More " + kind + "s while compiling than expected:\n\n" + array.join("\n\n"))), true;
18+
return done(new Error("More " + kind + "s while compiling than expected:\n\n" + array.join("\n\n") + ". Check expected warnings: " + filename)), true;
1819
else if(expected.length > array.length)
19-
return done(new Error("Less " + kind + "s while compiling than expected:\n\n" + array.join("\n\n"))), true;
20+
return done(new Error("Less " + kind + "s while compiling than expected:\n\n" + array.join("\n\n") + ". Check expected warnings: " + filename)), true;
2021
for(var i = 0; i < array.length; i++) {
2122
if(Array.isArray(expected[i])) {
2223
for(var j = 0; j < expected[i].length; j++) {

0 commit comments

Comments
 (0)