rsnext/test/development/acceptance-app/ReactRefreshLogBox-scss.test.ts
Jiachi Liu 20f5db06fa
Update precompiled react to next channel (#41708)
Precompile `react@next` and to unlock `cache` and `use` API
2022-10-24 00:31:52 -07:00

64 lines
1.7 KiB
TypeScript

/* eslint-env jest */
import { sandbox } from './helpers'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import path from 'path'
// TODO: figure out why snapshots mismatch on GitHub actions
// specifically but work in docker and locally
describe.skip('ReactRefreshLogBox app', () => {
if (process.env.NEXT_TEST_REACT_VERSION === '^17') {
it('should skip for react v17', () => {})
return
}
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
skipStart: true,
dependencies: {
sass: 'latest',
react: 'latest',
'react-dom': 'latest',
},
})
})
afterAll(() => next.destroy())
test('scss syntax errors', async () => {
const { session, cleanup } = await sandbox(next)
await session.write('index.module.scss', `.button { font-size: 5px; }`)
await session.patch(
'index.js',
`
import './index.module.scss';
export default () => {
return (
<div>
<p>lol</p>
</div>
)
}
`
)
expect(await session.hasRedbox()).toBe(false)
// Syntax error
await session.patch('index.module.scss', `.button { font-size: :5px; }`)
expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource()
expect(source).toMatchSnapshot()
// Not local error
await session.patch('index.module.scss', `button { font-size: 5px; }`)
expect(await session.hasRedbox(true)).toBe(true)
const source2 = await session.getRedboxSource()
expect(source2).toMatchSnapshot()
await cleanup()
})
})