Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to test (win 10) #198

Closed
ozkey opened this issue Jul 9, 2016 · 11 comments
Closed

unable to test (win 10) #198

ozkey opened this issue Jul 9, 2016 · 11 comments

Comments

@ozkey
Copy link

ozkey commented Jul 9, 2016

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>
@ozkey
Copy link
Author

ozkey commented Jul 11, 2016

Update: Tried this on Windows 7 and got same result as expected.
It looks like this build is Linux / Mac only

@brandon-arnold
Copy link

brandon-arnold commented 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.

@brandon-arnold
Copy link

I should also mention that there was a resulting "TypeError: callback is not a function" from mongodb-prebuilt after I did this, which is a known issue with that package. I got it working as described here, but obviously this is sub-optimal.

@ozkey
Copy link
Author

ozkey commented Jul 14, 2016

Fixed
Thank you

@ozkey ozkey closed this as completed Jul 14, 2016
@ozkey ozkey mentioned this issue Jul 15, 2016
@OskarKlintrot
Copy link

Why is this closed? The bug is still present!

W10
node v6.2.2
npm v3.9.5

C:\_dev\mearnTestApp [master +0 ~1 -0 !]> npm run test

> mern-starter@2.0.0 test C:\_dev\mearnTestApp
> 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

C:\_dev\mearnTestApp\node_modules\.bin\ava:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:513:28)
    at Module.replacementCompile (C:\_dev\mearnTestApp\node_modules\nyc\node_modules\append-transform\index.js:58:13)
    at module.exports (C:\_dev\mearnTestApp\node_modules\nyc\node_modules\default-require-extensions\js.js:8:9)
    at Object.<anonymous> (C:\_dev\mearnTestApp\node_modules\nyc\node_modules\append-transform\index.js:62:4)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at Function.runMain (C:\Users\oskar.klintrot\.node-spawn-wrap-12752-448f11fd7ddf\node:40:10)
 ----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

@brandon-arnold
Copy link

@OscarKlintrot: Probably because it's a duplicate of open issue #201.

@OskarKlintrot
Copy link

@brandon-arnold: No, they are only related (as the author writes). I don't get the error in #201, only this one. Looks more like the author was satisfied with the help he got rather than that the bug got fixed. npm --harmony-proxies has now been changed to node --harmony-proxies but that is still causing the same problem. I guess that someone has put some thought behind it so I don't really want to create a PR either. Or maybe I'll can and see what the programmers says about it, maybe it isn't needed.

@OskarKlintrot
Copy link

I guess --harmony-proxies is to be able to run the tests on Node <v6.x.x: https://travis-ci.org/Hashnode/mern-starter/jobs/173191479. That explains why I didn't get the error, I'm using Node v6.2.2. This should hopefully be fixed when #221 is fixed.

@acooley
Copy link

acooley commented Nov 14, 2016

I'm also getting this error and I'm on the very latest version of node (7.1.0), so I don't see that this has been fixed. I've applied the suggested changes and that does resolve the issue, but these seem like pretty fundamentally important command line arguments to me. This bug should be re-opened.

@OskarKlintrot
Copy link

@ozkey: Can you reopen this issue?

@Johnz86
Copy link

Johnz86 commented Nov 23, 2016

I am also experiencing this issue.

This works in windows 7. But it runs tests serially instead in parallel.

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

If I run the tests without the "--serial" option they will hang indefinitely at the end.

What concerns me are also the warning messages.

npm run test

> dicom-imagepool@1.0.0 test C:\GIT\ImgPoolWebApp
> cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://192.168.99.100:27017/mern-test node_modules/.bin/nyc node_modules/.bin/ava --serial

MERN is running on port: 8080! Build something amazing!
[React Intl] Missing message: "switchLanguage" for locale: "en"
[React Intl] Cannot format message: "switchLanguage", using message id as fallback.
[React Intl] Missing message: "siteTitle" for locale: "en"
[React Intl] Cannot format message: "siteTitle", using message id as fallback.
[React Intl] Missing message: "addPost" for locale: "en"
[React Intl] Cannot format message: "addPost", using message id as fallback.
[React Intl] Missing message: "learnMore" for locale: "en"
[React Intl] Cannot format message: "learnMore", using message id as fallback.
Warning: Failed prop type: The prop `intl` is marked as required in `PostCreateWidget`, but its value is `undefined`.
    in PostCreateWidget
[React Intl] Missing message: "createNewPost" for locale: "en"
[React Intl] Cannot format message: "createNewPost", using message id as fallback.
[React Intl] Missing message: "submit" for locale: "en"
[React Intl] Cannot format message: "submit", using message id as fallback.
[React Intl] Missing message: "createNewPost" for locale: "en"
[React Intl] Cannot format message: "createNewPost", using message id as fallback.
[React Intl] Missing message: "submit" for locale: "en"
[React Intl] Cannot format message: "submit", using message id as fallback.
[React Intl] Missing message: "createNewPost" for locale: "en"
[React Intl] Cannot format message: "createNewPost", using message id as fallback.
[React Intl] Missing message: "submit" for locale: "en"
[React Intl] Cannot format message: "submit", using message id as fallback.
[React Intl] Missing message: "createNewPost" for locale: "en"
[React Intl] Cannot format message: "createNewPost", using message id as fallback.
[React Intl] Missing message: "submit" for locale: "en"
[React Intl] Cannot format message: "submit", using message id as fallback.
[React Intl] Missing message: "by" for locale: "en"
[React Intl] Cannot format message: "by", using message id as fallback.
[React Intl] Missing message: "deletePost" for locale: "en"
[React Intl] Cannot format message: "deletePost", using message id as fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants