I am trying to execute the built in until test provided in the metacoin example. I installed Mocha into my project.

I then execute this command: npm test from my console.

I am getting the following error:

C:\Dev\Blockchain\TruffleDemo\test\metacoin.js:1 (function (exports, require, module, __filename, __dirname) { var MetaCoin = artifacts.require("./MetaCoin.sol"); ^ ReferenceError: artifacts is not defined

Any ideas on what I might be missing? Thank you for the assistance!

  • 1
    Please run truffle test instead of npm test
    – rstormsf
    Jun 7, 2017 at 17:19
  • @rstormsf - Thanks, that worked! If you want to post as the answer; I will mark it. Thanks again!
    – Flea
    Jun 7, 2017 at 18:04

1 Answer 1


Run truffle test instead of npm test

  • I am already doing so...
    – Ozan Kurt
    Oct 18, 2021 at 9:30

Your Answer

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

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