/
index.test.ts
52 lines (46 loc) · 1.15 KB
/
index.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* eslint-env jest */
import {
killApp,
findPort,
nextStart,
nextBuild,
launchApp,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { join } from 'path'
const appDir = join(__dirname, '../')
let appPort
let app
function runTests() {
// This feature was added in PR #31065.
// Skip this test until we promote `next/future/image` from
// experimental to stable status.
it.skip('should apply image config for node_modules', async () => {
const browser = await webdriver(appPort, '/')
const src = await browser
.elementById('image-from-node-modules')
.getAttribute('src')
expect(src).toMatch('i.imgur.com')
})
}
describe('Future Image from node_modules prod mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
runTests()
})
describe('Future Image from node_modules dev mode', () => {
beforeAll(async () => {
appPort = await findPort()
app = await launchApp(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
runTests()
})