Skip to content

Commit 1a885f4

Browse files
committed
fix(a20): support of Angular 20 #11187
1 parent 7986fd7 commit 1a885f4

File tree

136 files changed

+17561
-386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+17561
-386
lines changed

.circleci/config.yml

+7
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ executors:
7373
docker:
7474
- image: satantime/puppeteer-node:22.14.0
7575
resource_class: medium
76+
a20:
77+
docker:
78+
- image: satantime/puppeteer-node:22.14.0
79+
resource_class: medium
7680

7781
commands:
7882
install:
@@ -627,6 +631,7 @@ workflows:
627631
- a17
628632
- a18
629633
- a19
634+
- a20
630635

631636
# testing a5 (exceptional)
632637
- E2E Test:
@@ -707,6 +712,7 @@ workflows:
707712
- a17
708713
- a18
709714
- a19
715+
- a20
710716

711717
# testing lib build
712718
- Lib Build:
@@ -734,6 +740,7 @@ workflows:
734740
- a17
735741
- a18
736742
- a19
743+
- a20
737744

738745
# testing lib build
739746
- Lib Build:

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/e2e/a17/node_modules
1717
/e2e/a18/node_modules
1818
/e2e/a19/node_modules
19+
/e2e/a20/node_modules
1920
/e2e/jasmine/node_modules
2021
/e2e/jest/node_modules
2122
/e2e/min/node_modules

.eslintrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ settings:
3030
- ./e2e/a17/tsconfig.json
3131
- ./e2e/a18/tsconfig.json
3232
- ./e2e/a19/tsconfig.json
33+
- ./e2e/a20/tsconfig.json
3334
- ./e2e/jasmine/tsconfig.json
3435
- ./e2e/jest/tsconfig.json
3536
- ./e2e/min/tsconfig.json
@@ -63,6 +64,7 @@ overrides:
6364
- ./e2e/a17/tsconfig.json
6465
- ./e2e/a18/tsconfig.json
6566
- ./e2e/a19/tsconfig.json
67+
- ./e2e/a20/tsconfig.json
6668
- ./e2e/jasmine/tsconfig.json
6769
- ./e2e/jest/tsconfig.json
6870
- ./e2e/min/tsconfig.json
@@ -174,6 +176,7 @@ overrides:
174176
- fdescribe
175177
- xit
176178
- xdescribe
179+
no-useless-escape: off
177180
semi:
178181
- error
179182
- always

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ updates:
153153
commit-message:
154154
prefix: 'chore(deps)'
155155

156+
- package-ecosystem: 'npm'
157+
directory: /e2e/a20/
158+
open-pull-requests-limit: 0
159+
schedule:
160+
interval: 'daily'
161+
commit-message:
162+
prefix: 'chore(deps)'
163+
156164
- package-ecosystem: 'npm'
157165
directory: /e2e/jasmine/
158166
open-pull-requests-limit: 0

CONTRIBUTING.md

+72-67
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,21 @@ npm run test:debug
114114
## How to add a new Angular version
115115

116116
First, you need to install the new Angular version somewhere.
117-
Below is an example how to add Angular 20 to `ng-mocks`.
117+
Below is an example how to add Angular 21 to `ng-mocks`.
118118

119119
### Step #1 - create an empty project
120120

121-
Let's create a fresh project with `@angular/cli` `v20`.
122-
The name of the project should be `a + version`: `a20`.
121+
Let's create a fresh project with `@angular/cli` `v21`.
122+
The name of the project should be `a + version`: `a21`.
123123

124124
```shell
125-
npx '@angular/cli@^20' new \
125+
npx '@angular/cli@^21.0.0-alpha' new \
126126
--routing \
127127
--skip-git=true \
128128
--skip-tests=true \
129129
--style=css \
130130
--ssr=false \
131-
a20
131+
a21
132132
```
133133

134134
Basically, the requirements are:
@@ -143,96 +143,101 @@ Basically, the requirements are:
143143

144144
The next step is:
145145

