|
1 | 1 | /* eslint-env jest */ |
2 | 2 |
|
3 | | -import { runNextCommand, runNextCommandDev, findPort } from 'next-test-utils' |
4 | | -import { join } from 'path' |
| 3 | +import { |
| 4 | + findPort, |
| 5 | + killApp, |
| 6 | + launchApp, |
| 7 | + runNextCommand, |
| 8 | + runNextCommandDev, |
| 9 | +} from 'next-test-utils' |
5 | 10 | import pkg from 'next/package' |
| 11 | +import { join } from 'path' |
6 | 12 | jest.setTimeout(1000 * 60 * 5) |
7 | 13 |
|
8 | 14 | const dir = join(__dirname, '..') |
| 15 | +const dirOldReact = join(__dirname, '../old-react') |
| 16 | +const dirOldReactDom = join(__dirname, '../old-react-dom') |
9 | 17 |
|
10 | 18 | describe('CLI Usage', () => { |
11 | 19 | describe('no command', () => { |
@@ -176,6 +184,44 @@ describe('CLI Usage', () => { |
176 | 184 | }) |
177 | 185 | expect(stderr).not.toContain('UnhandledPromiseRejectionWarning') |
178 | 186 | }) |
| 187 | + |
| 188 | + test('too old of react version', async () => { |
| 189 | + const port = await findPort() |
| 190 | + |
| 191 | + let stderr = '' |
| 192 | + let instance = await launchApp(dirOldReact, port, { |
| 193 | + stderr: true, |
| 194 | + onStderr(msg) { |
| 195 | + stderr += msg |
| 196 | + }, |
| 197 | + }) |
| 198 | + |
| 199 | + expect(stderr).toMatch( |
| 200 | + 'Fast Refresh is disabled in your application due to an outdated `react` version' |
| 201 | + ) |
| 202 | + expect(stderr).not.toMatch(`react-dom`) |
| 203 | + |
| 204 | + await killApp(instance) |
| 205 | + }) |
| 206 | + |
| 207 | + test('too old of react-dom version', async () => { |
| 208 | + const port = await findPort() |
| 209 | + |
| 210 | + let stderr = '' |
| 211 | + let instance = await launchApp(dirOldReactDom, port, { |
| 212 | + stderr: true, |
| 213 | + onStderr(msg) { |
| 214 | + stderr += msg |
| 215 | + }, |
| 216 | + }) |
| 217 | + |
| 218 | + expect(stderr).toMatch( |
| 219 | + 'Fast Refresh is disabled in your application due to an outdated `react-dom` version' |
| 220 | + ) |
| 221 | + expect(stderr).not.toMatch('`react`') |
| 222 | + |
| 223 | + await killApp(instance) |
| 224 | + }) |
179 | 225 | }) |
180 | 226 |
|
181 | 227 | describe('export', () => { |
|
0 commit comments