question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to test (win 10)

See original GitHub issue

Created a fresh new app and was unable to run “npm test” (Windows 10)

mern init newAPP
cd newApp
npm install

it looks like it tries to run a linux script in (\node_modules.bin\acorn)

the error:

D:\development\newAPP>npm test

> mern-starter@2.0.0 test D:\development\newAPP
> cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava

D:\development\newAPP\node_modules\.bin\ava:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Module.replacementCompile (D:\development\newAPP\node_modules\nyc\node_modules\append-transform\index.js:58:13)
    at module.exports (D:\development\newAPP\node_modules\nyc\node_modules\default-require-extensions\js.js:8:9)
    at Object.<anonymous> (D:\development\newAPP\node_modules\nyc\node_modules\append-transform\index.js:62:4)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at Function.runMain (C:\Users\ozkey\.node-spawn-wrap-3376-b97e9a32b699\node:40:10)
    at Object.<anonymous> (D:\development\newAPP\node_modules\nyc\bin\wrap.js:19:4)
 ----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

npm ERR! Test failed.  See above for more details.

D:\development\newAPP>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

3reactions
brandon-arnoldcommented, Jul 12, 2016

To fix this, I removed the npm --harmony-proxies portion from the “test” command in package.json, and added a --serial flag to the end.

package.json:

    "test": "cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node_modules/.bin/ava --serial",

I’m not sure what the purpose is of npm --harmony-proxies in this command; can the maintainer explain it? This --serial seems to be required when performing the testing upon git commit.

At any rate, in Windows this is the reason for the errors: npm is processing the ava (bash) script as Javascript. Hence dirname is undefined. The node_modules/.bin folder actually has two scripts, ava which is bash and ava.cmd which is a DOS batch file; so it is node_modules/.bin/ava.cmd that gets called on Windows using the above configuration.

1reaction
OskarKlintrotcommented, Nov 14, 2016

@ozkey: Can you reopen this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Easy to Fix “Failed to play test tone” Error
Easy to Fix “Failed to play test tone” Error · Solution 1: Restart Windows Audio Service · Solution 2: Change the Audio Service...
Read more >
Failed to Play Test Tone: How to Fix This Audio Error
1. Update the drivers; 1.1 Update drivers manually · 2. Install the High Definition Audio Device driver · 3. Restart the Windows Audio...
Read more >
[SOLVED] Failed to Play Test Tone Error - TechCult
[SOLVED] Failed to Play Test Tone Error · Method 1: Restart Windows Audio Service · Method 2: Run System File Checker (SFC) and...
Read more >
How To Fix “Failed to play test tone” Error on Windows 10
Fix “Failed to play test tone” Error on Windows 10 · Solution 1: Restart Windows Audio Related Services · Solution 2: Run Audio...
Read more >
Persistent Failed to play Test Tone Error - Microsoft Community
i didn't get an answer . Click on Start Menu, and then go to Settings > Update & Security > Windows Update and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found