146-
- move `a20` folder to `ng-mocks/e2e` folder
147-
- delete `.vscode` folder in `ng-mocks/e2e/a20`
148-
- delete `.editorconfig` file in `ng-mocks/e2e/a20`
149-
- change `.gitignore` to be the same as in the prev version: `ng-mocks/e2e/a19/.gitignore`
150-
- change `angular.json` to be similar as in the prev version: `ng-mocks/e2e/a19/angular.json`
151-
- `projects/a20/schematics` should be empty
152-
- remove `projects/a20/architect/build/options/assets`
153-
- remove `projects/a20/architect/build/options/styles`
154-
- remove `projects/a20/architect/build/options/scripts`
155-
- change `projects/a20/architect/build/options/tsConfig` to `tsconfig.json`
156-
- remove `projects/a20/architect/build/configurations/production/budgets`
157-
- remove `projects/a20/architect/extract-i18n`
158-
- remove `projects/a20/architect/test/options/assets`
159-
- remove `projects/a20/architect/test/options/styles`
160-
- remove `projects/a20/architect/test/options/scripts`
161-
- change `projects/a20/architect/test/options/tsConfig` to `tsconfig.json`
162-
- add `projects/a20/architect/test/options/main` with the value of `src/test.ts`
163-
- add `projects/a20/architect/test/options/karmaConfig` with the value of `karma.conf.js`
164-
- add `projects/lib` as it is in the prev version: `ng-mocks/e2e/a19/angular.json`
165-
- change `package.json` to be similar as in the prev version: `ng-mocks/e2e/a19/package.json`
166-
- `name` should be `a20`
167-
- `description` should be `Angular 20`
146+
- move `a21` folder to `ng-mocks/e2e` folder
147+
- delete `.vscode` folder in `ng-mocks/e2e/a21`
148+
- delete `.editorconfig` file in `ng-mocks/e2e/a21`
149+
- change `.gitignore` to be the same as in the prev version: `ng-mocks/e2e/a20/.gitignore`
150+
- change `angular.json` to be similar as in the prev version: `ng-mocks/e2e/a20/angular.json`
151+
- `projects/a21/schematics` should be empty
152+
- remove `projects/a21/architect/build/options/assets`
153+
- remove `projects/a21/architect/build/options/styles`
154+
- remove `projects/a21/architect/build/options/scripts`
155+
- change `projects/a21/architect/build/options/tsConfig` to `tsconfig.json`
156+
- remove `projects/a21/architect/build/configurations/production/budgets`
157+
- remove `projects/a21/architect/extract-i18n`
158+
- remove `projects/a21/architect/test/options/assets`
159+
- remove `projects/a21/architect/test/options/styles`
160+
- remove `projects/a21/architect/test/options/scripts`
161+
- change `projects/a21/architect/test/options/tsConfig` to `tsconfig.json`
162+
- add `projects/a21/architect/test/options/main` with the value of `src/test.ts`
163+
- add `projects/a21/architect/test/options/karmaConfig` with the value of `karma.conf.js`
164+
- add `projects/lib` as it is in the prev version: `ng-mocks/e2e/a20/angular.json`
165+
- add `cli/analytics` as it is in the prev version: `ng-mocks/e2e/a20/angular.json`
166+
- change `package.json` to be similar as in the prev version: `ng-mocks/e2e/a20/package.json`
167+
- `name` should be `a21`
168+
- `description` should be `Angular 21`
168169
- `private` should be `true`
169-
- replace `scripts` as it is in the prev version: `ng-mocks/e2e/a19/package.json`
170-
- remove flexible versions (`^~`) in `dependencies` as it is in the prev version: `ng-mocks/e2e/a19/package.json`
171-
- remove flexible versions (`^~`) in `devDependencies` as it is in the prev version: `ng-mocks/e2e/a19/package.json`
170+
- replace `scripts` as it is in the prev version: `ng-mocks/e2e/a20/package.json`
171+
- remove flexible versions (`^~`) in `dependencies` as it is in the prev version: `ng-mocks/e2e/a20/package.json`
172+
- remove flexible versions (`^~`) in `devDependencies` as it is in the prev version: `ng-mocks/e2e/a20/package.json`
173+
- in `dependencies`, add `@angular/animations` which supports the desired angular version
172174
- in `devDependencies`, add `@types/jest`, `jest`, `jest-preset-angular`, `ng-packagr`, `puppeteer`, `ts-node` which support the desired angular version
173175
- add `engines` with the correct `npm` which supports the desired angular version
174176
- delete `README.md`
175-
- merge `tsconfig.app.json` and `tsconfig.spec.json` into `tsconfig.json` as it is in the prev version: `ng-mocks/e2e/a19/tsconfig.json`
177+
- merge `tsconfig.app.json` and `tsconfig.spec.json` into `tsconfig.json` as it is in the prev version: `ng-mocks/e2e/a20/tsconfig.json`
176178
- add `compilerOptions/baseUrl`with the value of `./`
177-
- add `compilerOptions/types` as it is in the prev version: `ng-mocks/e2e/a19/tsconfig.json`
178-
- add `compilerOptions/skipLibCheck` as it is in the prev version: `ng-mocks/e2e/a19/tsconfig.json`
179+
- add `compilerOptions/types` as it is in the prev version: `ng-mocks/e2e/a20/tsconfig.json`
180+
- add `compilerOptions/skipLibCheck` as it is in the prev version: `ng-mocks/e2e/a20/tsconfig.json`
179181
- change `compilerOptions/noImplicitOverride` to `false`
180-
- add `files` as it is in the prev version: `ng-mocks/e2e/a19/tsconfig.json`
181-
- add `include` as it is in the prev version: `ng-mocks/e2e/a19/tsconfig.json`
182+
- add `files` as it is in the prev version: `ng-mocks/e2e/a20/tsconfig.json`
183+
- add `include` as it is in the prev version: `ng-mocks/e2e/a20/tsconfig.json`
182184
- delete `tsconfig.app.json`
183185
- delete `tsconfig.spec.json`
184186
- add `.nvmrc` which supports the desired angular version
185-
- add `jest.config.ts` as it is in the prev version: `ng-mocks/e2e/a19/jest.config.ts`
186-
- add `karma.conf.js` as it is in the prev version: `ng-mocks/e2e/a19/karma.conf.js`
187-
- add `ng-package.json` as it is in the prev version: `ng-mocks/e2e/a19/ng-package.json`
188-
- delete `ng-mocks/e2e/a20/public`
189-
- delete `ng-mocks/e2e/a20/src/app`
190-
- delete `ng-mocks/e2e/a20/src/style.css`
191-
- remove `<link rel="icon">` from `ng-mocks/e2e/a20/src/index.html`
192-
- change `ng-mocks/e2e/a20/src/main.ts` as it is in the prev version: `ng-mocks/e2e/a19/src/main.ts`
193-
- add `ng-mocks/e2e/a20/src/test.ts` as it is in the prev version: `ng-mocks/e2e/a19/src/test.ts`
194-
- add `ng-mocks/e2e/a20/src/setup-jest.ts` as it is in the prev version: `ng-mocks/e2e/a19/src/setup-jest.ts`
187+
- add `jest.config.ts` as it is in the prev version: `ng-mocks/e2e/a20/jest.config.ts`
188+
- add `karma.conf.js` as it is in the prev version: `ng-mocks/e2e/a20/karma.conf.js`
189+
- add `ng-package.json` as it is in the prev version: `ng-mocks/e2e/a20/ng-package.json`
190+
- delete `ng-mocks/e2e/a21/public`
191+
- delete `ng-mocks/e2e/a21/src/app`
192+
- delete `ng-mocks/e2e/a21/src/style.css`
193+
- remove `<link rel="icon">` from `ng-mocks/e2e/a21/src/index.html`
194+
- change `ng-mocks/e2e/a21/src/main.ts` as it is in the prev version: `ng-mocks/e2e/a20/src/main.ts`
195+
- add `ng-mocks/e2e/a21/src/test.ts` as it is in the prev version: `ng-mocks/e2e/a20/src/test.ts`
196+
- add `ng-mocks/e2e/a21/src/setup-jest.ts` as it is in the prev version: `ng-mocks/e2e/a20/src/setup-jest.ts`
195197

196198
### Step #3 - update scripts
197199

198-
- update `ng-mocks/package.json`, search for `a19` and extended scripts to support `a20`
199-
- update `ng-mocks/compose.yml`, search for `a19` and copy blocks to support `a20` with the right node version
200-
- update `ng-mocks/compose.sh`, search for `a19` and copy blocks to support `a20` with the right command to install `puppeteer`
201-
- update `ng-mocks/.dockerignore`, search for `a19` and copy blocks to support `a20`
202-
- update `ng-mocks/.github/dependabot.yml`, search for `a19` and copy blocks to support `a20`
203-
- update `ng-mocks/.circleci/config.yml`, search for `a19` and copy blocks to support `a20`
204-
- update `ng-mocks/.eslintrc.yml`, search for `a19` and copy blocks to support `a20`
205-
- execute `sh compose.sh a20` in `ng-mocks` to install dependencies for `a20`, it might require `--force` at this moment in `compose.yml` in the command for the new version
200+
- update `ng-mocks/package.json`, search for `a20` and extended scripts to support `a21`
201+
- update `ng-mocks/compose.yml`, search for `a20` and copy blocks to support `a21` with the right node version
202+
- update `ng-mocks/compose.sh`, search for `a20` and copy blocks to support `a21` with the right command to install `puppeteer`
203+
- update `ng-mocks/test.sh`, search for `a20` and copy blocks to support `a21`
204+
- update `ng-mocks/.dockerignore`, search for `a20` and copy blocks to support `a21`
205+
- update `ng-mocks/.github/dependabot.yml`, search for `a20` and copy blocks to support `a21`
206+
- update `ng-mocks/.circleci/config.yml`, search for `a20` and copy blocks to support `a21`
207+
- update `ng-mocks/.eslintrc.yml`, search for `a20` and copy blocks to support `a21`
208+
- execute `sh compose.sh a21` in `ng-mocks` to install dependencies for `a21`, it might require `--force` at this moment in `compose.yml` in the command for the new version
206209

207210
### Step #4 - update ng-mocks dependencies
208211

209-
- update `ng-mocks/package.json` to point to the new angular version in dependencies
212+
- update `ng-mocks/package.json` to point to the version `^21` in dependencies
210213
- execute `sh compose.sh root` in `ng-mocks` to install the dependencies
211214

212215
### Step #5 - verify that`ng-mocks` does not fail with the new version
213216

214-
- execute `nvm install` in `ng-mocks`
215-
- execute `nvm use`
216-
- execute `npm run build`
217-
- execute `npm run clean:a20`
218-
- execute `npm run s:a20`
219-
- execute `npm run s:app:a20`
220-
- execute `npm run s:test:a20`
221-
- execute `npm run test:a20`
217+
- execute `sh test.sh root` in `ng-mocks` to ensure nothing fails
218+
- execute `sh test.sh a21` in `ng-mocks` to ensure nothing fails
222219
- tests should pass successfully without failures
223220

221+
if tests are failing
222+
223+
- execute `cd e2e/a21` in `ng-mocks`
224+
- execute `nvm install`
225+
- execute `nvm nvm use`
226+
- execute `npm run test:debug`
227+
224228
### Step #6 - update version references
225229

226230
- update the version table in `ng-mocks/docs/articles/index.md`
227231
- update the migration guide in `docs/articles/migrations.md`
228232
- update the version table in `ng-mocks/README.md`
229233
- update `description` in `libs/ng-mocks/package.json`
230234
- update `peerDependencies` in `libs/ng-mocks/package.json`
231-
- update this file and replace `a20` with `a21`
232-
- update this file and replace `v20` with `v21`
233-
- update this file and replace `^20` with `^21`
234-
- update this file and replace `Angular 20` with `Angular 21`
235-
- update this file and replace `a19` with `a20`
235+
- update this file and replace `a21` with `a22`
236+
- update this file and replace `v21` with `v22`
237+
- update this file and replace `^21` with `^22`
238+
- update this file and replace `Angular 21` with `Angular 22`
239+
- update this file and replace `a20` with `a` + `21`
240+
- fix the previous expression manually
236241

237242
### Step #7 - verify
238243

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The current version of the library **has been tested** and **can be used** with:
1515

1616
| angular | ng-mocks | jasmine | jest | ivy | standalone | signals | defer |
1717
| ------: | :------: | :-----: | :--: | :-: | :--------: | :-----: | :---: |
18+
| 20 | latest | yes | yes | yes | yes | no | no |
1819
| 19 | latest | yes | yes | yes | yes | no | no |
1920
| 18 | latest | yes | yes | yes | yes | no | no |
2021
| 17 | latest | yes | yes | yes | yes | no | no |

