twolfson / gulp.spritesmith

Convert a set of images into a spritesheet and CSS variables via gulp
The Unlicense
1.08k stars 81 forks source link

Unable to run tests (Windows) #56

Closed jednano closed 9 years ago

jednano commented 9 years ago

I'm trying to write a failing test for https://github.com/twolfson/gulp.spritesmith/issues/55, but I'm running into issues running the tests.

First, I had to npm install -g phantomjs just to be able to npm install this project. Once that was done, I ran npm test in both Bash and an administrative command prompt in Windows 8.1. I got the exact same error in both shells:

/.../GitHub/gulp.spritesmith (break-merge *)
16:49 $npm test

> gulp.spritesmith@3.8.2 pretest z:\Documents\GitHub\gulp.spritesmith
> twolfson-style install

> gulp.spritesmith@3.8.2 test z:\Documents\GitHub\gulp.spritesmith
> npm run precheck && cd test && mocha . --timeout 60000 && cd .. && npm run lin
t

> gulp.spritesmith@3.8.2 precheck z:\Documents\GitHub\gulp.spritesmith
> twolfson-style precheck docs/ lib/ test/

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn jshint ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "run" "precheck"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! gulp.spritesmith@3.8.2 precheck: `twolfson-style precheck docs/ lib/ te
st/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gulp.spritesmith@3.8.2 precheck script 'twolfson-style pr
echeck docs/ lib/ test/'.
npm ERR! This is most likely a problem with the gulp.spritesmith package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     twolfson-style precheck docs/ lib/ test/
npm ERR! You can get their info via:
npm ERR!     npm owner ls gulp.spritesmith
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     z:\Documents\GitHub\gulp.spritesmith\npm-debug.log
npm ERR! Test failed.  See above for more details.
twolfson commented 9 years ago

ENOENT means "Error no entity found". This means that jshint cannot be found on your PATH. I am sure you did this but can you verify you ran npm install and that node_modules/.bin/jshint exists?

jednano commented 9 years ago

Yep, it does:

/.../GitHub/gulp.spritesmith (break-merge *)
18:10 $ls node_modules/.bin
_mocha*     js-yaml*     jshint*     rimraf*
_mocha.cmd  js-yaml.cmd  jshint.cmd  rimraf.cmd
gulp*       jscs*        mocha*      twolfson-style*
gulp.cmd    jscs.cmd     mocha.cmd   twolfson-style.cmd
twolfson commented 9 years ago

Weird, maybe there's a bug in twolfson-style with respect to Windows. Can you try removing the npm run precheck and seeing if tests pass?

jednano commented 9 years ago

Nope. precheck is throwing the error.

twolfson commented 9 years ago

Right, I meant adjust the package.json so you can run the tests exclusively. This is to see if there are any other errors in the test suite outside of precheck.

// Inside package.json
"test": "cd test && mocha . --timeout 60000 && cd .. && npm run lint"
jednano commented 9 years ago

Oh! I read it too fast! Sure, the tests pass, but it fails on lint:

/.../GitHub/gulp.spritesmith (break-merge)
21:23 $npm test

> gulp.spritesmith@3.8.2 pretest Z:\Documents\GitHub\gulp.spritesmith
> twolfson-style install

> gulp.spritesmith@3.8.2 test Z:\Documents\GitHub\gulp.spritesmith
> cd test && mocha . --timeout 60000 && cd .. && npm run lint

child_process: customFds option is deprecated, use stdio instead.

  ...................

  19 passing (10 seconds)

> gulp.spritesmith@3.8.2 lint Z:\Documents\GitHub\gulp.spritesmith
> twolfson-style lint docs/ lib/ test/

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn jshint ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! gulp.spritesmith@3.8.2 lint: `twolfson-style lint docs/ lib/ test/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gulp.spritesmith@3.8.2 lint script 'twolfson-style lint d
ocs/ lib/ test/'.
npm ERR! This is most likely a problem with the gulp.spritesmith package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     twolfson-style lint docs/ lib/ test/
npm ERR! You can get their info via:
npm ERR!     npm owner ls gulp.spritesmith
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     Z:\Documents\GitHub\gulp.spritesmith\npm-debug.log
npm ERR! Test failed.  See above for more details.
jednano commented 9 years ago

BTW, I had some CRLFs everywhere, so I had to:

git config core.autocrlf false
git rm --cached -r .
git reset --hard

Strange. I don't normally have to do that with projects and I don't see a .gitattributes file on this project.

twolfson commented 9 years ago

I have successfully reproduced the jshint error on an ievm. I will patch it by the end of next weekend.

With respect to CRLFs, I don't see any carriage returns in the repo (git grep $'\r). Where are you seeing them? Are you sure your global git config is configured to respect the original repo's contents?

jednano commented 9 years ago

Stupid GitHub for Windows always sets the system-wide autocrlf to true. Yeah. I fixed my global setting to override it.

twolfson commented 9 years ago

We have added support for Windows in twolfson-style@1.6.1. Since it was a patch release, the changes should automatically be picked up. I have verified that tests are back to passing in Windows :tada:

Thanks for the bug report =)