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

Task "gulp test" fails when tests fail #498

Closed
e-oz opened this issue Apr 18, 2015 · 13 comments
Closed

Task "gulp test" fails when tests fail #498

e-oz opened this issue Apr 18, 2015 · 13 comments

Comments

@e-oz
Copy link

e-oz commented Apr 18, 2015

In newly-generated project (v0.11.0) change unit-test to make it fail (any expectation) and after error about failed test you will see also:

[02:37:14] 'test' errored after 1.55 s
[02:37:14] Error: 1
    at formatError (.../local/lib/node_modules/gulp/bin/gulp.js:169:10)
    at Gulp.<anonymous> (.../local/lib/node_modules/gulp/bin/gulp.js:195:15)
    at Gulp.emit (events.js:107:17)
    at Gulp.Orchestrator._emitTaskDone (.../repos/testtest/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
    at .../repos/testtest/node_modules/gulp/node_modules/orchestrator/index.js:275:23
    at finish (.../repos/testtest/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (.../repos/testtest/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at removeAllListeners (.../repos/testtest/node_modules/karma/lib/server.js:220:7)
    at Server.<anonymous> (.../repos/testtest/node_modules/karma/lib/server.js:231:9)
    at Server.g (events.js:199:16)
@Swiip
Copy link
Owner

Swiip commented Apr 21, 2015

Which options, which os? Can you test with this branch #499 ?

@e-oz
Copy link
Author

e-oz commented Apr 21, 2015

no options, os x.
tested with karma-config branch, reproduced (it literally took 20 seconds to test).
Here is generated project: https://github.com/jamm/gulp-angular-test-demo
to see bug, just run gulp test (after npm install, of course).

@e-oz
Copy link
Author

e-oz commented Apr 21, 2015

Only change was made, 5 replaced by 500 here to make test fail:
https://github.com/jamm/gulp-angular-test-demo/blob/master/src/app/main/main.controller.spec.js#L20

@Swiip
Copy link
Owner

Swiip commented Apr 21, 2015

Cloned your project, npm install, bower install, gulp test, it works :/

Which version of Node?

@e-oz
Copy link
Author

e-oz commented Apr 21, 2015

v0.12.0.
It works, test runs, issue is in error after it.

@Swiip
Copy link
Owner

Swiip commented Apr 21, 2015

Yep, but I don't see it...

[10:54:50] Using gulpfile ~/Workspace/Sandbox/gulp-angular-test-demo/gulpfile.js
[10:54:50] Starting 'scripts'...
[10:54:51] Time: 871ms
   Asset  Size  Chunks             Chunk Names
index.js  4259       0  [emitted]  main
[10:54:51] Finished 'scripts' after 1.19 s
[10:54:51] Starting 'test'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/Users/Swiip/Workspace/Sandbox/gulp-angular-test-demo/src/**/*.mock.js" does not match any file.
INFO [PhantomJS 1.9.8 (Mac OS X)]: Connected on socket at0fEK2N6l8qGc2fL-Wp with id 12101164
PhantomJS 1.9.8 (Mac OS X) controllers should define more than 5 awesome things FAILED
    Expected false to be truthy.
        at /Users/Swiip/Workspace/Sandbox/gulp-angular-test-demo/src/app/main/main.controller.spec.js:20
        at invoke (/Users/Swiip/Workspace/Sandbox/gulp-angular-test-demo/bower_components/angular/angular.js:4203)
        at workFn (/Users/Swiip/Workspace/Sandbox/gulp-angular-test-demo/bower_components/angular-mocks/angular-mocks.js:2436)
PhantomJS 1.9.8 (Mac OS X): Executed 1 of 1 (1 FAILED) ERROR (0.003 secs / 0.018 secs)
[10:54:53] 'test' errored after 2.21 s 1

@e-oz
Copy link
Author

e-oz commented Apr 21, 2015

I updated node to 0.12.2 and still see this bug. I will reinstall system from scratch to be sure all is ok with my setup, but it will be on weekend.

@phedinkus
Copy link

I have the same problem.

PhantomJS 1.9.8 (Mac OS X) NavigationServices should define more than 5 awesome things FAILED
    Expected true to be false.
        at /Users/kt/Code/beth_bot/generalizer/client/src/components/services/navigation_service.spec.js:13
        at invoke (/Users/kt/Code/beth_bot/generalizer/client/bower_components/angular/angular.js:4203)
        at workFn (/Users/kt/Code/beth_bot/generalizer/client/bower_components/angular-mocks/angular-mocks.js:2436)
PhantomJS 1.9.8 (Mac OS X): Executed 1 of 1 (1 FAILED) ERROR (0.002 secs / 0.012 secs)
[11:37:37] 'test' errored after 1.63 s
[11:37:37] Error: 1
    at formatError (/usr/local/lib/node_modules/gulp/bin/gulp.js:169:10)
    at Gulp.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp.js:195:15)
    at Gulp.emit (events.js:95:17)
    at Gulp.Orchestrator._emitTaskDone (/Users/kt/Code/beth_bot/generalizer/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
    at /Users/kt/Code/beth_bot/generalizer/node_modules/gulp/node_modules/orchestrator/index.js:275:23
    at finish (/Users/kt/Code/beth_bot/generalizer/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/Users/kt/Code/beth_bot/generalizer/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at removeAllListeners (/Users/kt/Code/beth_bot/generalizer/node_modules/karma/lib/server.js:220:7)
    at Server.<anonymous> (/Users/kt/Code/beth_bot/generalizer/node_modules/karma/lib/server.js:231:9)
    at Server.g (events.js:180:16)

@Olgagr
Copy link

Olgagr commented May 6, 2015

I also has this error:

INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/Users/apple/Projects/trh-cms/src/**/*.spec.js" does not match any file.
WARN [watcher]: Pattern "/Users/apple/Projects/trh-cms/src/**/*.mock.js" does not match any file.
INFO [PhantomJS 1.9.8 (Mac OS X)]: Connected on socket aIocVCG5s2C8nQGdLR0G with id 711462
PhantomJS 1.9.8 (Mac OS X): Executed 0 of 0 ERROR (0.001 secs / 0 secs)
[09:42:35] 'test' errored after 1.14 s
[09:42:35] Error: 1
  at formatError (/usr/local/lib/node_modules/gulp/bin/gulp.js:169:10)
  at Gulp.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp.js:195:15)
  at Gulp.emit (events.js:107:17)
  at Gulp.Orchestrator._emitTaskDone (/Users/apple/Projects/trh-cms/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
  at /Users/apple/Projects/trh-cms/node_modules/gulp/node_modules/orchestrator/index.js:275:23
  at finish (/Users/apple/Projects/trh-cms/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
  at cb (/Users/apple/Projects/trh-cms/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
  at removeAllListeners (/Users/apple/Projects/trh-cms/node_modules/karma/lib/server.js:220:7)
  at Server.<anonymous> (/Users/apple/Projects/trh-cms/node_modules/karma/lib/server.js:231:9)
  at Server.g (events.js:199:16)
  at Server.emit (events.js:129:20)
  at net.js:1409:10
  at process._tickCallback (node.js:355:11)

@eperedo
Copy link

eperedo commented May 13, 2015

I had this error, but updating nodejs 0.12.2 makes it work good on windows 8.1

@joelso
Copy link

joelso commented May 14, 2015

Maybe cutting some corners here, but the done callback is being passed with an argument which indicates failure to gulp. My quick fix was to wrap done in a function that does not pass any argument to the callback (in gulp/unit-tests.js):

...
function runTests (singleRun, done) {
  karma.server.start({
    configFile: path.join(__dirname, '/../karma.conf.js'),
    singleRun: singleRun,
    autoWatch: !singleRun
  }, /* wrapping "done" in a function here */ function() { done(); });
}
...

Edit: I guess it's the singleRun option that is broken somehow. When singleRun is enabled, karma returns with exit code 1 meaning that gulp will show a stacktrace.

@zckrs
Copy link
Collaborator

zckrs commented May 19, 2015

@joelso solution works

@zckrs
Copy link
Collaborator

zckrs commented Jun 18, 2015

🎉 Just released v0.12.0 🎉
Your issue should be fixed. I close but if you can retry your case with a new fresh install of generator you are welcome. Any feedback would be appreciated (positive comments too ^_^).

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

7 participants