Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Use Chrome instead of PhantomJS to run tests #255

Merged
merged 1 commit into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
sudo: false
dist: trusty

language: node_js
node_js:
- "6"

addons:
chrome: stable

cache:
yarn: true

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add phantomjs-prebuilt
- phantomjs --version
Gaurav0 marked this conversation as resolved.
Show resolved Hide resolved

install:
- yarn install --ignore-engines --no-lockfile --non-interactive
Expand Down
120 changes: 63 additions & 57 deletions node-tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ var expect = require('chai').expect;

var FAILING_FILE = __dirname + '/../tests/dummy/app/unused.js';

var execSync = require('child_process').execSync;

var chromeVersion = execSync('google-chrome --product-version').toString();
var browser = 'Chrome ' + chromeVersion.split('.').slice(0, 2).join('.');
var path = require('path');

describe('ember-cli-eslint', function() {
this.timeout(60000);

Expand All @@ -18,17 +24,17 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 1 PhantomJS 2.1 - ESLint | app.js: should pass ESLint')
.to.contain('ok 2 PhantomJS 2.1 - ESLint | controllers/thing.js: should pass ESLint')
.to.contain('ok 3 PhantomJS 2.1 - ESLint | helpers/destroy-app.js: should pass ESLint')
.to.contain('ok 4 PhantomJS 2.1 - ESLint | helpers/module-for-acceptance.js: should pass ESLint')
.to.contain('ok 5 PhantomJS 2.1 - ESLint | helpers/resolver.js: should pass ESLint')
.to.contain('ok 6 PhantomJS 2.1 - ESLint | helpers/start-app.js: should pass ESLint')
.to.contain('ok 7 PhantomJS 2.1 - ESLint | models/thing.js: should pass ESLint')
.to.contain('ok 8 PhantomJS 2.1 - ESLint | resolver.js: should pass ESLint')
.to.contain('ok 9 PhantomJS 2.1 - ESLint | router.js: should pass ESLint')
.to.contain('ok 10 PhantomJS 2.1 - ESLint | test-helper.js: should pass ESLint')
.to.not.contain('not ok 11 PhantomJS 2.1 - ESLint | unused.js: should pass ESLint');
.to.contain(`ok 1 ${browser} - ESLint | app.js: should pass ESLint`)
.to.contain(`ok 2 ${browser} - ESLint | controllers/thing.js: should pass ESLint`)
.to.contain(`ok 3 ${browser} - ESLint | helpers/destroy-app.js: should pass ESLint`)
.to.contain(`ok 4 ${browser} - ESLint | helpers/module-for-acceptance.js: should pass ESLint`)
.to.contain(`ok 5 ${browser} - ESLint | helpers/resolver.js: should pass ESLint`)
.to.contain(`ok 6 ${browser} - ESLint | helpers/start-app.js: should pass ESLint`)
.to.contain(`ok 7 ${browser} - ESLint | models/thing.js: should pass ESLint`)
.to.contain(`ok 8 ${browser} - ESLint | resolver.js: should pass ESLint`)
.to.contain(`ok 9 ${browser} - ESLint | router.js: should pass ESLint`)
.to.contain(`ok 10 ${browser} - ESLint | test-helper.js: should pass ESLint`)
.to.not.contain(`not ok 11 ${browser} - ESLint | unused.js: should pass ESLint`);
})
});

Expand All @@ -40,17 +46,17 @@ describe('ember-cli-eslint', function() {
return emberTest({ NO_GROUPING: true }).then(function(result) {
expect(result.error).to.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 1 PhantomJS 2.1 - ESLint | app.js: should pass ESLint')
.to.contain('ok 2 PhantomJS 2.1 - ESLint | controllers/thing.js: should pass ESLint')
.to.contain('ok 3 PhantomJS 2.1 - ESLint | helpers/destroy-app.js: should pass ESLint')
.to.contain('ok 4 PhantomJS 2.1 - ESLint | helpers/module-for-acceptance.js: should pass ESLint')
.to.contain('ok 5 PhantomJS 2.1 - ESLint | helpers/resolver.js: should pass ESLint')
.to.contain('ok 6 PhantomJS 2.1 - ESLint | helpers/start-app.js: should pass ESLint')
.to.contain('ok 7 PhantomJS 2.1 - ESLint | models/thing.js: should pass ESLint')
.to.contain('ok 8 PhantomJS 2.1 - ESLint | resolver.js: should pass ESLint')
.to.contain('ok 9 PhantomJS 2.1 - ESLint | router.js: should pass ESLint')
.to.contain('ok 10 PhantomJS 2.1 - ESLint | test-helper.js: should pass ESLint')
.to.contain('not ok 11 PhantomJS 2.1 - ESLint | unused.js: should pass ESLint');
.to.contain(`ok 1 ${browser} - ESLint | app.js: should pass ESLint`)
.to.contain(`ok 2 ${browser} - ESLint | controllers/thing.js: should pass ESLint`)
.to.contain(`ok 3 ${browser} - ESLint | helpers/destroy-app.js: should pass ESLint`)
.to.contain(`ok 4 ${browser} - ESLint | helpers/module-for-acceptance.js: should pass ESLint`)
.to.contain(`ok 5 ${browser} - ESLint | helpers/resolver.js: should pass ESLint`)
.to.contain(`ok 6 ${browser} - ESLint | helpers/start-app.js: should pass ESLint`)
.to.contain(`ok 7 ${browser} - ESLint | models/thing.js: should pass ESLint`)
.to.contain(`ok 8 ${browser} - ESLint | resolver.js: should pass ESLint`)
.to.contain(`ok 9 ${browser} - ESLint | router.js: should pass ESLint`)
.to.contain(`ok 10 ${browser} - ESLint | test-helper.js: should pass ESLint`)
.to.contain(`not ok 11 ${browser} - ESLint | unused.js: should pass ESLint`);
})
});

