Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit ea8d66e

Browse files
committed
Add type-checking test
This makes sure that files generated by the blueprints type-check correctly. As all tests use fixture files to test that the blueprints generate the correct output, we can just add a linting test that type-checks the existing static fixtures files, instead of running the blueprints and type-checking the output afterwards. To make imports not cause type errors, the appropriate typing packages have been added to `devDependencies`, and `types/index.d.ts` declares all in-app modules used in the test fixtures.
1 parent c918a2d commit ea8d66e

File tree

5 files changed

+377
-10
lines changed

5 files changed

+377
-10
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cache: yarn
1515

1616
script:
1717
- yarn lint:js
18+
- yarn lint:blueprints
1819
- yarn test
1920

2021
# We build PRs, but don't trigger separate builds for the PR from the branch.

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"scripts": {
1616
"build": "ember build",
1717
"lint:js": "eslint .",
18+
"lint:blueprints": "tsc -noEmit",
1819
"start": "ember serve",
1920
"test": "mocha --recursive node-tests"
2021
},
@@ -37,6 +38,15 @@
3738
},
3839
"devDependencies": {
3940
"@typed-ember/renovate-config": "1.2.1",
41+
"@types/chai": "^4.1.7",
42+
"@types/ember": "^3.0.29",
43+
"@types/ember-mocha": "^0.14.6",
44+
"@types/ember-qunit": "^3.4.6",
45+
"@types/ember-test-helpers": "^1.0.5",
46+
"@types/ember-testing-helpers": "^0.0.3",
47+
"@types/ember__test-helpers": "^0.7.8",
48+
"@types/mocha": "^5.2.6",
49+
"@types/qunit": "^2.5.4",
4050
"broccoli-asset-rev": "3.0.0",
4151
"ember-ajax": "5.0.0",
4252
"ember-cli": "github:ember-cli/ember-cli#f724919b2d0455899411908531c9179240f5ef41",
@@ -63,7 +73,8 @@
6373
"loader.js": "4.7.0",
6474
"mocha": "6.0.2",
6575
"qunit-dom": "0.8.4",
66-
"testdouble": "3.11.0"
76+
"testdouble": "3.11.0",
77+
"typescript": "^3.3.3333"
6778
},
6879
"engines": {
6980
"node": "6.* || 8.* || >= 10.*"

tsconfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2017",
4+
"allowJs": true,
5+
"moduleResolution": "node",
6+
"allowSyntheticDefaultImports": true,
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"alwaysStrict": true,
10+
"strictNullChecks": true,
11+
"strictPropertyInitialization": true,
12+
"noFallthroughCasesInSwitch": true,
13+
"noUnusedLocals": true,
14+
"noUnusedParameters": true,
15+
"noImplicitReturns": true,
16+
"noEmitOnError": false,
17+
"noEmit": true,
18+
"inlineSourceMap": true,
19+
"inlineSources": true,
20+
"baseUrl": ".",
21+
"module": "es6",
22+
"skipLibCheck": true,
23+
"paths": {
24+
"*": [
25+
"types/*"
26+
]
27+
}
28+
},
29+
"include": [
30+
"node-tests/fixtures/**/*",
31+
"types/**/*"
32+
]
33+
}

types/index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare module "dummy/utils/foo-bar";
2+
declare module "dummy/utils/foo/bar-baz";
3+
declare module "dummy/initializers/foo";
4+
declare module "dummy/instance-initializers/foo";
5+
declare module "my-addon/helpers/foo/bar-baz";
6+
declare module "my-addon/mixins/foo";
7+
declare module "my-app/helpers/foo/bar-baz";
8+
declare module "my-app/initializers/foo";
9+
declare module "my-app/init/initializers/foo";
10+
declare module "my-app/instance-initializers/foo";
11+
declare module "my-app/init/instance-initializers/foo";
12+
declare module "my-app/mixins/foo";
13+
declare module "my-app/tests/helpers/module-for-acceptance";
14+
declare module "my-app/tests/helpers/start-app";
15+
declare module "my-app/utils/foo-bar";
16+
declare module "my-app/utils/foo/bar-baz";

0 commit comments

Comments
 (0)