Skip to content

Commit 25e4ebb

Browse files
committed
Setup CI for type-checking all test apps
1 parent c54a693 commit 25e4ebb

File tree

18 files changed

+230
-1022
lines changed

18 files changed

+230
-1022
lines changed

.github/workflows/ci-build.yml

+36
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,42 @@ jobs:
3434
- run: pnpm test:ember
3535
working-directory: test-apps/base-tests
3636

37+
typecheck:
38+
name: '${{ matrix.typescript-scenario }}'
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
continue-on-error: true
42+
strategy:
43+
fail-fast: true
44+
matrix:
45+
typescript-scenario:
46+
- typescript@5.0
47+
- typescript@5.1
48+
- typescript@5.2
49+
- typescript@5.3
50+
- typescript@5.4
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: wyvox/action-setup-pnpm@v3
55+
- run: pnpm prepack
56+
working-directory: ./addon/
57+
58+
- name: 'Change base tests TS to ${{ matrix.typescript-scenario }}'
59+
run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}'
60+
working-directory: ./test-apps/base-tests/
61+
62+
- name: 'Change ember-concurrency TS to ${{ matrix.typescript-scenario }}'
63+
run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}'
64+
working-directory: ./test-apps/ember-concurrency-v2
65+
66+
- name: 'Change ember-fetch TS to ${{ matrix.typescript-scenario }}'
67+
run: 'pnpm add --save-dev ${{ matrix.typescript-scenario}}'
68+
working-directory: ./test-apps/ember-fetch-v8
69+
70+
- run: pnpm --filter "./test-apps/*" exec tsc --noEmit;
71+
72+
3773
try-scenarios:
3874
timeout-minutes: 10
3975
name: "Try: ${{ matrix.ember-try-scenario }} @ ${{ matrix.app }}"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ package.json.ember-try
2626
addon/addon/**/*.js
2727

2828
*.d.ts
29+
!test-apps/**/*.d.ts
2930
!addon/types/**/*.d.ts
3031
*.tgz

addon/addon/build-waiter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TestWaiterImpl<T extends object | Primitive = Token> implements TestWaiter
3535
this._register();
3636

3737
if (this.items.has(token)) {
38-
throw new Error(`beginAsync called for ${token} but it is already pending.`);
38+
throw new Error(`beginAsync called for ${token as string} but it is already pending.`);
3939
}
4040

4141
let error = new Error();
@@ -112,7 +112,7 @@ class NoopTestWaiter implements TestWaiter {
112112
return this;
113113
}
114114

115-
endAsync(): void {}
115+
endAsync(): void { }
116116

117117
waitUntil(): boolean {
118118
return true;
@@ -122,7 +122,7 @@ class NoopTestWaiter implements TestWaiter {
122122
return [];
123123
}
124124

125-
reset(): void {}
125+
reset(): void { }
126126
}
127127

128128
/**

addon/addon/waiter-manager.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type Indexable = Record<any, unknown>;
88
// this ensures that if @ember/test-waiters exists in multiple places in the
99
// build output we will still use a single map of waiters (there really should
1010
// only be one of them, or else `settled` will not work at all)
11-
const WAITERS: Map<WaiterName, Waiter> = (function () {
11+
const WAITERS: Map<WaiterName, Waiter> = (function() {
1212
const HAS_SYMBOL = typeof Symbol !== 'undefined';
1313

1414
let symbolName = 'TEST_WAITERS';
@@ -33,6 +33,7 @@ function getGlobal(): Indexable {
3333
if (typeof globalThis !== 'undefined') return indexable(globalThis);
3434
if (typeof self !== 'undefined') return indexable(self);
3535
if (typeof window !== 'undefined') return indexable(window);
36+
// @ts-expect-error cannot find name 'global' -- for old compatibility
3637
if (typeof global !== 'undefined') return indexable(global);
3738

3839
throw new Error('unable to locate global object');

addon/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
"@babel/preset-typescript": "^7.15.0",
4343
"@ember/optional-features": "^2.0.0",
4444
"@ember/string": "^3.0.1",
45-
"@types/ember": "^3.16.5",
46-
"@types/ember-test-helpers": "^1.0.10",
47-
"@types/ember-testing-helpers": "^0.0.4",
48-
"@types/ember__test-helpers": "^2.6.1",
4945
"@types/qunit": "^2.19.9",
5046
"@types/rsvp": "^4.0.4",
5147
"@typescript-eslint/eslint-plugin": "^4.29.2",
@@ -64,7 +60,7 @@
6460
"ember-load-initializers": "^2.1.2",
6561
"ember-maybe-import-regenerator-for-testing": "^1.0.0",
6662
"ember-resolver": "^8.0.2",
67-
"ember-source": "~3.26.1",
63+
"ember-source": "^5.0.0",
6864
"ember-source-channel-url": "^3.0.0",
6965
"ember-try": "^3.0.0",
7066
"eslint": "^7.32.0",

addon/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"allowJs": true,
55
"moduleResolution": "node",
66
"allowSyntheticDefaultImports": true,
7+
// have to use this, because the current TS setup errors with ember's own types
8+
// this will be fixed during v2 addon conversion
9+
"skipLibCheck": true,
710
"noImplicitAny": true,
811
"noImplicitThis": true,
912
"alwaysStrict": true,

addon/types/global.d.ts

-6
This file was deleted.

addon/types/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import 'ember-source/types';
2+
3+

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
"concurrently": "^8.2.1",
1818
"release-plan": "^0.8.0"
1919
},
20+
"pnpm": {
21+
"overrides_notes": {
22+
"@glimmer/*": "https://github.com/glimmerjs/glimmer.js/issues/413"
23+
},
24+
"overrides": {
25+
"@glimmer/validator": ">= 0.84.3",
26+
"@glimmer/manager": ">= 0.84.3"
27+
}
28+
},
2029
"volta": {
2130
"node": "18.16.0",
2231
"pnpm": "8.7.6"

0 commit comments

Comments
 (0)