Closed
Description
I encountered a problem on Travis when running gulp unit --nobuild --headless --local_changes
. Error is:
[20:51:52] 'unit' errored after 10 s
[20:51:52] SyntaxError: Unexpected token, expected ";" (24:52)
at Object._raise (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:766:17)
at Object.raiseWithData (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:759:17)
at Object.raise (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:753:17)
at Object.unexpected (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:8966:16)
at Object.semicolon (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:8948:40)
at Object.parseImport (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:12814:10)
at Object.parseStatementContent (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:11531:27)
at Object.parseStatement (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:11431:17)
at Object.parseBlockOrModuleBlockBody (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:12013:25)
at Object.parseBlockBody (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:11999:10)
at Object.parseTopLevel (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:11362:10)
at Object.parse (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:13045:10)
at Object.parse (/Users/shihuaz/work/amphtml/node_modules/@babel/parser/lib/index.js:13098:38)
at Object.parse (/Users/shihuaz/work/amphtml/node_modules/list-imports-exports/index.js:8:20)
at getImports (/Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:90:40)
at /Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:119:11
at Array.forEach (<anonymous>)
at getJsFilesFor (/Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:117:18)
at /Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:215:34
at Array.forEach (<anonymous>)
at unitTestsToRun (/Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:205:16)
at getUnitTestsToRun (/Users/shihuaz/work/amphtml/build-system/tasks/runtime-test/helpers-unit.js:139:17)
The apparent reason is that https://www.npmjs.com/package/list-imports-exports is unable to parse https://github.com/ampproject/amphtml/blob/master/extensions/amp-story-auto-ads/0.1/story-ad-localization.js#L24
import xxx from xxx assert {type: "json"};
https://github.com/tc39/proposal-import-assertions this is where this syntax was founded I believe.