This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Turbo87/tests
Add test suite
- Loading branch information
Showing
14 changed files
with
113 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,6 @@ | |
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
"esversion": 6, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,22 @@ | ||
--- | ||
sudo: false | ||
|
||
language: node_js | ||
node_js: | ||
- "0.10" | ||
- "0.12" | ||
|
||
sudo: false | ||
- "4" | ||
- "6" | ||
- "stable" | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
env: | ||
- EMBER_TRY_SCENARIO=default | ||
- EMBER_TRY_SCENARIO=old-test-loader | ||
- EMBER_TRY_SCENARIO=ember-release | ||
- EMBER_TRY_SCENARIO=ember-beta | ||
- EMBER_TRY_SCENARIO=ember-canary | ||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- env: EMBER_TRY_SCENARIO=ember-canary | ||
- $HOME/.npm | ||
- $HOME/.cache # includes bowers cache | ||
|
||
before_install: | ||
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH | ||
- "npm config set spin false" | ||
- "npm install -g npm@^2" | ||
- npm config set spin false | ||
- npm install -g bower phantomjs-prebuilt | ||
|
||
install: | ||
- npm install -g bower | ||
- npm install | ||
- bower install | ||
|
||
script: | ||
- ember try:one $EMBER_TRY_SCENARIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
{ | ||
"name": "ember-cli-qunit", | ||
"name": "ember-cli-jshint", | ||
"dependencies": { | ||
"ember": "~2.4.1", | ||
"ember-cli-shims": "0.1.0", | ||
"ember-cli-test-loader": "0.2.2", | ||
"ember": "~2.7.0", | ||
"ember-cli-shims": "0.1.1", | ||
"ember-qunit-notifications": "0.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
var fs = require('fs-extra'); | ||
var exec = require('child_process').exec; | ||
var Promise = require('es6-promise').Promise; | ||
|
||
var expect = require('chai').expect; | ||
|
||
var FAILING_FILE = __dirname + '/tests/dummy/app/unused.js'; | ||
|
||
describe('ember-cli-jshint', function() { | ||
this.timeout(60000); | ||
|
||
afterEach(function() { | ||
fs.removeSync(FAILING_FILE); | ||
}); | ||
|
||
it('passes if JSHint tests pass', 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 - JSHint | app.js: should pass jshint') | ||
.to.contain('ok 2 PhantomJS 2.1 - JSHint | helpers/destroy-app.js: should pass jshint') | ||
.to.contain('ok 3 PhantomJS 2.1 - JSHint | helpers/module-for-acceptance.js: should pass jshint') | ||
.to.contain('ok 4 PhantomJS 2.1 - JSHint | helpers/resolver.js: should pass jshint') | ||
.to.contain('ok 5 PhantomJS 2.1 - JSHint | helpers/start-app.js: should pass jshint') | ||
.to.contain('ok 6 PhantomJS 2.1 - JSHint | resolver.js: should pass jshint') | ||
.to.contain('ok 7 PhantomJS 2.1 - JSHint | router.js: should pass jshint') | ||
.to.contain('ok 8 PhantomJS 2.1 - JSHint | test-helper.js: should pass jshint') | ||
.to.not.contain('not ok 9 PhantomJS 2.1 - JSHint | unused.js: should pass jshint'); | ||
}) | ||
}); | ||
|
||
it('fails if a JSHint tests fails', function() { | ||
fs.outputFileSync(FAILING_FILE, 'let unused = 6;\n'); | ||
|
||
return emberTest().then(function(result) { | ||
expect(result.error).to.exist; | ||
expect(result.stdout.match(/[^\r\n]+/g)) | ||
.to.contain('ok 1 PhantomJS 2.1 - JSHint | app.js: should pass jshint') | ||
.to.contain('ok 2 PhantomJS 2.1 - JSHint | helpers/destroy-app.js: should pass jshint') | ||
.to.contain('ok 3 PhantomJS 2.1 - JSHint | helpers/module-for-acceptance.js: should pass jshint') | ||
.to.contain('ok 4 PhantomJS 2.1 - JSHint | helpers/resolver.js: should pass jshint') | ||
.to.contain('ok 5 PhantomJS 2.1 - JSHint | helpers/start-app.js: should pass jshint') | ||
.to.contain('ok 6 PhantomJS 2.1 - JSHint | resolver.js: should pass jshint') | ||
.to.contain('ok 7 PhantomJS 2.1 - JSHint | router.js: should pass jshint') | ||
.to.contain('ok 8 PhantomJS 2.1 - JSHint | test-helper.js: should pass jshint') | ||
.to.contain('not ok 9 PhantomJS 2.1 - JSHint | unused.js: should pass jshint'); | ||
}) | ||
}); | ||
}); | ||
|
||
function emberTest() { | ||
return new Promise(function(resolve) { | ||
exec('node_modules/.bin/ember test', { cwd: __dirname }, function (error, stdout, stderr) { | ||
resolve({ | ||
error: error, | ||
stdout: stdout, | ||
stderr: stderr, | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,6 @@ | |
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
"esversion": 6, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { module } from 'qunit'; | ||
import Ember from 'ember'; | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
|
||
const { RSVP: { Promise } } = Ember; | ||
|
||
export default function(name, options = {}) { | ||
module(name, { | ||
beforeEach() { | ||
this.application = startApp(); | ||
|
||
if (options.beforeEach) { | ||
options.beforeEach.apply(this, arguments); | ||
return options.beforeEach.apply(this, arguments); | ||
} | ||
}, | ||
|
||
afterEach() { | ||
if (options.afterEach) { | ||
options.afterEach.apply(this, arguments); | ||
} | ||
|
||
destroyApp(this.application); | ||
let afterEach = options.afterEach && options.afterEach.apply(this, arguments); | ||
return Promise.resolve(afterEach).then(() => destroyApp(this.application)); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.