I see many examples are happily using async/await in their JS tests, but it looks like mine doesn't seem to be using ES8? I'm not sure how to check.

I installed truffle using "npm install truffle" yesterday.



beforeEach(async function() {
  instance = await MyToken.new();


Test output:

$ truffle test
Using network 'development'.

  beforeEach(async function() {

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /Users/.../node_modules/mocha/lib/mocha.js:231:27

2 Answers 2


I figured it out after deciding to post additional details with the versions of truffle and node.

$ node --version
$ truffle test
// no support for async

... install the latest node.

$ node --version
$ truffle test
// async now works :D

With node 8, async/await was enabled by default. Prior to version 7.6 you could use async/await as long as you added the --harmony-async-await flag. For version prior you could also use Babel to transpile down to ES5 compatible javascript. I suggest installing Node 8 or above .

Node ≥ 7.6 confirm by entering node -v in a command line npm ≥ 4 confirm by entering npm -v in command line Truffle ≥ 3.3 confirm by entering truffle -v in command line Ganache-cli ≥ 5.0.0 confirm by entering ganache-cli -v in command line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.