Skip to content

Commit d9d96e9

Browse files
Improve Integration Tests (#39)
* add ember-truth-helpers and use one of the helpers from the addon in the application template * add newline * pipe veerything out for debugging * use typescript in integration testing * add listr * improve error messaging * do I even want listr? is so nice tho * why is killing a process so hard in node. ugh * correct the output template * #33 confirmed resolved * fix linting * Update package.json Co-Authored-By: Robert Jackson <[email protected]> * Remove listr * upgrade packages
1 parent 82a4942 commit d9d96e9

17 files changed

Lines changed: 433 additions & 127 deletions

File tree

.eslintrc.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@ module.exports = {
1313
"prettier/prettier": "error"
1414
},
1515
overrides: [
16+
{
17+
files: ['**/*.ts'],
18+
parser: '@typescript-eslint/parser',
19+
plugins: ['prettier', '@typescript-eslint'],
20+
extends: [
21+
'eslint:recommended',
22+
'plugin:@typescript-eslint/recommended',
23+
'prettier',
24+
'prettier/@typescript-eslint',
25+
],
26+
},
1627
{
1728
files: ['**/*.test.js'],
1829
env: {
1930
jest: true
2031
}
2132
}
2233
]
23-
};
34+
};

package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"release": "release-it",
1717
"test": "codemod-cli test",
18-
"test:integration": "node ./test/run-test.js",
18+
"test:integration": "ts-node ./test/run-test.ts",
1919
"update-docs": "codemod-cli update-docs",
2020
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
2121
"lint:js": "eslint .",
@@ -32,8 +32,8 @@
3232
],
3333
"dependencies": {
3434
"codemod-cli": "^2.1.0",
35-
"ember-codemods-telemetry-helpers": "^1.0.0",
36-
"ember-template-recast": "^3.2.0",
35+
"ember-codemods-telemetry-helpers": "^1.0.1",
36+
"ember-template-recast": "^3.2.8",
3737
"fs-extra": "^8.1.0",
3838
"git-repo-info": "^2.1.0",
3939
"minimatch": "^3.0.4",
@@ -43,7 +43,14 @@
4343
"winston": "^3.2.1"
4444
},
4545
"devDependencies": {
46+
"@types/chalk": "^2.2.0",
47+
"@types/common-tags": "^1.8.0",
48+
"@types/listr": "^0.14.2",
49+
"@typescript-eslint/eslint-plugin": "^2.5.0",
50+
"@typescript-eslint/parser": "^2.5.0",
4651
"babel-plugin-htmlbars-inline-precompile": "^3.0.0",
52+
"chalk": "^2.4.2",
53+
"common-tags": "^1.8.0",
4754
"coveralls": "^3.0.6",
4855
"eslint": "^6.5.1",
4956
"eslint-config-prettier": "^6.3.0",
@@ -52,7 +59,9 @@
5259
"jest": "^24.9.0",
5360
"prettier": "^1.18.2",
5461
"release-it": "^12.4.2",
55-
"release-it-lerna-changelog": "^1.0.3"
62+
"release-it-lerna-changelog": "^1.0.3",
63+
"ts-node": "^8.4.1",
64+
"typescript": "~3.6.4"
5665
},
5766
"engines": {
5867
"node": "8.* || 10.* || >= 12"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Controller from '@ember/controller';
2+
3+
export default Controller.extend({
4+
foo: 'foo',
5+
});
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
{{!-- The following component displays Ember's default welcome message. --}}
2-
<WelcomePage />
3-
{{!-- Feel free to remove this! --}}
1+
{{not false}}
2+
3+
{{#if (not foo)}}
4+
{{foo}}
5+
{{/if}}
46

57
{{outlet}}

test/fixtures/3.13/input/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"ember-qunit": "^4.4.1",
4141
"ember-resolver": "^5.0.1",
4242
"ember-source": "~3.13.3",
43+
"ember-truth-helpers": "^2.1.0",
4344
"ember-welcome-page": "^4.0.0",
4445
"eslint-plugin-ember": "^7.1.0",
4546
"eslint-plugin-node": "^10.0.0",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { module, test } from 'qunit';
2+
import { setupTest } from 'ember-qunit';
3+
4+
module('Unit | Controller | application', function(hooks) {
5+
setupTest(hooks);
6+
7+
// Replace this with your real tests.
8+
test('it exists', function(assert) {
9+
let controller = this.owner.lookup('controller:application');
10+
assert.ok(controller);
11+
});
12+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Controller from '@ember/controller';
2+
3+
export default Controller.extend({
4+
foo: 'foo',
5+
});
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
{{!-- The following component displays Ember's default welcome message. --}}
2-
<WelcomePage />
3-
{{!-- Feel free to remove this! --}}
1+
{{not false}}
2+
3+
{{#if (not this.foo)}}
4+
{{this.foo}}
5+
{{/if}}
46

57
{{outlet}}

test/fixtures/3.13/output/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"ember-qunit": "^4.4.1",
4141
"ember-resolver": "^5.0.1",
4242
"ember-source": "~3.13.3",
43+
"ember-truth-helpers": "^2.1.0",
4344
"ember-welcome-page": "^4.0.0",
4445
"eslint-plugin-ember": "^7.1.0",
4546
"eslint-plugin-node": "^10.0.0",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { module, test } from 'qunit';
2+
import { setupTest } from 'ember-qunit';
3+
4+
module('Unit | Controller | application', function(hooks) {
5+
setupTest(hooks);
6+
7+
// Replace this with your real tests.
8+
test('it exists', function(assert) {
9+
let controller = this.owner.lookup('controller:application');
10+
assert.ok(controller);
11+
});
12+
});

0 commit comments

Comments
 (0)