Skip to content

Commit

Permalink
Loosen matches for import syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Sep 29, 2019
1 parent 1bcaaa4 commit dc2c4ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/integration/compilation.js
Expand Up @@ -3,21 +3,23 @@ const stripAnsi = require('strip-ansi');
const {test} = require('tap');
const {execCli} = require('../helper/cli');

const reImportError = /SyntaxError.*(token|reserved word|import|identifier).*/;

test('precompiler require hook does not apply to source files', t => {
t.plan(3);

execCli('babel-hook.js', (err, stdout) => {
t.ok(err);
t.is(err.code, 1);
t.match(stdout, /Unexpected (token|reserved word)/);
t.match(stdout, reImportError);
t.end();
});
});

test('skips test file compilation when babel=false and compileEnhancements=false', t => {
execCli(['import.js'], {dirname: 'fixture/no-babel-compilation'}, (err, stdout) => {
t.ok(err);
t.match(stdout, /SyntaxError: Unexpected (reserved word|token import|identifier)/);
t.match(stdout, reImportError);
t.end();
});
});
Expand All @@ -41,7 +43,7 @@ test('no power-assert when babel=false and compileEnhancements=false', t => {
test('skips stage-4 transform when babel=false and compileEnhancements=true', t => {
execCli(['import.js'], {dirname: 'fixture/just-enhancement-compilation'}, (err, stdout) => {
t.ok(err);
t.match(stdout, /SyntaxError: Unexpected (reserved word|token import|identifier)/);
t.match(stdout, reImportError);
t.end();
});
});
Expand Down

0 comments on commit dc2c4ef

Please sign in to comment.