Added test to account for module parsing failure for binary files

This commit is contained in:
Lex Alexander 2019-06-04 11:45:48 -07:00
parent aa78e27a44
commit 2cd6489579
2 changed files with 22 additions and 0 deletions

View File

@ -527,4 +527,26 @@ You may need an appropriate loader to handle this file type, currently no loader
}
);
});
it("should show 'source code omitted for this binary file' when module parsing fails for binary files", done => {
const folder = path.join(__dirname, "/fixtures");
getErrors(
{
mode: "development",
entry: path.resolve(folder, "./font.ttf"),
module: {}
},
(errors, warnings) => {
expect(errors).toMatchInlineSnapshot(`
Array [
"../font.ttf 1:0
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)",
]
`);
done();
}
);
});
});

BIN
test/fixtures/font.ttf vendored Normal file

Binary file not shown.