diff --git a/.travis.yml b/.travis.yml index 12350417..325db146 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 install: - yarn install --ignore-engines --no-lockfile --non-interactive diff --git a/node-tests/test.js b/node-tests/test.js index 49bdc5a2..a7cd3334 100644 --- a/node-tests/test.js +++ b/node-tests/test.js @@ -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); @@ -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`); }) }); @@ -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`); }) }); @@ -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`); }) }); @@ -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`); }) }); @@ -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, diff --git a/testem.js b/testem.js index b2340483..8d0ef75f 100644 --- a/testem.js +++ b/testem.js @@ -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) + } };