Skip to content

Commit 8013f78

Browse files
ascorbicmrstork
andauthored
chore: annotate or ignore more tests (#439)
* chore: annotate or ignore more tests * chore: add more reasons and tooling * Fix path * chore: add more reasons and update script * chore: sort ignored items * chore: more reasons --------- Co-authored-by: Mateusz Bocian <[email protected]>
1 parent af92b99 commit 8013f78

File tree

7 files changed

+199
-16
lines changed

7 files changed

+199
-16
lines changed

.github/workflows/test-e2e.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,12 @@ jobs:
237237
id: publish-test-results
238238
if: success() || failure()
239239
run: |
240-
deno run -A tools/deno/junit2md.ts artifacts >> $GITHUB_STEP_SUMMARY
241240
echo "slackEvent<<NETLIFY_EOF" >> $GITHUB_OUTPUT
242241
deno run -A tools/deno/junit2slack.ts --dir artifacts --version ${{matrix.version}} --runUrl ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} >> $GITHUB_OUTPUT
243242
echo "NETLIFY_EOF" >> $GITHUB_OUTPUT
244243
deno run -A tools/deno/junit2json.ts artifacts > report/test-results.json
244+
deno run -A tools/deno/generate-md.ts >> $GITHUB_STEP_SUMMARY
245+
245246
- name: Upload Test JSON
246247
uses: actions/upload-artifact@v4
247248
with:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ tests/**/package-lock.json
1818
tests/**/pnpm-lock.yaml
1919
tests/**/yarn.lock
2020
tests/**/out/
21+
report/test-results.json

tests/netlify-deploy.ts

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export class NextDeployInstance extends NextInstance {
2626
}
2727

