Unverified Commit 4e435e2f authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

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.
parent 5b52e777
...@@ -9,32 +9,36 @@ const appDir = join(__dirname, '../') ...@@ -9,32 +9,36 @@ const appDir = join(__dirname, '../')
let appPort let appPort
let app let app
describe('Handles a broken webpack plugin (precompile)', () => { // Skipped as it's not relevant to Turbopack.
let stderr = '' ;(process.env.TURBOPACK ? describe.skip : describe)(
beforeAll(async () => { 'Handles a broken webpack plugin (precompile)',
appPort = await findPort() () => {
app = await launchApp(appDir, appPort, { let stderr = ''
stderr: true, beforeAll(async () => {
nextStart: true, appPort = await findPort()
onStderr(text) { app = await launchApp(appDir, appPort, {
stderr += text stderr: true,
}, nextStart: true,
onStderr(text) {
stderr += text
},
})
await waitPort({
host: 'localhost',
port: appPort,
})
}) })
await waitPort({ afterAll(() => killApp(app))
host: 'localhost',
port: appPort,
})
})
afterAll(() => killApp(app))
beforeEach(() => { beforeEach(() => {
stderr = '' stderr = ''
}) })
it('should render error correctly', async () => { it('should render error correctly', async () => {
const text = await renderViaHTTP(appPort, '/') const text = await renderViaHTTP(appPort, '/')
expect(text).toContain('Internal Server Error') expect(text).toContain('Internal Server Error')
expect(stderr).toMatch('Error: oops') expect(stderr).toMatch('Error: oops')
}) })
}) }
)
...@@ -22,7 +22,8 @@ const existsChunkNamed = (name) => { ...@@ -22,7 +22,8 @@ const existsChunkNamed = (name) => {
return chunks.some((chunk) => new RegExp(name).test(chunk)) 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', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => { beforeAll(async () => {
try { try {
......
...@@ -13,30 +13,33 @@ import { join } from 'path' ...@@ -13,30 +13,33 @@ import { join } from 'path'
const appDir = join(__dirname, '../') const appDir = join(__dirname, '../')
describe('devtool set in development mode in next config', () => { // Webpack specific config tests.
it('should warn and revert when a devtool is set in development mode', async () => { ;(process.env.TURBOPACK ? describe.skip : describe)(
let stderr = '' 'devtool set in development mode in next config',
() => {
const appPort = await findPort() it('should warn and revert when a devtool is set in development mode', async () => {
const app = await launchApp(appDir, appPort, { let stderr = ''
env: { __NEXT_TEST_WITH_DEVTOOL: true },
onStderr(msg) { const appPort = await findPort()
stderr += msg || '' 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 /,
const browser = await webdriver(appPort, '/') false
expect(await hasRedbox(browser, true)).toBe(true) )
if (process.platform === 'win32') {
// TODO: add win32 snapshot const browser = await webdriver(appPort, '/')
} else { expect(await hasRedbox(browser, true)).toBe(true)
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` if (process.platform === 'win32') {
// TODO: add win32 snapshot
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"pages/index.js (5:10) @ eval "pages/index.js (5:10) @ eval
3 | export default function Index(props) { 3 | export default function Index(props) {
...@@ -47,10 +50,11 @@ describe('devtool set in development mode in next config', () => { ...@@ -47,10 +50,11 @@ describe('devtool set in development mode in next config', () => {
7 | return <div>Index Page</div> 7 | return <div>Index Page</div>
8 | }" 8 | }"
`) `)
} }
await browser.close() await browser.close()
await killApp(app) await killApp(app)
expect(found).toBeTruthy() expect(found).toBeTruthy()
}) })
}) }
)
...@@ -14,33 +14,40 @@ let appPort ...@@ -14,33 +14,40 @@ let appPort
let app let app
let devOutput let devOutput
describe('svgo-webpack with Image Component', () => { // Skip as this is a webpack specific test.
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK ? describe.skip : describe)(
it('should not fail to build invalid usage of the Image component', async () => { 'svgo-webpack with Image Component',
const { stderr, code } = await nextBuild(appDir, [], { stderr: true }) () => {
expect(stderr).toBeFalsy() ;(process.env.TURBOPACK ? describe.skip : describe)(
expect(code).toBe(0) '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', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
devOutput = { stdout: '', stderr: '' } devOutput = { stdout: '', stderr: '' }
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort, { app = await launchApp(appDir, appPort, {
onStdout: (msg) => { onStdout: (msg) => {
devOutput.stdout += msg devOutput.stdout += msg
}, },
onStderr: (msg) => { onStderr: (msg) => {
devOutput.stderr += msg devOutput.stderr += msg
}, },
})
}) })
}) afterAll(() => killApp(app))
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => { it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {}) await renderViaHTTP(appPort, '/', {})
expect(devOutput.stderr).toBeFalsy() expect(devOutput.stderr).toBeFalsy()
})
}) })
}) }
}) )
...@@ -14,39 +14,46 @@ let appPort ...@@ -14,39 +14,46 @@ let appPort
let app let app
let devOutput let devOutput
describe('svgo-webpack with Image Component', () => { // Skip as this is a webpack specific test.
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => { ;(process.env.TURBOPACK ? describe.skip : describe)(
it('should not fail to build invalid usage of the Image component', async () => { 'svgo-webpack with Image Component',
const { stderr, code } = await nextBuild(appDir, [], { stderr: true }) () => {
const errors = stderr ;(process.env.TURBOPACK ? describe.skip : describe)(
.split('\n') 'production mode',
.filter((line) => line && !line.trim().startsWith('⚠️')) () => {
expect(errors).toEqual([]) it('should not fail to build invalid usage of the Image component', async () => {
expect(code).toBe(0) 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', () => { describe('development mode', () => {
beforeAll(async () => { beforeAll(async () => {
devOutput = { stdout: '', stderr: '' } devOutput = { stdout: '', stderr: '' }
appPort = await findPort() appPort = await findPort()
app = await launchApp(appDir, appPort, { app = await launchApp(appDir, appPort, {
onStdout: (msg) => { onStdout: (msg) => {
devOutput.stdout += msg devOutput.stdout += msg
}, },
onStderr: (msg) => { onStderr: (msg) => {
devOutput.stderr += msg devOutput.stderr += msg
}, },
})
}) })
}) afterAll(() => killApp(app))
afterAll(() => killApp(app))
it('should print error when invalid Image usage', async () => { it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {}) await renderViaHTTP(appPort, '/', {})
const errors = devOutput.stderr const errors = devOutput.stderr
.split('\n') .split('\n')
.filter((line) => line && !line.trim().startsWith('⚠️')) .filter((line) => line && !line.trim().startsWith('⚠️'))
expect(errors).toEqual([]) expect(errors).toEqual([])
})
}) })
}) }
}) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment