According to the title, I'm trying to test some AMD modules written in ES6 JS powered by nodejs.
I tried Intern first: even after turning on --harmony in nodejs, I ran into the Intern dependency chain where I was unable to turn on Harmony, for example, Istanbul, esprima and others (I opened issue for this).
Then I switched to mocha and here I am stuck ... weird. I have included Harmony for both nodejs and mocha, here is the package.json test script:
"test": "node --harmony node_modules\\mocha\\bin\\mocha tests --harmony --recursive"
which I run from the command line as npm test my_test_folder . However, some ES6 constructs (such as const ) go fine, but then it suffocates when destructuring is assigned. Here are the first output lines:
const { log, dir } = require('../consoleLogger.js'); ^ SyntaxError: Unexpected token { at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) [...continues...]
I also checked this SO thread and heard about transpilers, but I really don't know if they can work , and now I'm trying to make transpilers work in this case.
Any idea on how to solve this problem without resorting to changing all the ES6 bits distributed in the code? TA.
source share