From 27685b5a55ae39d4f93af7e1e584962e91a04460 Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Sat, 7 Apr 2018 09:50:08 -0700 Subject: [PATCH] test: fix `test-cli-syntax` * Removed Chakra-specific messages, they aren't generally necessary * Updated the shared regex to allow for a single-quote before the word boundary. --- test/parallel/test-cli-syntax.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js index 3e853c8c25d..5ff9b163c00 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -14,8 +14,9 @@ const syntaxArgs = [ ]; // Match on the name of the `Error` but not the message as it is different -// depending on the JavaScript engine. -const syntaxErrorRE = /^SyntaxError: \b/m; +// depending on the JavaScript engine. Some ChakraCore messages start with a +// single quote character so add that as an optional character. +const syntaxErrorRE = /^SyntaxError: '?\b/m; const notFoundRE = /^Error: Cannot find module/m; // test good syntax with and without shebang @@ -62,10 +63,7 @@ const notFoundRE = /^Error: Cannot find module/m; assert.strictEqual(stdout, ''); // stderr should have a syntax error message - assert(common.engineSpecificMessage({ - v8: syntaxErrorRE, - chakracore: /^SyntaxError: Expected ';'$/m - }).test(stderr), `${syntaxErrorRE} === ${stderr}`); + assert(syntaxErrorRE.test(stderr), `${syntaxErrorRE} === ${stderr}`); // stderr should include the filename assert(stderr.startsWith(file), `${stderr} starts with ${file}`); @@ -124,10 +122,7 @@ syntaxArgs.forEach(function(args) { assert.strictEqual(c.stdout, ''); // stderr should have a syntax error message - assert(common.engineSpecificMessage({ - v8: syntaxErrorRE, - chakracore: /^SyntaxError: Expected ';'$/m - }).test(c.stderr), `${syntaxErrorRE} === ${c.stderr}`); + assert(syntaxErrorRE.test(c.stderr), `${syntaxErrorRE} === ${c.stderr}`); assert.strictEqual(c.status, 1); });