Unverified Commit 014a2549 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Move all files to .ts (5/6) (#85640)

parent 15d0fd47
......@@ -791,7 +791,7 @@ jobs:
--concurrency 4 \
test/production/pages-dir/production/test/index.test.ts \
test/integration/css-client-nav/test/index.test.ts \
test/integration/rewrites-has-condition/test/index.test.js \
test/integration/rewrites-has-condition/test/index.test.ts \
test/integration/create-next-app/index.test.ts \
test/integration/create-next-app/package-manager/pnpm.test.ts
stepName: 'test-integration-windows'
......
......@@ -41,11 +41,11 @@ describe('Read-only source HMR', () => {
appPort = await findPort()
app = await launchApp(appDir, appPort, {
env: {
__NEXT_TEST_WITH_DEVTOOL: 1,
__NEXT_TEST_WITH_DEVTOOL: '1',
// Events can be finicky in CI. This switches to a more reliable
// polling method.
CHOKIDAR_USEPOLLING: 'true',
CHOKIDAR_INTERVAL: 500,
CHOKIDAR_INTERVAL: '500',
},
})
})
......
......@@ -412,7 +412,7 @@ function runTests({ isDev = false, isExport = false, isPages404 = false }) {
describe('404 handling', () => {
let nextOpts = {}
beforeAll(async () => {
const hasLocalNext = await fs.exists(join(appDir, 'node_modules/next'))
const hasLocalNext = fs.existsSync(join(appDir, 'node_modules/next'))
if (hasLocalNext) {
nextOpts = {
......
......@@ -77,10 +77,10 @@ describe('Required Server Files', () => {
for (const file of requiredFilesManifest.files) {
console.log('checking', file)
expect(await fs.exists(join(appDir, file))).toBe(true)
expect(fs.existsSync(join(appDir, file))).toBe(true)
}
expect(await fs.exists(join(appDir, '.next/server'))).toBe(true)
expect(fs.existsSync(join(appDir, '.next/server'))).toBe(true)
})
it('should render SSR page correctly', async () => {
......
......@@ -44,7 +44,7 @@ describe('next/dynamic', () => {
})
afterAll(() => killApp(app))
runTests(true)
runTests()
}
)
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
......
......@@ -33,17 +33,17 @@ const runTests = () => {
expect(scrollX).not.toBe(0)
expect(scrollY).not.toBe(0)
await browser.eval(() => window.next.router.push('/another'))
await browser.eval(() => (window as any).next.router.push('/another'))
await retry(async () => {
const html = await browser.eval(() => document.documentElement.innerHTML)
expect(html).toMatch(/hi from another/)
})
await browser.eval(() => (window.didHydrate = false))
await browser.eval(() => ((window as any).didHydrate = false))
await browser.eval(() => window.history.back())
await retry(async () => {
expect(await browser.eval(() => window.didHydrate)).toBe(true)
expect(await browser.eval(() => (window as any).didHydrate)).toBe(true)
})
const newScrollX = Math.floor(await browser.eval(() => window.scrollX))
......
......@@ -47,14 +47,10 @@ const runTests = () => {
/hi from another/
)
await browser.eval(() => (window.didHydrate = false))
await browser.eval(() => ((window as any).didHydrate = false))
await browser.eval(() => window.history.forward())
await check(() => browser.eval(() => window.didHydrate), {
test(content) {
return content
},
})
await check(() => browser.eval(() => (window as any).didHydrate), true)
const newScrollX = Math.floor(await browser.eval(() => window.scrollX))
const newScrollY = Math.floor(await browser.eval(() => window.scrollY))
......
......@@ -14,7 +14,7 @@ let app
let appPort
const appDir = join(__dirname, '../')
function runTests(dev) {
function runTests(dev: boolean) {
it('should render from pages', async () => {
const html = await renderViaHTTP(appPort, '/')
expect(html).toMatch(/PAGES/)
......@@ -50,7 +50,7 @@ describe('Dynamic Routing', () => {
})
afterAll(() => killApp(app))
runTests()
runTests(false)
}
)
})
......@@ -85,7 +85,7 @@ describe('Dynamic Routing', () => {
})
afterAll(() => killApp(app))
runTests(true)
runTests()
}
)
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
......
......@@ -78,7 +78,7 @@ describe('SSG data 404', () => {
proxy.web(req, res)
})
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
proxyServer.listen(proxyPort, () => resolve())
})
})
......@@ -120,7 +120,7 @@ describe('SSG data 404', () => {
})
})
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
proxyServer.listen(proxyPort, () => resolve())
})
})
......
......@@ -42,7 +42,7 @@ describe('Custom 404 Page for static site generation with dynamic routes', () =>
app = await nextStart(appDir, appPort)
})
runTests('server')
runTests()
}
)
;(process.env.TURBOPACK_BUILD ? describe.skip : describe)(
......@@ -54,7 +54,7 @@ describe('Custom 404 Page for static site generation with dynamic routes', () =>
})
afterAll(() => killApp(app))
runTests('dev')
runTests()
}
)
})
......@@ -23,7 +23,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -53,7 +53,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -101,7 +101,7 @@ describe('config telemetry', () => {
stderr2 += msg || ''
},
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await check(() => stderr2, /NEXT_CLI_SESSION_STARTED/)
......@@ -142,7 +142,7 @@ describe('config telemetry', () => {
try {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
try {
......@@ -166,7 +166,7 @@ describe('config telemetry', () => {
async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
const featureUsageEvents = findAllTelemetryEvents(
stderr,
......@@ -210,7 +210,7 @@ describe('config telemetry', () => {
)
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
path.join(appDir, 'next.config.js'),
......@@ -268,7 +268,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -294,7 +294,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -320,7 +320,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -346,7 +346,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.remove(path.join(appDir, 'middleware.js'))
......@@ -378,7 +378,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -416,7 +416,7 @@ describe('config telemetry', () => {
async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
const featureUsageEvents = findAllTelemetryEvents(
stderr,
......@@ -443,7 +443,7 @@ describe('config telemetry', () => {
async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
const featureUsageEvents = findAllTelemetryEvents(
stderr,
......@@ -468,7 +468,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -499,7 +499,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -527,7 +527,7 @@ describe('config telemetry', () => {
it('emits telemetry for default React Compiler options', async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
try {
......@@ -554,7 +554,7 @@ describe('config telemetry', () => {
try {
const app = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
stderr = app.stderr
const event = /NEXT_CLI_SESSION_STARTED[\s\S]+?{([\s\S]+?)}/
......@@ -585,7 +585,7 @@ describe('config telemetry', () => {
try {
const app = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
stderr = app.stderr
const event = /NEXT_CLI_SESSION_STARTED[\s\S]+?{([\s\S]+?)}/
......@@ -623,7 +623,7 @@ describe('config telemetry', () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -662,7 +662,7 @@ describe('config telemetry', () => {
try {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
try {
......@@ -697,7 +697,7 @@ describe('config telemetry', () => {
try {
app = await launchApp(appDir, await findPort(), {
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
onStderr(msg) {
stderr += msg || ''
},
......@@ -733,7 +733,7 @@ describe('config telemetry', () => {
try {
const app = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
stderr = app.stderr
......@@ -761,7 +761,7 @@ describe('config telemetry', () => {
try {
const app = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
stderr = app.stderr
......
......@@ -105,7 +105,7 @@ describe('Telemetry CLI', () => {
env: {
// block swc from loading
NODE_OPTIONS: '--no-addons',
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
expect(stderr).toMatch(/NEXT_SWC_LOAD_FAILURE/)
......@@ -125,7 +125,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -148,7 +148,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -173,7 +173,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
......@@ -195,7 +195,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -221,7 +221,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -247,7 +247,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -273,7 +273,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -299,7 +299,7 @@ describe('Telemetry CLI', () => {
const { stderr } = await runNextCommand(['build', appDir], {
stderr: true,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
await fs.rename(
......@@ -337,7 +337,7 @@ describe('Telemetry CLI', () => {
it('detect static 404 correctly for `next build`', async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
......@@ -349,7 +349,7 @@ describe('Telemetry CLI', () => {
it('detect page counts correctly for `next build`', async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
......
......@@ -23,7 +23,7 @@ describe('page features telemetry', () => {
let app = await launchApp(appDir, port, {
onStderr: handleStderr,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
turbo: true,
})
......@@ -58,7 +58,7 @@ describe('page features telemetry', () => {
let app = await launchApp(appDir, port, {
onStderr: handleStderr,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
turbo: true,
})
......@@ -94,7 +94,7 @@ describe('page features telemetry', () => {
let app = await launchApp(appDir, port, {
onStderr: handleStderr,
env: {
NEXT_TELEMETRY_DEBUG: 1,
NEXT_TELEMETRY_DEBUG: '1',
},
})
......@@ -163,7 +163,7 @@ describe('page features telemetry', () => {
)
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
try {
......@@ -198,7 +198,7 @@ describe('page features telemetry', () => {
let build = await nextBuild(appDir, [], {
stderr: 'log',
stdout: 'log',
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
expect(build.stderr).toContain('NEXT_BUILD_OPTIMIZED')
......@@ -222,7 +222,7 @@ describe('page features telemetry', () => {
const build = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......@@ -256,7 +256,7 @@ describe('page features telemetry', () => {
const build = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
env: { NEXT_TELEMETRY_DEBUG: '1' },
})
await fs.rename(
......
......@@ -15,7 +15,7 @@ let app
let appPort
const appDir = join(__dirname, '../')
const runTests = (dev) => {
const runTests = (dev: boolean) => {
it('should route to /blog/another/ correctly', async () => {
const browser = await webdriver(appPort, '/')
await browser.elementByCss('#to-blog-another').click()
......@@ -115,7 +115,7 @@ describe('href resolving trailing-slash', () => {
})
afterAll(() => killApp(app))
runTests()
runTests(false)
}
)
})
/* eslint-env jest */
import { createFile, exists, readFile, writeFile, remove } from 'fs-extra'
import { createFile, existsSync, readFile, writeFile, remove } from 'fs-extra'
import { nextBuild } from 'next-test-utils'
import path from 'path'
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
......@@ -21,7 +21,7 @@ import path from 'path'
})
it('Creates a default tsconfig.json when one is missing', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
const { code } = await nextBuild(appDir)
expect(code).toBe(0)
expect(await readFile(tsConfig, 'utf8')).toMatchInlineSnapshot(`
......@@ -68,7 +68,7 @@ import path from 'path'
})
it('Works with an empty tsconfig.json (docs)', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await createFile(tsConfig)
await new Promise((resolve) => setTimeout(resolve, 500))
......@@ -125,7 +125,7 @@ import path from 'path'
})
it('Updates an existing tsconfig.json without losing comments', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -202,7 +202,7 @@ import path from 'path'
})
it('allows you to set commonjs module mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -256,7 +256,7 @@ import path from 'path'
})
it('allows you to set es2020 module mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -310,7 +310,7 @@ import path from 'path'
})
it('allows you to set node16 moduleResolution mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -368,7 +368,7 @@ import path from 'path'
})
it('allows you to set bundler moduleResolution mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -426,7 +426,7 @@ import path from 'path'
})
it('allows you to set target mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(tsConfig, `{ "compilerOptions": { "target": "es2022" } }`)
await new Promise((resolve) => setTimeout(resolve, 500))
......@@ -481,7 +481,7 @@ import path from 'path'
})
it('allows you to set node16 module mode', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -539,7 +539,7 @@ import path from 'path'
})
it('allows you to set verbatimModuleSyntax true without adding isolatedModules', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......@@ -597,8 +597,8 @@ import path from 'path'
})
it('allows you to set verbatimModuleSyntax true via extends without adding isolatedModules', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(await exists(tsConfigBase)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
expect(existsSync(tsConfigBase)).toBe(false)
await writeFile(
tsConfigBase,
......@@ -655,8 +655,8 @@ import path from 'path'
})
it('allows you to extend another configuration file', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(await exists(tsConfigBase)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
expect(existsSync(tsConfigBase)).toBe(false)
await writeFile(
tsConfigBase,
......@@ -718,8 +718,8 @@ import path from 'path'
})
it('creates compilerOptions when you extend another config', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(await exists(tsConfigBase)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
expect(existsSync(tsConfigBase)).toBe(false)
await writeFile(
tsConfigBase,
......@@ -781,7 +781,7 @@ import path from 'path'
// TODO: Enable this test when repo has upgraded to TypeScript 5.4. Currently tested as E2E: tsconfig-module-preserve
it.skip('allows you to skip moduleResolution, esModuleInterop and resolveJsonModule when using "module: preserve"', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(existsSync(tsConfig)).toBe(false)
await writeFile(
tsConfig,
......
......@@ -13,10 +13,7 @@ describe('typeof window replace', () => {
() => {
beforeAll(async () => {
await nextBuild(appDir)
buildManifest = require(path.join(
appDir,
'.next/build-manifest.json'
), 'utf8')
buildManifest = require(path.join(appDir, '.next/build-manifest.json'))
})
it('Replaces `typeof window` with object for client code', async () => {
......@@ -40,6 +37,7 @@ describe('typeof window replace', () => {
const allFilesInDotNextServerChunks = await fs
.readdirSync(chunksFilesDir, {
recursive: true,
encoding: 'utf-8',
})
.filter((item) => item.endsWith('.js'))
for (const file of allFilesInDotNextServerChunks) {
......@@ -54,6 +52,7 @@ describe('typeof window replace', () => {
const allFilesInDotNextServerPages = await fs
.readdirSync(pagesFilesDir, {
recursive: true,
encoding: 'utf-8',
})
.filter((item) => item.endsWith('.js'))
for (const file of allFilesInDotNextServerPages) {
......
......@@ -8,7 +8,7 @@ const appDir = join(__dirname, '..')
let appPort
let app
async function get$(path, query) {
async function get$(path, query?: any) {
const html = await renderViaHTTP(appPort, path, query)
return cheerio.load(html)
}
......
......@@ -8,7 +8,7 @@ const appDir = join(__dirname, '..')
let appPort
let app
async function get$(path, query) {
async function get$(path, query?: any) {
const html = await renderViaHTTP(appPort, path, query)
return cheerio.load(html)
}
......
......@@ -21,7 +21,7 @@ const handleOutput = (msg) => {
output += msg
}
async function get$(path, query, options) {
async function get$(path, query?: any, options?: any) {
const html = await renderViaHTTP(appPort, path, query, options)
return cheerio.load(html)
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment