Skip to content

Commit

Permalink
use ember try to test actual ember version
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Jul 14, 2017
1 parent 695a33a commit 4c85d6d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 39 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@ before_install:

install:
- npm install

script:
# Usually, it's ok to finish the test scenario without reverting
# to the addon's original dependency state, skipping "cleanup".
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup
- npm run mocha
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each",
"premocha": "eslint test",
"mocha": "cross-env DEBUG=ember-cli-addon-tests mocha"
"pretest": "eslint test",
"test": "cross-env DEBUG=ember-cli-addon-tests mocha"
},
"dependencies": {
"ember-cli-babel": "^6.3.0"
},
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"chai": "^4.1.0",
"cpr": "^2.2.0",
"cross-env": "^5.0.1",
"denodeify": "^1.2.1",
"ember-ajax": "^3.0.0",
"ember-cli": "2.13.3",
"ember-cli-addon-tests": "^0.7.0",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-eslint": "^3.0.0",
"ember-cli-fastboot": "1.0.0-rc.5",
"ember-cli-htmlbars": "^1.1.1",
"ember-cli-htmlbars-inline-precompile": "^0.4.0",
"ember-cli-inject-live-reload": "^1.4.1",
Expand All @@ -50,8 +48,7 @@
"ember-source": "~2.13.3",
"eslint": "^4.2.0",
"loader.js": "^4.2.3",
"mocha": "^3.4.2",
"request": "^2.81.0"
"mocha": "^3.4.2"
},
"peerDependencies": {
"ember-metrics": "*"
Expand Down
3 changes: 2 additions & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
},
env: {
node: true,
mocha: true
mocha: true,
es6: true
}
};
40 changes: 17 additions & 23 deletions test/application-test.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
'use strict';

const expect = require('chai').expect;
const path = require('path');
const denodeify = require('denodeify');
const request = denodeify(require('request'));
const cpr = denodeify(require('cpr'));
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

describe('Acceptance | Application', function() {
this.timeout(900000);

let app;

before(function() {
app = new AddonTestApp();
it('works', function() {
let app = new AddonTestApp();

return app.create('dummy', {
fixturesPath: 'tests'
}).then(() => {
return Promise.all([
'config/ember-try.js',
'tests'
].map(p => cpr(p, path.join(app.path, p), {
overwrite: true,
filter(p) {
return !p.startsWith(path.normalize('tests/dummy'));
}
})));
}).then(() => {
return app.runEmberCommand(
'install',
`ember-cli-fastboot@${process.env.npm_package_devDependencies_ember_cli_fastboot}`
'try:one',
process.env.EMBER_TRY_SCENARIO,
'--skip-cleanup'
);
}).then(() => {
return app.startServer();
});
});

afterEach(function() {
return app.stopServer();
});

it('works', function() {
return request({
url: 'http://localhost:49741/foo/bar',
headers: { 'Accept': 'text/html' }
}).then(response => {
expect(response.body).to.contain('foo/bar foo.bar');
});
});
});
2 changes: 1 addition & 1 deletion tests/acceptance/application-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ test('visiting foo/bar', function(assert) {
visit('foo/bar');

andThen(function() {
assert.equal(find('*').text(), 'foo/bar foo.bar');
assert.equal(find('#foo-bar').text().trim(), 'foo/bar foo.bar');
});
});
4 changes: 3 additions & 1 deletion tests/dummy/app/templates/foo/bar.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{metrics.page}} {{metrics.title}}
<div id="foo-bar">
{{metrics.page}} {{metrics.title}}
</div>

0 comments on commit 4c85d6d

Please sign in to comment.