Friday, June 24, 2016

wallaby.js got error >> SyntaxError: Unexpected token u

Leave a Comment

i tried to set up wallaby.js on visual studio code.

my project use language: node.js (es6)

  1. test: mocha
  2. ide: visual studio code
  3. node version: v5.9.0

i always got this error when i run wallaby

SyntaxError: Unexpected token u 

====== my wallaby config file (wallaby.js) =======

module.exports = function (wallaby) {   return {     files: [       'server/**/*.js',       '!node_modules/**/*.js'     ],     tests: [       'test/**/*.js'     ],     compilers: {       '**/*.js': wallaby.compilers.babel()     },     env: {       type: 'node',       params: {         runner: '--harmony --harmony_arrow_functions'       }     },     testFramework: 'mocha'   }; }; 

====== error =======

​SyntaxError: Unexpected token u /PATH/config/index.js:3:0 

====== config.index.js ======

'use strict'  module.exports  = {   // do something } 

it looks like there is an error on line module.exports = { because of the es6 syntax.

but i used node 5.9 which support es6

how should i solved this issue?

2 Answers

Answers 1

i have tried to create a small project with simple test cases and wallaby.js work fine.

I am not sure what the cause is but it should be my big code not wallaby.js.

Answers 2

Seems like you need to add missing semicolon at the end of first config line:

'use strict';  module.exports  = {   // do something } 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment