Skip to content

Commit c7cdd32

Browse files
committed
chore: skip angular@20 on not supported node versions
1 parent 1f18438 commit c7cdd32

File tree

3 files changed

+69
-40
lines changed

3 files changed

+69
-40
lines changed

demo.test.mjs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
import assert from 'node:assert'
2+
import { versions } from 'node:process'
23
import { test } from 'node:test'
34

4-
test('edge function config', async () => {
5-
const { config } = await import('./demo/.netlify/edge-functions/angular-ssr/angular-ssr.mjs')
5+
import { satisfies } from 'semver'
66

7-
const excludedPathsWithMaskedHashes = config.excludedPath.map((path) => path.replace(/-[A-Z\d]{8}\./, '-HASHHASH.'))
7+
test(
8+
'edge function config',
9+
{
10+
skip: !satisfies(versions.node, '>=20.11'),
11+
},
12+
async () => {
13+
const { config } = await import('./demo/.netlify/edge-functions/angular-ssr/angular-ssr.mjs')
814

9-
assert.deepEqual(excludedPathsWithMaskedHashes, [
10-
'/.netlify/*',
11-
'/favicon.ico',
12-
'/heroes/index.html',
13-
'/index.csr.html',
14-
'/main-HASHHASH.js',
15-
'/polyfills-HASHHASH.js',
16-
'/styles-HASHHASH.css',
17-
'/heroes',
18-
])
19-
})
15+
const excludedPathsWithMaskedHashes = config.excludedPath.map((path) => path.replace(/-[A-Z\d]{8}\./, '-HASHHASH.'))
16+
17+
assert.deepEqual(excludedPathsWithMaskedHashes, [
18+
'/.netlify/*',
19+
'/favicon.ico',
20+
'/heroes/index.html',
21+
'/index.csr.html',
22+
'/main-HASHHASH.js',
23+
'/polyfills-HASHHASH.js',
24+
'/styles-HASHHASH.css',
25+
'/heroes',
26+
])
27+
},
28+
)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"format:check:prettier": "cross-env-shell prettier --check $npm_package_config_prettier",
4949
"format:fix:prettier": "cross-env-shell prettier --write $npm_package_config_prettier",
5050
"prepublishOnly": "npm ci && npm test",
51-
"pretest:demo": "cd demo && npm ci && netlify build --cwd . --offline",
51+
"pretest:demo": "semver -r \"<20.11\" \"$(node -v)\" && echo \"Skipping on not supported node version (needed: >=20.11, got: $(node -v))\" || (cd demo && npm ci && netlify build --cwd . --offline)",
5252
"pretest:fixtures": "run-s pretest:fixtures:*",
5353
"pretest:fixtures:non-angular-project": "cd tests/fixtures/non-angular-project && npm ci",
5454
"pretest:fixtures:missing-angular-deps": "cd tests/fixtures/missing-angular-deps && npm ci",
@@ -60,8 +60,8 @@
6060
"pretest:fixtures:angular-19-app-engine": "cd tests/fixtures/angular-19-app-engine && npm ci",
6161
"pretest:fixtures:angular-19-app-engine-node-module-resolution": "cd tests/fixtures/angular-19-app-engine-node-module-resolution && npm ci",
6262
"pretest:fixtures:angular-19-prerender-false": "cd tests/fixtures/angular-19-prerender-false && npm ci",
63-
"pretest:fixtures:angular-20": "cd tests/fixtures/angular-20 && npm ci",
64-
"pretest:fixtures:angular-20-zoneless": "cd tests/fixtures/angular-20-zoneless && npm ci",
63+
"pretest:fixtures:angular-20": "semver -r \"<20.11\" \"$(node -v)\" && echo \"Skipping on not supported node version (needed: >=20.11, got: $(node -v))\" || (cd tests/fixtures/angular-20 && npm ci)",
64+
"pretest:fixtures:angular-20-zoneless": "semver -r \"<20.11\" \"$(node -v)\" && echo \"Skipping on not supported node version (needed: >=20.11, got: $(node -v))\" || (cd tests/fixtures/angular-20-zoneless && npm ci)",
6565
"pretest:fixtures:nx-angular-19-common-engine": "cd tests/fixtures/nx-angular-19-common-engine && npm ci",
6666
"pretest:fixtures:nx-angular-19-app-engine": "cd tests/fixtures/nx-angular-19-app-engine && npm ci",
6767
"pretest": "run-s pretest:*",

tests/integration.test.mjs

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import assert from 'node:assert'
22
import { join } from 'node:path'
33
import { join as posixJoin } from 'node:path/posix'
4+
import { versions } from 'node:process'
45
import { test, describe } from 'node:test'
56
import { fileURLToPath } from 'node:url'
67

78
import build from '@netlify/build'
9+
import { satisfies } from 'semver'
810

911
import { getAngularVersion } from '../src/helpers/getPackageVersion.js'
1012
import validateAngularVersion from '../src/helpers/validateAngularVersion.js'
@@ -122,31 +124,49 @@ test('Angular 19 in an NX workspace using App Engine (Developer Preview)', async
122124
assert.deepEqual(success, true)
123125
})
124126

125-
test('Angular 20', async () => {
126-
const { severityCode, success } = await build({
127-
repositoryRoot: fileURLToPath(new URL('fixtures/angular-20', import.meta.url)),
128-
})
129-
130-
assert.deepEqual(severityCode, 0)
131-
assert.deepEqual(success, true)
132-
})
133-
134-
test('Angular 20 Zoneless (Developer Preview)', async () => {
135-
const { severityCode, success } = await build({
136-
repositoryRoot: fileURLToPath(new URL('fixtures/angular-20-zoneless', import.meta.url)),
137-
})
138-
139-
assert.deepEqual(severityCode, 0)
140-
assert.deepEqual(success, true)
141-
})
127+
test(
128+
'Angular 20',
129+
{
130+
skip: !satisfies(versions.node, '>=20.11'),
131+
},
132+
async () => {
133+
const { severityCode, success } = await build({
134+
repositoryRoot: fileURLToPath(new URL('fixtures/angular-20', import.meta.url)),
135+
})
136+
137+
assert.deepEqual(severityCode, 0)
138+
assert.deepEqual(success, true)
139+
},
140+
)
141+
142+
test(
143+
'Angular 20 Zoneless (Developer Preview)',
144+
{
145+
skip: !satisfies(versions.node, '>=20.11'),
146+
},
147+
async () => {
148+
const { severityCode, success } = await build({
149+
repositoryRoot: fileURLToPath(new URL('fixtures/angular-20-zoneless', import.meta.url)),
150+
})
151+
152+
assert.deepEqual(severityCode, 0)
153+
assert.deepEqual(success, true)
154+
},
155+
)
142156

143157
describe('Angular version validation', () => {
144-
test('checks version for angular 20', async () => {
145-
const result = validateAngularVersion(
146-
await getAngularVersion(fileURLToPath(new URL('fixtures/angular-20', import.meta.url))),
147-
)
148-
assert.strictEqual(result, true)
149-
})
158+
test(
159+
'checks version for angular 20',
160+
{
161+
skip: !satisfies(versions.node, '>=20.11'),
162+
},
163+
async () => {
164+
const result = validateAngularVersion(
165+
await getAngularVersion(fileURLToPath(new URL('fixtures/angular-20', import.meta.url))),
166+
)
167+
assert.strictEqual(result, true)
168+
},
169+
)
150170

151171
test('checks version for angular 19', async () => {
152172
const result = validateAngularVersion(

0 commit comments

Comments
 (0)