Expand All @@ -60,19 +66,19 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 1 PhantomJS 2.1 - ESLint | app: app.js')
.to.contain('ok 2 PhantomJS 2.1 - ESLint | app: controllers/thing.js')
.to.contain('ok 3 PhantomJS 2.1 - ESLint | app: models/thing.js')
.to.contain('ok 4 PhantomJS 2.1 - ESLint | app: resolver.js')
.to.contain('ok 5 PhantomJS 2.1 - ESLint | app: router.js')
.to.not.contain('not ok 6 PhantomJS 2.1 - ESLint | app: unused.js');
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.not.contain(`not ok 6 ${browser} - ESLint | app: unused.js`);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 6 PhantomJS 2.1 - ESLint | tests: helpers/destroy-app.js')
.to.contain('ok 7 PhantomJS 2.1 - ESLint | tests: helpers/module-for-acceptance.js')
.to.contain('ok 8 PhantomJS 2.1 - ESLint | tests: helpers/resolver.js')
.to.contain('ok 9 PhantomJS 2.1 - ESLint | tests: helpers/start-app.js')
.to.contain('ok 10 PhantomJS 2.1 - ESLint | tests: test-helper.js');
.to.contain(`ok 6 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/resolver.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 10 ${browser} - ESLint | tests: test-helper.js`);
})
});

Expand All @@ -84,19 +90,19 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 1 PhantomJS 2.1 - ESLint | app: app.js')
.to.contain('ok 2 PhantomJS 2.1 - ESLint | app: controllers/thing.js')
.to.contain('ok 3 PhantomJS 2.1 - ESLint | app: models/thing.js')
.to.contain('ok 4 PhantomJS 2.1 - ESLint | app: resolver.js')
.to.contain('ok 5 PhantomJS 2.1 - ESLint | app: router.js')
.to.contain('not ok 6 PhantomJS 2.1 - ESLint | app: unused.js');
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.contain(`not ok 6 ${browser} - ESLint | app: unused.js`);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 7 PhantomJS 2.1 - ESLint | tests: helpers/destroy-app.js')
.to.contain('ok 8 PhantomJS 2.1 - ESLint | tests: helpers/module-for-acceptance.js')
.to.contain('ok 9 PhantomJS 2.1 - ESLint | tests: helpers/resolver.js')
.to.contain('ok 10 PhantomJS 2.1 - ESLint | tests: helpers/start-app.js')
.to.contain('ok 11 PhantomJS 2.1 - ESLint | tests: test-helper.js');
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: helpers/resolver.js`)
.to.contain(`ok 10 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 11 ${browser} - ESLint | tests: test-helper.js`);
})
});

Expand All @@ -106,27 +112,27 @@ describe('ember-cli-eslint', function() {
return emberTest().then(function(result) {
expect(result.error).to.not.exist;
expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 1 PhantomJS 2.1 - ESLint | app: app.js')
.to.contain('ok 2 PhantomJS 2.1 - ESLint | app: controllers/thing.js')
.to.contain('ok 3 PhantomJS 2.1 - ESLint | app: models/thing.js')
.to.contain('ok 4 PhantomJS 2.1 - ESLint | app: resolver.js')
.to.contain('ok 5 PhantomJS 2.1 - ESLint | app: router.js')
.to.contain('ok 6 PhantomJS 2.1 - ESLint | app: routes/thing.jsx')
.to.not.contain('not ok 7 PhantomJS 2.1 - ESLint | app: unused.js');
.to.contain(`ok 1 ${browser} - ESLint | app: app.js`)
.to.contain(`ok 2 ${browser} - ESLint | app: controllers/thing.js`)
.to.contain(`ok 3 ${browser} - ESLint | app: models/thing.js`)
.to.contain(`ok 4 ${browser} - ESLint | app: resolver.js`)
.to.contain(`ok 5 ${browser} - ESLint | app: router.js`)
.to.contain(`ok 6 ${browser} - ESLint | app: routes/thing.jsx`)
.to.not.contain(`not ok 7 ${browser} - ESLint | app: unused.js`);

expect(result.stdout.match(/[^\r\n]+/g))
.to.contain('ok 7 PhantomJS 2.1 - ESLint | tests: helpers/destroy-app.js')
.to.contain('ok 8 PhantomJS 2.1 - ESLint | tests: helpers/module-for-acceptance.js')
.to.contain('ok 9 PhantomJS 2.1 - ESLint | tests: helpers/resolver.js')
.to.contain('ok 10 PhantomJS 2.1 - ESLint | tests: helpers/start-app.js')
.to.contain('ok 11 PhantomJS 2.1 - ESLint | tests: test-helper.js');
.to.contain(`ok 7 ${browser} - ESLint | tests: helpers/destroy-app.js`)
.to.contain(`ok 8 ${browser} - ESLint | tests: helpers/module-for-acceptance.js`)
.to.contain(`ok 9 ${browser} - ESLint | tests: helpers/resolver.js`)
.to.contain(`ok 10 ${browser} - ESLint | tests: helpers/start-app.js`)
.to.contain(`ok 11 ${browser} - ESLint | tests: test-helper.js`);
})
});
});

function emberTest() {
return new Promise(function(resolve) {
exec('node_modules/.bin/ember test', { cwd: __dirname + '/..', env: process.env }, function (error, stdout, stderr) {
exec('node_modules/.bin/ember test', { cwd: path.join(__dirname, '..'), env: process.env }, function (error, stdout, stderr) {
resolve({
error: error,
stdout: stdout,
Expand Down
18 changes: 15 additions & 3 deletions testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ module.exports = {
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
"Chrome"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
],
browser_args: {
Chrome: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
};