2

I am trying to use truffle to test my smart contracts and have written some test files. I am getting an error on the terminal trying to run the test and am unsure what the reason is.

I access my directory via terminal and then write:

  • truffle compile
  • truffle develop
  • migrate
  • deploy

So far everything runs fine. Then when I type truffle test it returns this error:

SyntaxError: Unexpected identifier
    at REPLServer.Interface._onLine (readline.js:280:10)
    at REPLServer.emit (events.js:211:7)
    at emitOne (events.js:116:13)
    at REPLServer.onLine (repl.js:468:10)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at bound (domain.js:301:14)
    at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/repl.js:119:1)
    at Console.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/console.js:164:1)
    at Object.runInContext (vm.js:119:10)
    at createScript (vm.js:80:10)

This also happens when I try to run truffle test followed by the address of the directory the test file I want to use is saved in.

Does anybody know what the problem might be? The only solutions I found for similar problems talked about it being a Windows problem. I am using a Mac though so can't apply these solutions.

Thanks!

0

I had the same problem and I managed to bypass it by running truffle test outside the truffle console. I run truffle.cmd test on command line (windows).

0

I was getting the exact same error(word for word) by running the following command from the truffle console "let instance = await VonCoinContract.deployed()" Turns out it was a truffle problem.

"Truffle's console doesn't yet support the await syntax, unfortunately. But! You don't need it for that method; just do session.connect(). Check out the public methods in the Debugger API Docs, that should help. Take note which methods are labeled async, so you know which ones return Promises. " from https://github.com/trufflesuite/truffle-debugger/issues/72

I know not the answer to your question but may be of use to someone to got here the same way I did ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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