MCPcopy
hub / github.com/vercel/next.js / getData

Function getData

test/integration/gip-identifier/test/index.test.ts:24–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23const runTests = (isDev: boolean) => {
24 const getData = async () => {
25 if (isDev) {
26 appPort = await findPort()
27 app = await launchApp(appDir, appPort)
28 } else {
29 const { code } = await nextBuild(appDir)
30 if (code !== 0) throw new Error(`build faild, exit code: ${code}`)
31 appPort = await findPort()
32 app = await nextStart(appDir, appPort)
33 }
34 const html = await renderViaHTTP(appPort, '/')
35 await killApp(app)
36 const $ = cheerio.load(html)
37 return JSON.parse($('#__NEXT_DATA__').text())
38 }
39
40 it('should not have gip or appGip in NEXT_DATA for page without getInitialProps', async () => {
41 const data = await getData()

Callers 1

runTestsFunction · 0.70

Calls 10

findPortFunction · 0.90
launchAppFunction · 0.90
nextBuildFunction · 0.90
nextStartFunction · 0.90
renderViaHTTPFunction · 0.90
killAppFunction · 0.90
loadMethod · 0.65
textMethod · 0.65
$Function · 0.50
parseMethod · 0.45

Tested by

no test coverage detected