Skip to content

Commit 672cb7b

Browse files
authored
chore: use vitest (with nx atomizer) for e2e tests and use pnpm catalogs (#2720)
1 parent fb921cb commit 672cb7b

File tree

38 files changed

+2129
-1981
lines changed

38 files changed

+2129
-1981
lines changed

.github/workflows/nx-migrate.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Check if @nx/workspace was changed as part of the latest commit on the PR
4040
id: nrwl-workspace-package-check
4141
run: |
42-
git diff HEAD~1 -G"@nx/workspace" --exit-code package.json && echo "@nx/workspace unchanged" || echo "::set-output name=was-changed::true"
42+
git diff HEAD~1 -G"'?@nx/workspace'?:" --exit-code pnpm-workspace.yaml && echo "@nx/workspace unchanged" || echo "::set-output name=was-changed::true"
4343
4444
- uses: pnpm/action-setup@v4
4545
if: ${{ steps.nrwl-workspace-package-check.outputs.was-changed == 'true' }}
@@ -66,11 +66,11 @@ jobs:
6666
# Checkout the PR branch using the github CLI
6767
gh pr checkout ${{ github.event.pull_request.number }}
6868
69-
# Get the version of Nx we are migrating to
70-
NX_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nx/workspace'])")
69+
# Get the version of Nx we are migrating to from the pnpm-workspace.yaml catalog
70+
NX_VERSION=$(yq eval '.catalogs.default["@nx/workspace"] // .catalog["@nx/workspace"]' pnpm-workspace.yaml)
7171
72-
# Revert renovate's changes to package.json and pnpm-lock.yaml so that it is a clean migrate from the status quo
73-
git checkout HEAD~1 -- package.json pnpm-lock.yaml
72+
# Revert renovate's changes to pnpm-workspace.yaml and pnpm-lock.yaml so that it is a clean migrate from the status quo
73+
git checkout HEAD~1 -- pnpm-workspace.yaml pnpm-lock.yaml
7474
7575
# We need to expect lock file changes to be applicable
7676
pnpm install --ignore-scripts --frozen-lockfile=false

.github/workflows/update-e2e-snapshots-for-renovate.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
4444
for package in "${packages[@]}"
4545
do
46-
# It's important we have the leading and trailing (escaped) " here so we know it is an exact match of the package name
47-
git diff HEAD~1 -G"\"$package\"" --exit-code package.json && echo "$package unchanged" || echo "::set-output name=was-changed::true"
46+
# Check for changes to the catalog definitions in pnpm-workspace.yaml
47+
git diff HEAD~1 -G"'?$package'?:" --exit-code pnpm-workspace.yaml && echo "$package unchanged" || echo "::set-output name=was-changed::true"
4848
done
4949
5050
- uses: pnpm/action-setup@v4
@@ -69,7 +69,11 @@ jobs:
6969
# Checkout the PR branch using the github CLI
7070
gh pr checkout ${{ github.event.pull_request.number }}
7171
72+
# Run install and dedupe
7273
pnpm install --ignore-scripts
74+
pnpm dedupe
75+
76+
# Build all packages
7377
pnpm build
7478
7579
# Update the e2e test snapshots

.github/workflows/update-formatting-for-renovate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
4343
for package in "${packages[@]}"
4444
do
45-
# It's important we have the leading and trailing (escaped) " here so we know it is an exact match of the package name
46-
git diff HEAD~1 -G"\"$package\"" --exit-code package.json && echo "$package unchanged" || echo "::set-output name=was-changed::true"
45+
# Check for changes to the catalog definitions in pnpm-workspace.yaml
46+
git diff HEAD~1 -G"'?$package'?:" --exit-code pnpm-workspace.yaml && echo "$package unchanged" || echo "::set-output name=was-changed::true"
4747
done
4848
4949
- uses: pnpm/action-setup@v4
@@ -70,7 +70,7 @@ jobs:
7070
7171
pnpm install --ignore-scripts
7272
73-
# Reset any changes that happened before formatting (e.g. to the package.json and lock file) so that we don't commit them
73+
# Reset any changes that happened before formatting (e.g. to the pnpm-workspace.yaml and lock file) so that we don't commit them
7474
git reset --hard
7575
7676
# Update the formatting of all relevant files

.github/workflows/update-native-event-names-for-renovate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
4444
for package in "${packages[@]}"
4545
do
46-
# It's important we have the leading and trailing (escaped) " here so we know it is an exact match of the package name
47-
git diff HEAD~1 -G"\"$package\"" --exit-code package.json && echo "$package unchanged" || echo "::set-output name=was-changed::true"
46+
# Check for changes to the catalog definitions in pnpm-workspace.yaml
47+
git diff HEAD~1 -G"'?$package'?:" --exit-code pnpm-workspace.yaml && echo "$package unchanged" || echo "::set-output name=was-changed::true"
4848
done
4949
5050
- uses: pnpm/action-setup@v4
@@ -71,7 +71,7 @@ jobs:
7171
7272
pnpm install --ignore-scripts
7373
74-
# Reset any changes that happened before updating the event names (e.g. to the package.json and lock file) so that we don't commit them
74+
# Reset any changes that happened before updating the event names (e.g. to the pnpm-workspace.yaml and lock file) so that we don't commit them
7575
git reset --hard
7676
7777
# Regenerate the file containing the event names

e2e/jest.config.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

e2e/src/__snapshots__/eslint-8--inline-template-fixer.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`eslint-8--inline-template-fixer should generate the expected inline template fixer result 1`] = `
3+
exports[`eslint-8--inline-template-fixer > should generate the expected inline template fixer result 1`] = `
44
"
55
import { Component } from '@angular/core';
66
@@ -15,7 +15,7 @@ export class TestComponent {}
1515
"
1616
`;
1717
18-
exports[`eslint-8--inline-template-fixer should generate the expected inline template fixer result 2`] = `
18+
exports[`eslint-8--inline-template-fixer > should generate the expected inline template fixer result 2`] = `
1919
{
2020
"@angular-eslint/builder": "0.0.0-e2e",
2121
"@angular-eslint/eslint-plugin": "0.0.0-e2e",

e2e/src/__snapshots__/eslint-8--new-workspace-create-application-false-ng-add-then-project.test.ts.snap

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 1`] = `
3+
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project > should pass linting when running ng-add before creating any projects 1`] = `
44
{
55
"@angular-eslint/builder": "0.0.0-e2e",
66
"@angular-eslint/eslint-plugin": "0.0.0-e2e",
@@ -24,96 +24,96 @@ exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project sh
2424
}
2525
`;
2626

