Skip to content

Commit

Permalink
Improve error message when webpack-configs test fails
Browse files Browse the repository at this point in the history
The "toContainSubset" assertion is terrible when the error is in values
missing from the target object. I wasted so much time in deciphering a
build failure because of that...
  • Loading branch information
valscion committed Feb 4, 2018
1 parent cddc615 commit 3041c68
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/plugin/test/webpack-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ async function expectValidReport(opts) {
expect(fs.existsSync(`${__dirname}/output/${bundleFilename}`)).to.be.true;
expect(fs.existsSync(`${__dirname}/output/${reportFilename}`)).to.be.true;
const chartData = await getChartDataFromReport(reportFilename);
expect(chartData[0]).to.containSubset({
expect({
label: chartData[0].label,
statSize: chartData[0].statSize,
parsedSize: chartData[0].parsedSize,
gzipSize: chartData[0].gzipSize
}).to.deep.equal({
label: bundleLabel,
statSize,
parsedSize,
Expand Down

0 comments on commit 3041c68

Please sign in to comment.