Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot npm test: SyntaxError: Use of const in strict mode. #37

Open
cer opened this issue Jan 18, 2017 · 1 comment
Open

Cannot npm test: SyntaxError: Use of const in strict mode. #37

cer opened this issue Jan 18, 2017 · 1 comment
Assignees

Comments

@cer
Copy link
Collaborator

cer commented Jan 18, 2017

Chriss-MacBook-Pro-2:eventuate-nodejs-client cer$ npm test

> @eventuateinc/[email protected] test /Users/cer/src/eventuate/eventuate-nodejs-client
> mocha --reporter spec --ui bdd test/*-spec.js

/Users/cer/src/eventuate/eventuate-nodejs-client/test/AckOrderTracker-spec.js:3
const AckOrderTracker =require('../dist/modules/stomp/AckOrderTracker');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /Users/cer/src/eventuate/eventuate-nodejs-client/node_modules/mocha/lib/mocha.js:216:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/cer/src/eventuate/eventuate-nodejs-client/node_modules/mocha/lib/mocha.js:213:14)
    at Mocha.run (/Users/cer/src/eventuate/eventuate-nodejs-client/node_modules/mocha/lib/mocha.js:453:10)
    at Object.<anonymous> (/Users/cer/src/eventuate/eventuate-nodejs-client/node_modules/mocha/bin/_mocha:393:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
npm ERR! Test failed.  See above for more details.
Chriss-MacBook-Pro-2:eventuate-nodejs-client cer$ ls -lt dist/
@cer
Copy link
Collaborator Author

cer commented Jan 18, 2017

I read this blog: http://jamesknelson.com/testing-in-es6-with-mocha-and-babel-6/

Made this change:

$ git diff
diff --git a/package.json b/package.json
index 321110e..e684f05 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
   },
   "devDependencies": {
     "babel-cli": "^6.9.0",
+    "babel-core": "^6.21.0",
     "babel-plugin-add-module-exports": "^0.1.4",
     "babel-preset-es2015": "^6.3.13",
     "babel-preset-stage-0": "^6.3.13",

And ran it with this command:

mocha --compilers js:babel-core/register --reporter spec --ui bdd test/*-spec.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants