PhantomJS is Dead, How do I run Jasmine with Gulp?

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.

Download gulp-jasmine-browser

npm install gulp-jasmine-browser

Install a couple other packages we need for the above to run

npm install puppeteer
npm install jasmine-core

Tell gulp we want to use Jasmine Browser!

var jasmineBrowser = require('gulp-jasmine-browser');

Two Options: Run a server in browser, or run in terminal

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.

To run the Tests in the terminal:

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.

To run the tests in your browser:

Add the following to your gulpfile:

gulp.task('tests', function() {

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.