This is short and sweet. I will flesh it out soon, I promise. But for now, this should work!
PhantomJS is dead, and it's very difficult to get it downloaded and working. I will walk you through an alternative to get Jasmine running in Gulp.
Note: I have Jasmine working with this set up, but the built in test from Udacity is failing its test for me. But if I add my own tests that I know will pass, they pass.
npm install gulp-jasmine-browser
npm install puppeteer
npm install jasmine-core
Tell gulp we want to use Jasmine Browser!
var jasmineBrowser = require('gulp-jasmine-browser');
They are both simple, I suggest trying both, just to see what the different code is like and seeing how you can do something multiple ways.
Add the following to your gulpfile:
gulp.task('tests', function() { return gulp.src('tests/spec/extraSpec.js') .pipe(jasmineBrowser.specRunner({console: true})) .pipe(jasmineBrowser.headless({driver: 'chrome'})); });
Run gulp tests
in your terminal, you should get the output from the tests.
Add the following to your gulpfile:
gulp.task('tests', function() { gulp.src('tests/spec/extraSpec.js') .pipe(jasmineBrowser.specRunner()) .pipe(jasmineBrowser.server({port:8888})); });
Run gulp tests
in your terminal. Once your terminal says something like Jasmine server listening on port 8888
, go into your browser and go to localhost:8888
. You should see the test runin the browser there. When you are done, go back into your terminal and hit Control + C to exit from the server.