27-
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 2`] = `
27+
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project > should pass linting when running ng-add before creating any projects 2`] = `
2828
"{
29-
\\"root\\": true,
30-
\\"ignorePatterns\\": [
31-
\\"projects/**/*\\"
29+
"root": true,
30+
"ignorePatterns": [
31+
"projects/**/*"
3232
],
33-
\\"overrides\\": [
33+
"overrides": [
3434
{
35-
\\"files\\": [
36-
\\"*.ts\\"
35+
"files": [
36+
"*.ts"
3737
],
38-
\\"extends\\": [
39-
\\"eslint:recommended\\",
40-
\\"plugin:@typescript-eslint/recommended\\",
41-
\\"plugin:@angular-eslint/recommended\\",
42-
\\"plugin:@angular-eslint/template/process-inline-templates\\"
38+
"extends": [
39+
"eslint:recommended",
40+
"plugin:@typescript-eslint/recommended",
41+
"plugin:@angular-eslint/recommended",
42+
"plugin:@angular-eslint/template/process-inline-templates"
4343
],
44-
\\"rules\\": {}
44+
"rules": {}
4545
},
4646
{
47-
\\"files\\": [
48-
\\"*.html\\"
47+
"files": [
48+
"*.html"
4949
],
50-
\\"extends\\": [
51-
\\"plugin:@angular-eslint/template/recommended\\",
52-
\\"plugin:@angular-eslint/template/accessibility\\"
50+
"extends": [
51+
"plugin:@angular-eslint/template/recommended",
52+
"plugin:@angular-eslint/template/accessibility"
5353
],
54-
\\"rules\\": {}
54+
"rules": {}
5555
}
5656
]
5757
}
5858
"
5959
`;
6060

61-
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 3`] = `
61+
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project > should pass linting when running ng-add before creating any projects 3`] = `
6262
"{
63-
\\"extends\\": \\"../../.eslintrc.json\\",
64-
\\"ignorePatterns\\": [
65-
\\"!**/*\\"
63+
"extends": "../../.eslintrc.json",
64+
"ignorePatterns": [
65+
"!**/*"
6666
],
67-
\\"overrides\\": [
67+
"overrides": [
6868
{
69-
\\"files\\": [
70-
\\"*.ts\\"
69+
"files": [
70+
"*.ts"
7171
],
72-
\\"rules\\": {
73-
\\"@angular-eslint/directive-selector\\": [
74-
\\"error\\",
72+
"rules": {
73+
"@angular-eslint/directive-selector": [
74+
"error",
7575
{
76-
\\"type\\": \\"attribute\\",
77-
\\"prefix\\": \\"app\\",
78-
\\"style\\": \\"camelCase\\"
76+
"type": "attribute",
77+
"prefix": "app",
78+
"style": "camelCase"
7979
}
8080
],
81-
\\"@angular-eslint/component-selector\\": [
82-
\\"error\\",
81+
"@angular-eslint/component-selector": [
82+
"error",
8383
{
84-
\\"type\\": \\"element\\",
85-
\\"prefix\\": \\"app\\",
86-
\\"style\\": \\"kebab-case\\"
84+
"type": "element",
85+
"prefix": "app",
86+
"style": "kebab-case"
8787
}
8888
]
8989
}
9090
},
9191
{
92-
\\"files\\": [
93-
\\"*.html\\"
92+
"files": [
93+
"*.html"
9494
],
95-
\\"rules\\": {}
95+
"rules": {}
9696
}
9797
]
9898
}
9999
"
100100
`;
101101

102-
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 4`] = `
103-
Object {
102+
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project > should pass linting when running ng-add before creating any projects 4`] = `
103+
{
104104
"builder": "@angular-eslint/builder:lint",
105-
"options": Object {
106-
"lintFilePatterns": Array [
105+
"options": {
106+
"lintFilePatterns": [
107107
"projects/app-project/**/*.ts",
108108
"projects/app-project/**/*.html",
109109
],
110110
},
111111
}
112112
`;
113113

114-
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 5`] = `
114+
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project > should pass linting when running ng-add before creating any projects 5`] = `
115115
"
116-
Linting \\"app-project\\"...
116+
Linting "app-project"...
117117
118118
All files pass linting.
119119
"

0 commit comments

Comments
 (0)