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

Turbopack build: Skip test that is not relevant for Turbopack (#79376)

## What?

Turbopack doesn't fail in this case as it can process server-side assets
regardless of if they're also in the client layer. That's something we
couldn't do with webpack.
parent 3d5cf76c
...@@ -7,43 +7,46 @@ jest.setTimeout(1000 * 60 * 2) ...@@ -7,43 +7,46 @@ jest.setTimeout(1000 * 60 * 2)
const appDir = join(__dirname, '../') const appDir = join(__dirname, '../')
const nextConfig = new File(join(appDir, 'next.config.js')) const nextConfig = new File(join(appDir, 'next.config.js'))
describe('Invalid static image import in _document', () => { ;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( 'Invalid static image import in _document',
'production mode', () => {
() => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
afterAll(() => nextConfig.restore()) 'production mode',
() => {
afterAll(() => nextConfig.restore())
it('Should fail to build when no next.config.js', async () => { it('Should fail to build when no next.config.js', async () => {
const { code, stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
})
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile')
expect(stderr).toMatch(
/Images.*cannot.*be imported within.*pages[\\/]_document\.js/
)
expect(stderr).toMatch(/Location:.*pages[\\/]_document\.js/)
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile')
expect(stderr).toMatch(
/Images.*cannot.*be imported within.*pages[\\/]_document\.js/
)
expect(stderr).toMatch(/Location:.*pages[\\/]_document\.js/)
})
it('Should fail to build when disableStaticImages in next.config.js', async () => { it('Should fail to build when disableStaticImages in next.config.js', async () => {
nextConfig.write(` nextConfig.write(`
module.exports = { module.exports = {
images: { images: {
disableStaticImages: true disableStaticImages: true
} }
} }
`) `)
const { code, stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
})
expect(code).not.toBe(0)
expect(stderr).toMatch(
/You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file/
)
expect(stderr).not.toMatch(
/Images.*cannot.*be imported within.*pages[\\/]_document\.js/
)
}) })
expect(code).not.toBe(0) }
expect(stderr).toMatch( )
/You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file/ }
) )
expect(stderr).not.toMatch(
/Images.*cannot.*be imported within.*pages[\\/]_document\.js/
)
})
}
)
})
...@@ -15233,11 +15233,11 @@ ...@@ -15233,11 +15233,11 @@
}, },
"test/integration/invalid-document-image-import/test/index.test.js": { "test/integration/invalid-document-image-import/test/index.test.js": {
"passed": [], "passed": [],
"failed": [ "failed": [],
"pending": [
"Invalid static image import in _document production mode Should fail to build when disableStaticImages in next.config.js", "Invalid static image import in _document production mode Should fail to build when disableStaticImages in next.config.js",
"Invalid static image import in _document production mode Should fail to build when no next.config.js" "Invalid static image import in _document production mode Should fail to build when no next.config.js"
], ],
"pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
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