Skip to content

Commit

Permalink
Fix error handling test that broke because uglify-js started supporti…
Browse files Browse the repository at this point in the history
…ng template strings
  • Loading branch information
papandreou committed Feb 8, 2021
1 parent 73afa2f commit f7233e8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/transforms/compressJavaScript.js
Expand Up @@ -27,29 +27,28 @@ describe('transforms/compressJavaScript', function () {
});
}

it('should warn when UglifyJS runs into a parse error and leave the asset unchanged', async function () {
it.only('should warn when UglifyJS runs into a parse error and leave the asset unchanged', async function () {
const warnSpy = sinon.spy().named('warn');
const assetGraph = new AssetGraph();
assetGraph.on('warn', warnSpy);
assetGraph.addAsset({
const a = assetGraph.addAsset({
url: 'https://example.com/script.js',
type: 'JavaScript',
text: 'var foo = `123`;',
text: 'foo?.bar',
});
await assetGraph.compressJavaScript({ type: 'JavaScript' }, 'uglifyJs');

expect(warnSpy, 'to have calls satisfying', function () {
warnSpy(
new errors.ParseError(
"Parse error in https://example.com/script.js\nUnexpected character '`' (line 1, column 11)"
'Parse error in https://example.com/script.js\nUnexpected token: punc «.» (line 1, column 5)'
)
);
});
expect(assetGraph, 'to contain asset', 'JavaScript');
expect(
assetGraph.findAssets({ type: 'JavaScript' })[0].text,
'to equal',
'var foo = `123`;'
'foo?.bar'
);
});

Expand Down

0 comments on commit f7233e8

Please sign in to comment.