Skip to content

Commit e8a84e8

Browse files
authored
test: split basic HMR test into multiple files (vercel#79064)
Split long-running basic hmr test to parallelize and reduce CI time. As @huozhi mentioned at vercel#73613 (review), the tests won't be separated to `__test__` dir but flattened out on the same level as the fixture dirs. Port of vercel#73616, confirmed no new changes. x-ref: https://github.com/vercel/next.js/commits/canary/test/development/basic/hmr/basic.test.ts
1 parent fea8cb6 commit e8a84e8

5 files changed

+34
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { runBasicHmrTest } from './run-basic-hmr-test.util'
2+
3+
const nextConfig = { basePath: '', assetPrefix: '' }
4+
5+
describe(`HMR - basic, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
6+
runBasicHmrTest(nextConfig)
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { runBasicHmrTest } from './run-basic-hmr-test.util'
2+
3+
const nextConfig = { basePath: '', assetPrefix: '/asset-prefix' }
4+
5+
describe(`HMR - basic, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
6+
runBasicHmrTest(nextConfig)
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { runBasicHmrTest } from './run-basic-hmr-test.util'
2+
3+
const nextConfig = { basePath: '/docs', assetPrefix: '' }
4+
5+
describe(`HMR - basic, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
6+
runBasicHmrTest(nextConfig)
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { runBasicHmrTest } from './run-basic-hmr-test.util'
2+
3+
const nextConfig = { basePath: '/docs', assetPrefix: '/asset-prefix' }
4+
5+
describe(`HMR - basic, nextConfig: ${JSON.stringify(nextConfig)}`, () => {
6+
runBasicHmrTest(nextConfig)
7+
})

test/development/basic/hmr/basic.test.ts renamed to test/development/basic/hmr/run-basic-hmr-test.util.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ import {
55
waitFor,
66
} from 'next-test-utils'
77
import { createNext, nextTestSetup } from 'e2e-utils'
8-
import type { NextConfig } from 'next'
9-
10-
describe.each([
11-
{ basePath: '', assetPrefix: '' },
12-
{ basePath: '', assetPrefix: '/asset-prefix' },
13-
{ basePath: '/docs', assetPrefix: '' },
14-
{ basePath: '/docs', assetPrefix: '/asset-prefix' },
15-
])('basic HMR, nextConfig: %o', (nextConfig: Partial<NextConfig>) => {
8+
9+
export function runBasicHmrTest(nextConfig: {
10+
basePath: string
11+
assetPrefix: string
12+
}) {
1613
const { next } = nextTestSetup({
1714
files: __dirname,
1815
nextConfig,
@@ -113,4 +110,4 @@ describe.each([
113110
await reloadPromise
114111
await secondNext.destroy()
115112
})
116-
})
113+
}

0 commit comments

Comments
 (0)