Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MRdNk
Last active December 10, 2015 17:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MRdNk/4469613 to your computer and use it in GitHub Desktop.
Save MRdNk/4469613 to your computer and use it in GitHub Desktop.
Node.js Package.json : Setting your test scripts runner
{
"name": "Demo",
"version": "0.0.0",
"description": "description",
"main": "app.js",
"directories": {
"test": "test"
},
"dependencies": {
},
"devDependencies": {
"tap": "~0.3.3"
},
"scripts": {
"test": "tap ./test"
}
}
@thomaswhite
Copy link

As you commented my question, the line in the scripts section should be: "test": "node tap ./test"

@ralphtheninja
Copy link

Why? "test": "tap ./test" works just fine.

@MRdNk
Copy link
Author

MRdNk commented Mar 3, 2013

@thomaswhite this is because npm runs the tests, rather than node itself.
You type in

npm test

@darelf
Copy link

darelf commented Mar 18, 2013

So why does 'tap ./test' throw an error: 'Arguments to path.resolve must be strings'

But 'tap ./test/mytest.js' works just fine?

@fritx
Copy link

fritx commented Feb 20, 2014

@darelf maybe the parser uses require(),
and your ./test directory neither contains a package.json nor has an index.js..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment