-
Notifications
You must be signed in to change notification settings - Fork 27.3k
/
webpack-error.test.ts
32 lines (29 loc) · 1.03 KB
/
webpack-error.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* eslint-env jest */
import { nextTestSetup } from 'e2e-utils'
describe('SCSS Support', () => {
const { next, isNextDev } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
// Production only test
;(isNextDev ? describe.skip : describe)('Friendly Webpack Error', () => {
it('should be a friendly error successfully', async () => {
const { exitCode, cliOutput } = await next.build()
expect(exitCode).toBe(1)
expect(cliOutput).toContain('./styles/global.scss')
expect(cliOutput).toContain(
"To use Next.js' built-in Sass support, you first need to install `sass`."
)
expect(cliOutput).toContain(
'Run `npm i sass` or `yarn add sass` inside your workspace.'
)
expect(cliOutput).toContain(
'Learn more: https://nextjs.org/docs/messages/install-sass'
)
expect(cliOutput).toContain('Failed to compile.')
expect(cliOutput).not.toContain('css-loader')
expect(cliOutput).not.toContain('sass-loader')
})
})
})