Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Apr 12, 2023
1 parent 005f5ac commit da519de
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 94 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_test_deploy_new.yml
Expand Up @@ -11,7 +11,7 @@ env:
PNPM_VERSION: 7.24.3
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 8
TEST_CONCURRENCY: 10
# TODO: remove after testing
NEXT_TEST_CONTINUE_ON_ERROR: 'true'

Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- run: rm -rf /tmp/next-repo-*; rm -rf /tmp/next-install-*

- run: node run-tests.js --type unit -c ${TEST_CONCURRENCY}
name: Run development/ tests
name: Run unit tests

- run: node run-tests.js --type development -c ${TEST_CONCURRENCY}
name: Run development/ tests
Expand Down
166 changes: 84 additions & 82 deletions test/development/acceptance-app/version-staleness.test.ts
Expand Up @@ -3,34 +3,35 @@ import { sandbox } from './helpers'
import { createNextDescribe, FileRef } from 'e2e-utils'
import path from 'path'

createNextDescribe(
'Error Overlay version staleness',
{
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: 'latest',
'react-dom': 'latest',
describe.skip('should skip for now', () => {
createNextDescribe(
'Error Overlay version staleness',
{
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: 'latest',
'react-dom': 'latest',
},
skipStart: true,
},
skipStart: true,
},
({ next }) => {
it('should show version staleness in runtime error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '1.0.0'
({ next }) => {
it('should show version staleness in runtime error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '1.0.0'

const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)
const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)

await session.patch(
'app/page.js',
`
await session.patch(
'app/page.js',
`
"use client"
import Component from '../index'
export default function Page() {
Expand All @@ -40,79 +41,80 @@ createNextDescribe(
return null
}
`
)
)

await session.waitForAndOpenRuntimeError()
expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (1.0.0) is outdated (learn more)"`)
await session.waitForAndOpenRuntimeError()
expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (1.0.0) is outdated (learn more)"`)

await cleanup()
})
await cleanup()
})

it('should show version staleness in render error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '2.0.0'
it('should show version staleness in render error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '2.0.0'

const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)
const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)

await session.patch(
'app/page.js',
`
await session.patch(
'app/page.js',
`
export default function Page() {
throw new Error("render error")
return null
}
`
)
)

expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (2.0.0) is outdated (learn more)"`)
expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (2.0.0) is outdated (learn more)"`)

await cleanup()
})
await cleanup()
})

it('should show version staleness in build error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '3.0.0'
it('should show version staleness in build error', async () => {
// Set next to outdated version
const nextPackageJson = JSON.parse(
await next.readFile('node_modules/next/package.json')
)
nextPackageJson.version = '3.0.0'

const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)
const { browser, session, cleanup } = await sandbox(
next,
new Map([
['node_modules/next/package.json', JSON.stringify(nextPackageJson)],
])
)

await session.patch(
'app/page.js',
`
await session.patch(
'app/page.js',
`
{{{
`
)
)

expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (3.0.0) is outdated (learn more)"`)
expect(
await browser
.waitForElementByCss('.nextjs-container-build-error-version-status')
.text()
).toMatchInlineSnapshot(`"Next.js (3.0.0) is outdated (learn more)"`)

await cleanup()
})
}
)
await cleanup()
})
}
)
})
20 changes: 10 additions & 10 deletions test/lib/e2e-utils.ts
Expand Up @@ -14,16 +14,16 @@ export type { NextInstance }
// if either test runs for the --turbo or have a custom timeout, set reduced timeout instead.
// this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole
// test job exceeds the 6 hours limit.
let testTimeout = shouldRunTurboDevTest() ? (240 * 1000) / 4 : 240 * 1000
if (process.env.NEXT_E2E_TEST_TIMEOUT) {
try {
testTimeout = parseInt(process.env.NEXT_E2E_TEST_TIMEOUT, 10)
} catch (_) {
// ignore
}
}

jest.setTimeout(testTimeout)
// let testTimeout = shouldRunTurboDevTest() ? (240 * 1000) / 4 : 240 * 1000
// if (process.env.NEXT_E2E_TEST_TIMEOUT) {
// try {
// testTimeout = parseInt(process.env.NEXT_E2E_TEST_TIMEOUT, 10)
// } catch (_) {
// // ignore
// }
// }

// jest.setTimeout(testTimeout)

const testsFolder = path.join(__dirname, '..')

Expand Down

0 comments on commit da519de

Please sign in to comment.