compose.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
echo "Starting"
5-
64
export NVM_DIR="$HOME/.nvm" && \. "$NVM_DIR/nvm.sh"
75

86
if [ "$1" = "" ] || [ "$1" = "root" ]; then
@@ -197,6 +195,16 @@ if [ "$1" = "" ] || [ "$1" = "a19" ]; then
197195
cd ../..
198196
fi
199197

198+
if [ "$1" = "" ] || [ "$1" = "a20" ]; then
199+
docker compose up --build -- a20 && \
200+
docker compose run --rm a20 node ./node_modules/puppeteer/install.mjs && \
201+
cd ./e2e/a20 && \
202+
nvm install && \
203+
nvm use && \
204+
node ./node_modules/puppeteer/install.mjs && \
205+
cd ../..
206+
fi
207+
200208
if [ "$1" = "" ] || [ "$1" = "jasmine" ]; then
201209
docker compose up --build -- jasmine && \
202210
docker compose run --rm jasmine node ./node_modules/puppeteer/install.mjs && \

compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,19 @@ services:
256256
- install
257257
- --no-audit
258258

259+
a20:
260+
image: satantime/puppeteer-node:22.14.0
261+
working_dir: /app
262+
volumes:
263+
- ./e2e/a20:/app
264+
- cache:/root/.cache
265+
- gyp:/root/.node-gyp
266+
- npm:/root/.npm
267+
command:
268+
- npm
269+
- install
270+
- --no-audit
271+
259272
jasmine:
260273
image: satantime/puppeteer-node:20.18.3
261274
working_dir: /app

docs/articles/extra/install.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ The file doesn't exist, because `@angular-builders/jest` provides default config
106106
To restore `src/setup-jest.ts` you need to recreate this file with the next content:
107107

108108
```ts title="src/setup-jest.ts"
109-
import 'jest-preset-angular/setup-jest';
109+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
110+
111+
setupZoneTestEnv();
110112
```
111113

112114
Then, open `angular.json`, and at the `test` section of `"builder": "@angular-builders/jest:run"`, add the next option:

docs/articles/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ keeping interfaces as they are, but suppressing their implementation.
2727
The current version of `ng-mocks` has been tested and **can be used** with:
2828

2929
| angular | ng-mocks | jasmine | jest | ivy | standalone | signals | defer |
30-
| ------: | :------: | :-----: | :--: | :-: | :--------: | :-----: | :---: |
30+
|--------:| :------: | :-----: | :--: | :-: | :--------: | :-----: | :---: |
31+
| 20 | latest | yes | yes | yes | yes | no | no |
3132
| 19 | latest | yes | yes | yes | yes | no | no |
3233
| 18 | latest | yes | yes | yes | yes | no | no |
3334
| 17 | latest | yes | yes | yes | yes | no | no |

docs/articles/migrations.md

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Below you can find critical changes. They happen on major releases.
1010

1111
If you are facing an issue, despite the instructions, please, feel free to [contact us](need-help.md).
1212

13+
## From 19 to 20
14+
15+
There are no special cases.
16+
The update should be straight forward.
17+
18+
## From 18 to 19
19+
20+
There are no special cases.
21+
The update should be straight forward.
22+
1323
## From 17 to 18
1424

1525
There are no special cases.

e2e/a10/angular.json

+3
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,8 @@
7171
}
7272
}
7373
},
74+
"cli": {
75+
"analytics": false
76+
},
7477
"defaultProject": "a10"
7578
}

e2e/a10/jest.es2015ivy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
maxWorkers: 1,
55
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
66
testURL: 'http://localhost',
7-
testPathIgnorePatterns: ['<rootDir>/src/test.ts'],
7+
testMatch: ['<rootDir>/src/**/*.spec.ts'],
88
globals: {
99
'ts-jest': {
1010
tsconfig: 'tsconfig.es2015ivy.spec.json',

e2e/a10/jest.es2015noivy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
maxWorkers: 1,
55
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
66
testURL: 'http://localhost',
7-
testPathIgnorePatterns: ['<rootDir>/src/test.ts'],
7+
testMatch: ['<rootDir>/src/**/*.spec.ts'],
88
globals: {
99
'ts-jest': {
1010
tsconfig: 'tsconfig.es2015noivy.spec.json',

0 commit comments

Comments
 (0)