Karma 4.0.1 fails with unexpected identifier 'async'
See original GitHub issueExpected behaviour
karma 4.0.1 to start the test and successfully test out the specs. While it works fine locally (osx), for some reason it’s failing in CI environment.
Actual behaviour
#!/bin/bash -eo pipefail
cd spec_js
if [ "$CIRCLE_NODE_INDEX" -eq 2 ]; then npm install && npm run test-ci; fi
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN app@0.0.1 No repository field.
npm WARN app@0.0.1 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 372 packages in 10.533s
> app@0.0.1 test-ci /home/circleci/project/spec_js
> ./node_modules/karma/bin/karma start ./karma.conf.js
/home/circleci/project/spec_js/node_modules/karma/lib/server.js:118
async start () {
^^^^^
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/circleci/project/spec_js/node_modules/karma/lib/cli.js:8:16)
at Module._compile (module.js:541:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app@0.0.1 test-ci: `./node_modules/karma/bin/karma start ./karma.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@0.0.1 test-ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2019-03-15T05_32_20_835Z-debug.log
Exited with code 1
Environment Details
- Node
v11.6.0 (npm v6.5.0-next.0)
- Karma -
4.0.1
- Relevant part of your
karma.config.js
file
/// karma.conf.js
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
plugins: [
'karma-chrome-launcher',
'karma-mocha',
'karma-chai',
'karma-sinon',
'karma-string-replace-preprocessor'
],
files: [
'jquery.js',
'../pages.js',
'pages-spec.js'
],
exclude: [],
preprocessors: {
'../pages.js': ['stringreplace']
},
stringReplacePreprocessor: {
patterns: [
{ match: 'process.env.HOST', replacement: '"https://www.host.com"' },
]
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true
});
};
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Loading "grunt-karma.js" tasks...ERROR >> SyntaxError
I reverted my karma version back to 3.1.4 and no longer see the issue: "karma": "^3.1.4",. Also tried Karma version 4.0.0 but error...
Read more >T236282 `npm run selenium` fails on MW Vagrant (SyntaxError
`npm run selenium` fails on MW Vagrant (SyntaxError: Unexpected identifier; due to Node 6). Closed, DuplicatePublic.
Read more >Changelog - Karma test runner
support asynchronous config.set() call in karma.conf.js (#3660) (4c9097a) ... cli: error out on unexpected options or parameters (#3589) (603bbc0) ...
Read more >jest encountered an unexpected token uuid - You.com | The AI ...
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is...
Read more >async function* asyncIterator() { - SyntaxError: Unexpected token
Description. Hi, since the update to 3.2.1, I get this error when I try to start node and it ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The most likely explanation is that your CircleCI is running node < 6.
@yrtimiD Use karma 3.x for node 6.x.