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

Mocha not working under windows #605

Closed
dinkelaker opened this issue Jan 15, 2019 · 4 comments
Closed

Mocha not working under windows #605

dinkelaker opened this issue Jan 15, 2019 · 4 comments

Comments

@dinkelaker
Copy link

dinkelaker commented Jan 15, 2019

Description

When building octotree on Windows 10 and then executing the tests, test execution will fail with an error message "Error: spawn ./node_modules/.bin/mocha ENOENT". That is under Windows, it cannot find the shell script for mocha.

Obviously, the library spawn/child_process does not support Windows executables (e.g. transperently invoking them by trying to attach the extension .exe, .com, or .cmd in case the filepath is not available).

Expected solution:
For Windows environments, use path to ".\node_modules.bin\mocha.cmd"
Otherwise, use path "./node_modules/.bin/mocha"
(I opened PR #606 for fixing this issue).

This solution is supported by other issues:
nodejs/node-v0.x-archive#2318 (comment)
https://stackoverflow.com/a/39682805/1703453

Environment (if bug)

  • Octotree version:
    v2.5.1
    commit dca1cfb (master)
    Tue Jan 15 05:53:22 2019 +0300

  • Browser & version:
    N/A

  • OS & version:

winver
Windows 10, Version 1709, Build 16299.785

node -v
v8.12.0

npm -v
6.5.0

  • Screenshot, if any (drag an image here)
    N/A

  • Console error log below this line

npm install
...
npm run build
...

npm run test

[email protected] test D:\projects\trial\octotree
gulp test

[14:25:05] Using gulpfile D:\projects\trial\octotree\gulpfile.js
[14:25:05] Starting 'build'...
gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead.
[14:25:05] Starting 'clean'...
[14:25:06] Finished 'clean' after 138 ms
[14:25:06] Starting 'styles'...
[14:25:06] Finished 'styles' after 471 ms
[14:25:06] Starting 'chrome:template'...
[14:25:06] Starting 'lib:ondemand'...
[14:25:06] Finished 'lib:ondemand' after 2.96 ms
[14:25:06] Finished 'chrome:template' after 103 ms
[14:25:06] Starting 'chrome:js'...
[14:25:06] Finished 'chrome:js' after 96 ms
[14:25:06] Starting 'chrome'...
[14:25:06] Finished 'chrome' after 126 ms
[14:25:06] Starting 'chrome:template'...
[14:25:06] Starting 'lib:ondemand'...
[14:25:06] Finished 'lib:ondemand' after 2.27 ms
[14:25:06] Finished 'chrome:template' after 13 ms
[14:25:06] Starting 'chrome:js'...
[14:25:06] Finished 'chrome:js' after 42 ms
[14:25:06] Starting 'chrome'...
[14:25:07] Finished 'chrome' after 78 ms
[14:25:07] Starting 'opera'...
[14:25:07] Finished 'opera' after 92 ms
[14:25:07] Starting 'safari:template'...
[14:25:07] Starting 'lib:ondemand'...
[14:25:07] Finished 'lib:ondemand' after 2.11 ms
[14:25:07] Finished 'safari:template' after 13 ms
[14:25:07] Starting 'safari:js'...
[14:25:07] Finished 'safari:js' after 31 ms
[14:25:07] Starting 'safari'...
[14:25:07] Finished 'safari' after 78 ms
[14:25:07] Starting 'firefox:template'...
[14:25:07] Starting 'lib:ondemand'...
[14:25:07] Finished 'lib:ondemand' after 2.03 ms
[14:25:07] Finished 'firefox:template' after 10 ms
[14:25:07] Starting 'firefox:js'...
[14:25:07] Finished 'firefox:js' after 29 ms
[14:25:07] Starting 'firefox'...
[14:25:07] Finished 'firefox' after 77 ms
[14:25:07] Finished 'build' after 1.42 s
[14:25:07] Starting 'test'...
events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn ./node_modules/.bin/mocha ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: gulp test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users<userid>\AppData\Roaming\npm-cache_logs\2019-01-15T13_25_07_392Z-debug.log

@dinkelaker dinkelaker changed the title Mocha CLI not working under windows Mocha not working under windows Jan 15, 2019
@dinkelaker
Copy link
Author

dinkelaker commented Jan 23, 2019

@steffen from GH wants to have a look at this issue.

@buunguyen
Copy link
Collaborator

I'm not sure about this, maybe report to Mocha instead of Octotree?

@dinkelaker
Copy link
Author

I don't think opening a bug report against Mocha makes sense here.
There is a bug in gulpfile.js of Octotree that shows only when executing the test under Windows.
The problem is that the parameters passed to spawn is OS-specific and does not work under windows.

Have you tried to reproduce the problem under windows?
Have your reviewed my PR #606 that fixes the error in Octotree?
If you like that Octotree builds stay OS-independent, feel free to merge my PR.
If not, I would suggest to clearly document what OSes are supported for building Octotree.

@buunguyen
Copy link
Collaborator

I see. Sorry I missed it. I haven't maintained the test for a while though (Selenium tests are too flaky to be fun), so this command is probably unused for a while. Gonna review the PR.

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

2 participants