node.jsecmascript-6mocha.jsvisual-studio-codewallaby.js

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


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?


Solution

  • 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.