Skip to content

Commit

Permalink
Switch from PhantomJS to Chrome Headless via Puppeteer (#269)
Browse files Browse the repository at this point in the history
Closes #257

This PR tears out PhantomJS (no longer maintained) and replaces it with Chrome Headless via the Puppeteer project. Our office got tired of fighting with PhamtomJS.

Here are the highlights of the changes:

  Removed all references to phantomjs (not quite there yet)
  Upgrade from jshint to eslint (required for the async/await code IIRC)
  Cleaned up a bunch of apparently unused jasmine files
  Upgraded min node version from 0.10.0 to 7.6.0 (required for async/await)
  • Loading branch information
stdavis authored and vladikoff committed May 20, 2018
1 parent 55594d0 commit 02e72f3
Show file tree
Hide file tree
Showing 38 changed files with 4,875 additions and 10,691 deletions.
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2017
},
"env": {
"browser": true,
"node": true,
"jasmine": true,
"es6": true
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ junit
.DS_Store
.grunt
/_SpecRunner.html
.custom
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
sudo: false
sudo: required

language: node_js

node_js:
- "6"
- "8"
- "9"
- "10"

matrix:
fast_finish: true
Expand Down
29 changes: 7 additions & 22 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
module.exports = function(grunt) {

grunt.initConfig({

connect: {
return500: {
options: {
Expand All @@ -25,15 +24,14 @@ module.exports = function(grunt) {
}
}
},
jshint: {
eslint: {
all: [
'Gruntfile.js',
'tasks/**/*.js',
'test/*.js',
'test/selfTest/*.js'
'test/*.js'
],
options: {
jshintrc: '.jshintrc'
configFile: '.eslintrc'
}
},
watch: {
Expand All @@ -51,13 +49,8 @@ module.exports = function(grunt) {
summary: true,
junit: {
path: 'junit'
}
}
},
phantomPolyfills: {
src: 'test/fixtures/phantom-polyfills/src/**/*.js',
options: {
specs: 'test/fixtures/phantom-polyfills/spec/**/*.js'
},
display: 'full'
}
},
consoleDisplayOptions: {
Expand Down Expand Up @@ -118,29 +111,21 @@ module.exports = function(grunt) {
specs: 'test/fixtures/custom-temp-dir/spec/**/*.js',
tempDir: '.custom/'
}
},
selfTest: {
options: {
specs: ['test/selfTest/*.js'],
'--web-security': 'no'
}
}
},


nodeunit: {
tasks: ['test/*_test.js']
}
});

grunt.loadTasks('tasks');

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-internal');
grunt.loadNpmTasks('grunt-contrib-connect');

grunt.registerTask('test', ['jshint', 'connect:return500', 'jasmine', 'nodeunit']);
grunt.registerTask('test', ['eslint', 'connect:return500', 'jasmine', 'nodeunit']);
grunt.registerTask('default', ['test', 'build-contrib']);
};
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# grunt-contrib-jasmine v1.1.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-jasmine.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-jasmine) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/5985958by5rhnh31/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-jasmine/branch/master)

> Run jasmine specs headlessly through PhantomJS
> Run jasmine specs headlessly through Headless Chrome


Expand All @@ -24,7 +24,7 @@ grunt.loadNpmTasks('grunt-contrib-jasmine');
## Jasmine task
_Run this task with the `grunt jasmine` command._

Automatically builds and maintains your spec runner and runs your tests headlessly through PhantomJS.
Automatically builds and maintains your spec runner and runs your tests headlessly through Headless Chrome.

#### Run specs locally or on a remote server

Expand Down Expand Up @@ -98,7 +98,7 @@ Automatically deleted upon normal runs.
Type: `String`
Default: `_SpecRunner.html`

The auto-generated specfile that phantomjs will use to run your tests.
The auto-generated specfile that Headless Chrome will use to run your tests.
Automatically deleted upon normal runs. Use the `:build` flag to generate a SpecRunner manually e.g.
`grunt jasmine:myTask:build`

Expand Down Expand Up @@ -130,7 +130,7 @@ Specify a custom JUnit template instead of using the default `junitTemplate`.
Type: `String`
Default: `''`

The host you want PhantomJS to connect against to run your tests.
The host you want Headless Chrome to connect against to run your tests.

e.g. if using an ad hoc server from within grunt

Expand Down Expand Up @@ -358,4 +358,4 @@ grunt.initConfig({

Task submitted by [Jarrod Overson](http://jarrodoverson.com)

*This file was generated on Thu Jan 12 2017 13:09:46.*
*This file was generated on Mon May 14 2018 15:35:38.*
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ version: "{build}"
# What combinations to test
environment:
matrix:
- nodejs_version: "6"
platform: x86
- nodejs_version: "6"
platform: x64
- nodejs_version: "8"
platform: x86
- nodejs_version: "9"
platform: x86
- nodejs_version: "10"
platform: x86

install:
- ps: Install-Product node $env:nodejs_version $env:platform
Expand Down
4 changes: 2 additions & 2 deletions docs/jasmine-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Automatically deleted upon normal runs.
Type: `String`
Default: `_SpecRunner.html`

The auto-generated specfile that phantomjs will use to run your tests.
The auto-generated specfile that Headless Chrome will use to run your tests.
Automatically deleted upon normal runs. Use the `:build` flag to generate a SpecRunner manually e.g.
`grunt jasmine:myTask:build`

Expand Down Expand Up @@ -80,7 +80,7 @@ Specify a custom JUnit template instead of using the default `junitTemplate`.
Type: `String`
Default: `''`

The host you want PhantomJS to connect against to run your tests.
The host you want Headless Chrome to connect against to run your tests.

e.g. if using an ad hoc server from within grunt

Expand Down
3 changes: 1 addition & 2 deletions docs/jasmine-overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Automatically builds and maintains your spec runner and runs your tests headlessly through PhantomJS.
Automatically builds and maintains your spec runner and runs your tests headlessly through Headless Chrome.

## Run specs locally or on a remote server

Expand All @@ -20,4 +20,3 @@ Supports AMD tests via the [grunt-template-jasmine-requirejs](https://github.com
- [StealJS](https://github.com/jaredstehler/grunt-template-jasmine-steal)

[grunt-contrib-connect]: https://github.com/gruntjs/grunt-contrib-connect

Loading

0 comments on commit 02e72f3

Please sign in to comment.