mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
1. Align the code highlight marker color with the issue severity 2. Make the issue title colored 3. Prefix issues with `Warning` or `Error` <img width="1383" height="862" alt="Bildschirmfoto 2026-06-16 um 18 59 03" src="https://github.com/user-attachments/assets/f98c606d-4ea8-40c2-836d-e395f1df904c" /> <img width="1039" height="450" alt="Bildschirmfoto 2026-06-16 um 19 03 39" src="https://github.com/user-attachments/assets/2747f914-0587-4178-a87d-344f24715c96" /> <details> <summary>Old</summary> <img width="1267" height="745" alt="Bildschirmfoto 2026-06-16 um 17 04 35" src="https://github.com/user-attachments/assets/837739ff-82f7-4ea2-8767-ca7d866a8570" /> </details>
98 lines
3.1 KiB
TypeScript
98 lines
3.1 KiB
TypeScript
import { nextTestSetup, isNextDev } from 'e2e-utils'
|
|
|
|
describe('swcPlugins', () => {
|
|
describe('supports swcPlugins', () => {
|
|
const { next, skipped } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
dependencies: {
|
|
'@swc/plugin-react-remove-properties': '11.1.0',
|
|
},
|
|
})
|
|
if (skipped) return
|
|
|
|
it('basic case', async () => {
|
|
const html = await next.render('/')
|
|
expect(html).toContain('Hello World')
|
|
expect(html).not.toContain('data-custom-attribute')
|
|
})
|
|
})
|
|
;(isNextDev ? describe : describe.skip)('incompatible plugin version', () => {
|
|
const { next, skipped, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
dependencies: {
|
|
'@swc/plugin-react-remove-properties': '7.0.2',
|
|
},
|
|
})
|
|
if (skipped) return
|
|
|
|
it('shows a redbox in dev', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
if (isTurbopack) {
|
|
await expect(browser).toDisplayRedbox(`
|
|
{
|
|
"description": "Failed to execute SWC plugin",
|
|
"environmentLabel": null,
|
|
"label": "Build Error",
|
|
"source": "./app/layout.js
|
|
Error: Failed to execute SWC plugin
|
|
An unexpected error occurred when executing an SWC EcmaScript transform plugin.
|
|
This might be due to a version mismatch between the plugin and Next.js. https://plugins.swc.rs/ can help you find the correct plugin version to use.
|
|
Failed to execute @swc/plugin-react-remove-properties
|
|
Caused by:
|
|
0: failed to deserialize \`swc_common::plugin::diagnostics::PluginCorePkgDiagnostics\`
|
|
1: Mismatch { name: "array", found: 48 }",
|
|
"stack": [],
|
|
}
|
|
`)
|
|
} else {
|
|
// TODO missing proper error with Webpack
|
|
await expect(browser).toDisplayRedbox(
|
|
`"Expected Redbox but found no visible one."`
|
|
)
|
|
}
|
|
})
|
|
})
|
|
;(isNextDev ? describe : describe.skip)('invalid plugin name', () => {
|
|
const { next, skipped, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
overrideFiles: {
|
|
'next.config.js': `
|
|
module.exports = {
|
|
experimental: {
|
|
swcPlugins: [['@swc/plugin-nonexistent', {}]],
|
|
},
|
|
}`,
|
|
},
|
|
})
|
|
if (skipped) return
|
|
|
|
// eslint-disable-next-line jest/no-identical-title
|
|
it('shows a redbox in dev', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
if (isTurbopack) {
|
|
await expect(browser).toDisplayRedbox(`
|
|
{
|
|
"description": "Module not found: Can't resolve '@swc/plugin-nonexistent'",
|
|
"environmentLabel": null,
|
|
"label": "Build Error",
|
|
"source": "./
|
|
Error: Module not found: Can't resolve '@swc/plugin-nonexistent'
|
|
https://nextjs.org/docs/messages/module-not-found",
|
|
"stack": [],
|
|
}
|
|
`)
|
|
} else {
|
|
// TODO missing proper error with Webpack
|
|
await expect(browser).toDisplayRedbox(
|
|
`"Expected Redbox but found no visible one."`
|
|
)
|
|
}
|
|
})
|
|
})
|
|
})
|