Tests not running headlessly with webpack #22
Comments
It looks like you are using an old version of phantomjs. If you are using Anyway, once phantomjs is sorted out, headless mode should work. You
|
Fantastic! Upgrading to 2.0 worked like a charm without Here's a tiny repo with three gulp tasks: After |
Gulp jasmine browser expects the stream to be ended in order to signal the creation of the test suite. We would need some other mechanism to support some kind of auto-testing the way you are describing. I'm not sure what we could use to signal the test runner to start creating the test suite and running it. I think the better solution would be to create a watching task that re-runs the task when it detects a change:
I think this would accomplish what you want, it would automatically re-run the spec-console task whenever any spec file changes. It is more idiomatic gulp as well. The only downside to this approach is that webpack wouldn't re-use the partially built files between changes. It would probably still work decently though, your thoughts? |
I believe that using the watch task in the way I've specified should fix the issue, please re-open this issue if it is still a problem. |
Your suggestion was golden, @rdy! I am grateful for both your and @charleshansen's contributions. |
Thanks @rdy , I was able to use gulp+jasmine+slimerjs with watching on Win10 x64 using that method. |
In response to @rdy a few posts above: I arrived at this solution, too, although with Browserify+Watchify instead of WebPack. I don't find the solution very satisfying, because it means creating a new Jasmine server and firing up a new PhantomJS instance every time any of my sources changes. Or at least, that's my impression of how gulp-jasmine browser works. Full story on StackOverflow. I'd like to keep the Jasmine server and the PhantomJS instance between changes. Is there anything I can do to hack around the specrunner's requirement to receive the |
@jgonggrijp if you start an instance of the jasmine server and run it on the same port by specifying that port in the options it does not require you to start one up again. This is documented in the README. If you don't already have a jasmine server running it will start one up on the fly. I haven't tried the browserify + watchify combination myself so I can't comment on its efficacy. As for the end event, it is a requirement of jasmine runner itself. If you wanted a workaround you'd need to make an issue on the jasmine github issues. |
Thanks, this is a relief. So for maximum clarity: is it enough to just specify the port when calling Will this also preserve the driver instance?
Sorry, I can't find the place in the README where this is explained. Could you quote the relevant part? |
@jgonggrijp you can specify the port when calling headless, if you give it 8888 for example it will re-use the server (if you have one running) otherwise it will start one up from scratch. If you don't give headless a port option it will always try to find a new port and start up the server. If you don't want to use the DEFAULT_JASMINE_PORT of 8888 you can specify the port to use in the server options as |
Hey, team!
Is there a known issue with headless specs & webpack, or should I impugn my setup?
Tossing the example code into a gulp file worked out great:
But we ran into problems when we tried to run specs headlessly, i.e.:
The above task logged changes, but didn't seem to run tests:
Weirdly, taking 'the watch' out of our webpack config resulted in this:
When we removed webpack entirely, we got the expected SyntaxError, but also "No Specs found":
The text was updated successfully, but these errors were encountered: