Skip webpack specific tests in Turbopack test run (#56877)

Looked for `webpack(config` in the test suites and disabled the ones that are testing webpack specifically. There are a few more that are not skipped as they should be implemented for Turbopack.
This commit is contained in:
Tim Neutkens 2023-10-16 12:34:50 +02:00 committed by GitHub
parent 5b52e7772d
commit 4e435e2fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 136 additions and 113 deletions

View file

@ -9,32 +9,36 @@ const appDir = join(__dirname, '../')
let appPort
let app
describe('Handles a broken webpack plugin (precompile)', () => {
let stderr = ''
beforeAll(async () => {
appPort = await findPort()
app = await launchApp(appDir, appPort, {
stderr: true,
nextStart: true,
onStderr(text) {
stderr += text
},
// Skipped as it's not relevant to Turbopack.
;(process.env.TURBOPACK ? describe.skip : describe)(
'Handles a broken webpack plugin (precompile)',
() => {
let stderr = ''
beforeAll(async () => {
appPort = await findPort()
app = await launchApp(appDir, appPort, {
stderr: true,
nextStart: true,
onStderr(text) {
stderr += text
},
})
await waitPort({
host: 'localhost',
port: appPort,
})
})
await waitPort({
host: 'localhost',
port: appPort,
afterAll(() => killApp(app))
beforeEach(() => {
stderr = ''
})
})
afterAll(() => killApp(app))
beforeEach(() => {
stderr = ''
})
it('should render error correctly', async () => {
const text = await renderViaHTTP(appPort, '/')
expect(text).toContain('Internal Server Error')
it('should render error correctly', async () => {
const text = await renderViaHTTP(appPort, '/')
expect(text).toContain('Internal Server Error')
expect(stderr).toMatch('Error: oops')
})
})
expect(stderr).toMatch('Error: oops')
})
}
)

View file

@ -22,7 +22,8 @@ const existsChunkNamed = (name) => {
return chunks.some((chunk) => new RegExp(name).test(chunk))
}
describe('Chunking', () => {
// Skipped as it uses webpack internals / stats.json.
;(process.env.TURBOPACK ? describe.skip : describe)('Chunking', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
try {

View file

@ -13,30 +13,33 @@ import { join } from 'path'
const appDir = join(__dirname, '../')
describe('devtool set in development mode in next config', () => {
it('should warn and revert when a devtool is set in development mode', async () => {
let stderr = ''
// Webpack specific config tests.
;(process.env.TURBOPACK ? describe.skip : describe)(
'devtool set in development mode in next config',
() => {
it('should warn and revert when a devtool is set in development mode', async () => {
let stderr = ''
const appPort = await findPort()
const app = await launchApp(appDir, appPort, {
env: { __NEXT_TEST_WITH_DEVTOOL: true },
onStderr(msg) {
stderr += msg || ''
},
})
const appPort = await findPort()
const app = await launchApp(appDir, appPort, {
env: { __NEXT_TEST_WITH_DEVTOOL: true },
onStderr(msg) {
stderr += msg || ''
},
})
const found = await check(
() => stderr,
/Reverting webpack devtool to /,
false
)
const found = await check(
() => stderr,
/Reverting webpack devtool to /,
false
)
const browser = await webdriver(appPort, '/')
expect(await hasRedbox(browser, true)).toBe(true)
if (process.platform === 'win32') {
// TODO: add win32 snapshot
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
const browser = await webdriver(appPort, '/')
expect(await hasRedbox(browser, true)).toBe(true)
if (process.platform === 'win32') {
// TODO: add win32 snapshot
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"pages/index.js (5:10) @ eval
3 | export default function Index(props) {
@ -47,10 +50,11 @@ describe('devtool set in development mode in next config', () => {
7 | return <div>Index Page</div>
8 | }"
`)
}
await browser.close()
}
await browser.close()
await killApp(app)
expect(found).toBeTruthy()
})
})
await killApp(app)
expect(found).toBeTruthy()
})
}
)

View file

@ -14,33 +14,40 @@ let appPort
let app
let devOutput
describe('svgo-webpack with Image Component', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should not fail to build invalid usage of the Image component', async () => {
const { stderr, code } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toBeFalsy()
expect(code).toBe(0)
})
})
// Skip as this is a webpack specific test.
;(process.env.TURBOPACK ? describe.skip : describe)(
'svgo-webpack with Image Component',
() => {
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
it('should not fail to build invalid usage of the Image component', async () => {
const { stderr, code } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toBeFalsy()
expect(code).toBe(0)
})
}
)
describe('development mode', () => {
beforeAll(async () => {
devOutput = { stdout: '', stderr: '' }
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStdout: (msg) => {
devOutput.stdout += msg
},
onStderr: (msg) => {
devOutput.stderr += msg
},
describe('development mode', () => {
beforeAll(async () => {
devOutput = { stdout: '', stderr: '' }
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStdout: (msg) => {
devOutput.stdout += msg
},
onStderr: (msg) => {
devOutput.stderr += msg
},
})
})
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
expect(devOutput.stderr).toBeFalsy()
})
})
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
expect(devOutput.stderr).toBeFalsy()
})
})
})
}
)

View file

@ -14,39 +14,46 @@ let appPort
let app
let devOutput
describe('svgo-webpack with Image Component', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
it('should not fail to build invalid usage of the Image component', async () => {
const { stderr, code } = await nextBuild(appDir, [], { stderr: true })
const errors = stderr
.split('\n')
.filter((line) => line && !line.trim().startsWith('⚠️'))
expect(errors).toEqual([])
expect(code).toBe(0)
})
})
// Skip as this is a webpack specific test.
;(process.env.TURBOPACK ? describe.skip : describe)(
'svgo-webpack with Image Component',
() => {
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
it('should not fail to build invalid usage of the Image component', async () => {
const { stderr, code } = await nextBuild(appDir, [], { stderr: true })
const errors = stderr
.split('\n')
.filter((line) => line && !line.trim().startsWith('⚠️'))
expect(errors).toEqual([])
expect(code).toBe(0)
})
}
)
describe('development mode', () => {
beforeAll(async () => {
devOutput = { stdout: '', stderr: '' }
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStdout: (msg) => {
devOutput.stdout += msg
},
onStderr: (msg) => {
devOutput.stderr += msg
},
describe('development mode', () => {
beforeAll(async () => {
devOutput = { stdout: '', stderr: '' }
appPort = await findPort()
app = await launchApp(appDir, appPort, {
onStdout: (msg) => {
devOutput.stdout += msg
},
onStderr: (msg) => {
devOutput.stderr += msg
},
})
})
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
const errors = devOutput.stderr
.split('\n')
.filter((line) => line && !line.trim().startsWith('⚠️'))
expect(errors).toEqual([])
})
})
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
const errors = devOutput.stderr
.split('\n')
.filter((line) => line && !line.trim().startsWith('⚠️'))
expect(errors).toEqual([])
})
})
})
}
)