mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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>
73 lines
3.0 KiB
TypeScript
73 lines
3.0 KiB
TypeScript
/* eslint-env jest */
|
||
|
||
import { isNextStart, nextTestSetup } from 'e2e-utils'
|
||
import { waitForRedbox, getRedboxSource } from 'next-test-utils'
|
||
|
||
describe('CSS Import from node_modules', () => {
|
||
const { next, skipped, isTurbopack, isRspack } = nextTestSetup({
|
||
files: __dirname,
|
||
skipStart: isNextStart,
|
||
skipDeployment: true,
|
||
dependencies: { sass: '1.54.0' },
|
||
})
|
||
|
||
if (skipped) {
|
||
return
|
||
}
|
||
|
||
if (isNextStart) {
|
||
it('should fail the build', async () => {
|
||
const { exitCode, cliOutput } = await next.build()
|
||
expect(exitCode).not.toBe(0)
|
||
if (isRspack) {
|
||
expect(cliOutput).toMatch(
|
||
/RspackResolver\(NotFound\(\\?"nprogress\/nprogress.css\\?"\)\)/
|
||
)
|
||
} else {
|
||
expect(cliOutput).toMatch(/Can't resolve '[^']*?nprogress[^']*?'/)
|
||
}
|
||
expect(cliOutput).toMatch(/Build failed|Build error occurred/)
|
||
})
|
||
} else {
|
||
it('should show a build error', async () => {
|
||
const browser = await next.browser('/')
|
||
|
||
await waitForRedbox(browser)
|
||
const errorSource = await getRedboxSource(browser)
|
||
|
||
if (isTurbopack) {
|
||
expect(errorSource).toMatchInlineSnapshot(`
|
||
"./styles/global.scss.css (1:9)
|
||
Error: Module not found: Can't resolve 'nprogress/nprogress.css'
|
||
> 1 | @import 'nprogress/nprogress.css';
|
||
| ^
|
||
2 |
|
||
|
||
Import trace:
|
||
Browser:
|
||
./styles/global.scss.css
|
||
./pages/_app.js
|
||
|
||
https://nextjs.org/docs/messages/module-not-found"
|
||
`)
|
||
} else if (isRspack) {
|
||
expect(errorSource).toMatchInlineSnapshot(`
|
||
"./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[9].oneOf[14].use[1]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[9].oneOf[14].use[2]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[9].oneOf[14].use[3]!./node_modules/.pnpm/next@file+..+next-repo-8fa5cfcca6029b56fbac0f566cc3851341e4c064ae33fb2a225547c1fab39f23+packa_apujtevk23v6mt6lxsvypt6azu/node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[9].oneOf[14].use[4]!./styles/global.scss
|
||
╰─▶ × Error: RspackResolver(NotFound("nprogress/nprogress.css"))"
|
||
`)
|
||
} else {
|
||
expect(errorSource).toMatchInlineSnapshot(`
|
||
"./styles/global.scss
|
||
Module not found: Can't resolve 'nprogress/nprogress.css'
|
||
|
||
https://nextjs.org/docs/messages/module-not-found
|
||
|
||
Import trace for requested module:
|
||
./styles/global.scss
|
||
./pages/_app.js"
|
||
`)
|
||
}
|
||
})
|
||
}
|
||
})
|