Skip to content

Skip webpack specific tests in Turbopack test run #56877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions test/integration/broken-webpack-plugin/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
afterAll(() => killApp(app))

beforeEach(() => {
stderr = ''
})
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')
})
}
)
3 changes: 2 additions & 1 deletion test/integration/chunking/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
64 changes: 34 additions & 30 deletions test/integration/config-devtool-dev/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''

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 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(`
// 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 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(`
"pages/index.js (5:10) @ eval

3 | export default function Index(props) {
Expand All @@ -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()
})
}
)
59 changes: 33 additions & 26 deletions test/integration/next-image-legacy/svgo-webpack/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
afterAll(() => killApp(app))

it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
expect(devOutput.stderr).toBeFalsy()
it('should print error when invalid Image usage', async () => {
await renderViaHTTP(appPort, '/', {})
expect(devOutput.stderr).toBeFalsy()
})
})
})
})
}
)
71 changes: 39 additions & 32 deletions test/integration/next-image-new/svgo-webpack/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
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([])
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([])
})
})
})
})
}
)