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

Function getEnvFromHtml

test/integration/env-config/test/index.test.ts:23–31  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

21const appDir = join(__dirname, '../app')
22
23const getEnvFromHtml = async (path) => {
24 const html = await renderViaHTTP(appPort, path)
25 const $ = cheerio.load(html)
26 const env = JSON.parse($('p').text())
27 env.nextConfigEnv = $('#nextConfigEnv').text()
28 env.nextConfigPublicEnv = $('#nextConfigPublicEnv').text()
29 env.nextConfigNewPublicEnv = $('#nextConfigNewPublicEnv').text()
30 return env
31}
32
33const runTests = (mode = 'dev', didReload = false) => {
34 const isDevOnly = mode === 'dev'

Callers 1

runTestsFunction · 0.85

Calls 5

renderViaHTTPFunction · 0.90
loadMethod · 0.65
textMethod · 0.65
$Function · 0.50
parseMethod · 0.45

Tested by

no test coverage detected