Last active

Node.js Package.json : Setting your test scripts runner

  • Download Gist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
"name": "Demo",
"version": "0.0.0",
"description": "description",
"main": "app.js",
"directories": {
"test": "test"
"dependencies": {
"devDependencies": {
"tap": "~0.3.3"
"scripts": {
"test": "tap ./test"

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

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

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

npm test

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

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

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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.