Skip to content
Permalink
Browse files

Loosen matches for import syntax errors

  • Loading branch information...
novemberborn committed Sep 29, 2019
1 parent 1bcaaa4 commit dc2c4efa066958c3a630182120227a81e77f0aae
Showing with 5 additions and 3 deletions.
  1. +5 −3 test/integration/compilation.js
@@ -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();
});
});
@@ -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();
});
});

0 comments on commit dc2c4ef

Please sign in to comment.
You can’t perform that action at this time.