2828
public async setup(parentSpan: Span) {
29+
if (process.env.SITE_URL && process.env.BUILD_ID) {
30+
require('console').log('Using existing deployment: ' + process.env.SITE_URL)
31+
this._url = process.env.SITE_URL
32+
this._parsedUrl = new URL(this._url)
33+
this._buildId = process.env.BUILD_ID
34+
return
35+
}
2936
// create the test site
3037
await super.createTestDir({ parentSpan, skipInstall: true })
3138

tests/test-config.json

+130-14
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
{
22
"ignored": [
3-
"test/e2e/test-template/{{ toFileName name }}/{{ toFileName name }}.test.ts",
4-
"test/e2e/app-dir/app-validation/validation.test.ts",
5-
"test/e2e/app-dir/app/standalone-gsp.test.ts",
6-
"test/e2e/app-dir/app/standalone.test.ts",
7-
"test/e2e/app-dir/ppr-errors/ppr-errors.test.ts",
8-
"test/e2e/app-dir/interception-middleware-rewrite/interception-middleware-rewrite.test.ts",
9-
"test/e2e/app-dir/app-compilation/index.test.ts",
10-
"test/e2e/favicon-short-circuit/favicon-short-circuit.test.ts",
11-
"test/e2e/app-dir/with-exported-function-config/with-exported-function-config.test.ts",
12-
"test/e2e/app-dir/conflicting-page-segments/conflicting-page-segments.test.ts",
133
"test/e2e/404-page-router/index.test.ts",
4+
"test/e2e/app-dir/app-compilation/index.test.ts",
145
"test/e2e/app-dir/app-fetch-deduping/app-fetch-deduping.test.ts",
6+
"test/e2e/app-dir/app-validation/validation.test.ts",
157
"test/e2e/app-dir/app/experimental-compile.test.ts",
168
"test/e2e/app-dir/app/standalone-gsp.test.ts",
179
"test/e2e/app-dir/app/standalone.test.ts",
1810
"test/e2e/app-dir/build-size/index.test.ts",
11+
"test/e2e/app-dir/conflicting-page-segments/conflicting-page-segments.test.ts",
1912
"test/e2e/app-dir/create-root-layout/create-root-layout.test.ts",
13+
"test/e2e/app-dir/interception-middleware-rewrite/interception-middleware-rewrite.test.ts",
14+
"test/e2e/app-dir/ppr-errors/ppr-errors.test.ts",
2015
"test/e2e/app-dir/rewrites-redirects/rewrites-redirects.test.ts",
16+
"test/e2e/app-dir/server-components-externals/index.test.ts",
17+
"test/e2e/app-dir/with-exported-function-config/with-exported-function-config.test.ts",
2118
"test/e2e/edge-compiler-can-import-blob-assets/index.test.ts",
19+
"test/e2e/favicon-short-circuit/favicon-short-circuit.test.ts",
2220
"test/e2e/i18n-data-fetching-redirect/index.test.ts",
2321
"test/e2e/manual-client-base-path/index.test.ts",
2422
"test/e2e/no-eslint-warn-with-no-eslint-config/index.test.ts",
23+
"test/e2e/revalidate-reason/revalidate-reason.test.ts",
2524
"test/e2e/switchable-runtime/index.test.ts",
25+
"test/e2e/test-template/{{ toFileName name }}/{{ toFileName name }}.test.ts",
2626
"test/e2e/trailingslash-with-rewrite/index.test.ts",
2727
"test/e2e/transpile-packages/index.test.ts",
2828
"test/e2e/typescript-version-no-warning/typescript-version-no-warning.test.ts",
29-
"test/e2e/typescript-version-warning/typescript-version-warning.test.ts",
30-
"/test/e2e/revalidate-reason/revalidate-reason.test.ts"
29+
"test/e2e/typescript-version-warning/typescript-version-warning.test.ts"
3130
],
3231
"skipped": [
3332
{
@@ -58,6 +57,14 @@
5857
"file": "test/e2e/third-parties/index.test.ts",
5958
"reason": "npm install doesn't work in this repo"
6059
},
60+
{
61+
"file": "test/e2e/next-phase/index.test.ts",
62+
"reason": "Uses CLI output"
63+
},
64+
{
65+
"file": "test/e2e/tsconfig-module-preserve/index.test.ts",
66+
"reason": "Uses CLI output"
67+
},
6168
{
6269
"file": "test/e2e/swc-warnings/index.test.ts",
6370
"reason": "Uses CLI output"
@@ -178,11 +185,13 @@
178185
},
179186
{
180187
"file": "test/e2e/app-dir/metadata/metadata.test.ts",
181-
"reason": "Hard-coded Vercel URL",
188+
"reason": "Hard-coded Vercel URL or env var",
182189
"tests": [
183190
"app dir - metadata opengraph should pick up opengraph-image and twitter-image as static metadata files",
184191
"app dir - metadata static routes should have /favicon.ico as route",
185-
"app dir - metadata static routes should have icons as route"
192+
"app dir - metadata static routes should have icons as route",
193+
"app dir - metadata basic should support other basic tags",
194+
"app dir - metadata basic should support other basic tags (edge)"
186195
]
187196
},
188197
{
@@ -276,6 +285,35 @@
276285
"app-dir action handling should log a warning when a server action is not found but an id is provided",
277286
"app-dir action handling should work with interception routes"
278287
]
288+
},
289+
{
290+
"file": "test/e2e/app-dir/app-client-cache/client-cache.experimental.test.ts",
291+
"reason": "Uses CLI output",
292+
"tests": [
293+
"app dir client cache semantics (experimental staleTimes) dynamic: 0 telemetry should send staleTimes feature usage event",
294+
"app dir client cache semantics (experimental staleTimes) static: 180 telemetry should send staleTimes feature usage event"
295+
]
296+
},
297+
{
298+
"file": "test/e2e/app-dir/app-static/app-static.test.ts",
299+
"tests": [
300+
{
301+
"name": "app-dir static/dynamic handling new tags have been specified on subsequent fetch should not fetch from memory cache",
302+
"reason": "Behavior matches next start and Vercel"
303+
},
304+
{
305+
"name": "app-dir static/dynamic handling new tags have been specified on subsequent fetch should not fetch from memory cache after revalidateTag is used",
306+
"reason": "Typo in test"
307+
},
308+
{
309+
"name": "app-dir static/dynamic handling should properly revalidate a route handler that triggers dynamic usage with force-static",
310+
"reason": "Behavior matches next start and Vercel"
311+
},
312+
{
313+
"name": "app-dir static/dynamic handling should build dynamic param with edge runtime correctly",
314+
"reason": "Error in test"
315+
}
316+
]
279317
}
280318
],
281319
"failures": [
@@ -294,6 +332,11 @@
294332
"reason": "Nonce not automatically set in script tags when using CSP",
295333
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
296334
},
335+
{
336+
"name": "app dir - basic next/script should pass `nonce`",
337+
"reason": "Nonce not automatically set in script tags when using CSP",
338+
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
339+
},
297340
{
298341
"name": "Middleware Runtime with i18n should validate & parse request url from a dynamic route with params",
299342
"reason": "Middleware in sites with i18n generating incorrect request.url pathname",
@@ -383,6 +426,79 @@
383426
"name": "app-custom-routes works with generateStaticParams correctly revalidates correctly on /revalidate-1/three/data.json",
384427
"reason": "First request for generateStaticParams fallback route handler returns base64-encoded content",
385428
"link": "https://github.com/netlify/next-runtime-minimal/issues/388"
429+
},
430+
{
431+
"name": "app-dir action handling fetch actions should store revalidation data in the prefetch cache",
432+
"reason": "Fetch action prefetch cache test is flakey",
433+
"link": "https://github.com/netlify/next-runtime-minimal/issues/444"
434+
},
435+
{
436+
"name": "parallel-routes-and-interception parallel routes should support parallel route tab bars",
437+
"reason": "Some parallel routes returning 404",
438+
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
439+
},
440+
{
441+
"name": "parallel-routes-and-interception parallel routes should throw a 404 when no matching parallel route is found",
442+
"reason": "Some parallel routes returning 404",
443+
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
444+
},
445+
{
446+
"name": "parallel-routes-and-interception parallel routes should only scroll to the parallel route that was navigated to",
447+
"reason": "Some parallel routes returning 404",
448+
"link": "https://github.com/netlify/next-runtime-minimal/issues/445"
449+
},
450+
{
451+
"name": "Middleware Responses should respond appending headers headers",
452+
"reason": "Appending set-cookie header in middleware leads to duplicate header",
453+
"link": "https://github.com/netlify/next-runtime-minimal/issues/447"
454+
},
455+
{
456+
"name": "Middleware Responses /fr should respond appending headers headers",
457+
"reason": "Appending set-cookie header in middleware leads to duplicate header",
458+
"link": "https://github.com/netlify/next-runtime-minimal/issues/447"
459+
},
460+
{
461+
"name": "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-path",
462+
"reason": "Not a fail: race condition when testing revalidation"
463+
},
464+
{
465+
"name": "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-tag",
466+
"reason": "Not a fail: race condition when testing revalidation"
467+
},
468+
{
469+
"name": "Middleware base tests router.query must exist when Link clicked page routing",
470+
"reason": "Pages router data requests returning 404 when middleware is used",
471+
"link": "https://github.com/netlify/next-runtime-minimal/issues/450"
472+
},
473+
{
474+
"name": "Middleware Rewrite should handle catch-all rewrite correctly",
475+
"reason": "TODO: correct behaviour is unclear. See link for implementation",
476+
"link": "https://github.com/vercel/next.js/pull/63254"
477+
},
478+
{
479+
"name": "Middleware Rewrite should allow to rewrite keeping the locale in pathname",
480+
"reason": "Middleware rewrites should keep the locale in the pathname",
481+
"link": "https://github.com/netlify/next-runtime-minimal/issues/451"
482+
},
483+
{
484+
"name": "parallel-routes-revalidation should submit the action and revalidate the page data",
485+
"reason": "Parallel route revalidation actions are intermittently failing",
486+
"link": "https://github.com/netlify/next-runtime-minimal/issues/452"
487+
},
488+
{
489+
"name": "Middleware custom matchers i18n should not match",
490+
"reason": "Middleware matching is too broad when using i18n",
491+
"link": "https://github.com/netlify/next-runtime-minimal/issues/453"
492+
},
493+
{
494+
"name": "using a single matcher with i18n and basePath adds the header for a matched path",
495+
"reason": "Middleware does not match when using basePath and default locale",
496+
"link": "https://github.com/netlify/next-runtime-minimal/issues/454"
497+
},
498+
{
499+
"name": "using a single matcher with i18n and basePath and trailingSlash adds the header for a matched path",
500+
"reason": "Middleware does not match when using basePath and default locale",
501+
"link": "https://github.com/netlify/next-runtime-minimal/issues/454"
386502
}
387503
]
388504
}

tools/deno/generate-md.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import results from '../../report/test-results.json' with { type: 'json' }
2+
3+
let withReason = 0
4+
let withoutReason = 0
5+
6+
console.log('## Test results')
7+
console.log(`| | Tests |`)
8+
console.log(`| --- | ----- |`)
9+
console.log(`| ✅ Passed | ${results.passed} |`)
10+
console.log(`| ❌ Failed | ${results.failed} |`)
11+
console.log(`| ⏭️ Skipped | ${results.skipped} |`)
12+
13+
console.log(`Pass rate: **${results.passRate}**`)
14+
console.log('\n## Failures\n')
15+
16+
console.log(`| Test | Reason |`)
17+
console.log(`| ---- | ------ |`)
18+
19+
for (const suite of results.results) {
20+
for (const testcase of suite.testCases ?? []) {
21+
if (testcase.status !== 'failed') {
22+
continue
23+
}
24+
console.log(
25+
`| [${testcase.name}](https://github.com/vercel/next.js/tree/canary/${suite.file}) | ${testcase.reason ? `[${testcase.reason}](${testcase.link})` : '❓'} |`,
26+
)
27+
if (testcase.reason) {
28+
withReason++
29+
} else {
30+
withoutReason++
31+
}
32+
}
33+
}
34+
35+
console.log(`\n${withReason} tests have reasons, ${withoutReason} do not.`)

tools/deno/junit2json.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function junitToJson(xmlData: {
8686
name,
8787
file: testCases[0]?.['@file'],
8888
passed,
89-
failed,
89+
failed: Number(failed),
9090
skipped: 0,
9191
testCases: [],
9292
}

tools/deno/test-failures.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import results from '../../report/test-results.json' with { type: 'json' }
2+
3+
let withReason = 0
4+
let withoutReason = 0
5+
6+
for (const suite of results.results) {
7+
for (const testcase of suite.testCases ?? []) {
8+
if (testcase.status !== 'failed') {
9+
continue
10+
}
11+
12+
if (testcase.reason) {
13+
withReason++
14+
} else {
15+
console.log(
16+
`${' '.repeat(90 - suite.file.length)}${suite.file.slice(9, -8)}: ${testcase.name}`,
17+
)
18+
withoutReason++
19+
}
20+
}
21+
}
22+
23+
console.log(`\n${withReason} tests have reasons, ${withoutReason} do not.`)

0 commit comments

Comments
 (0)