Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9a08f25

Browse files
committed
test: wat2
1 parent 254d7bd commit 9a08f25

File tree

5 files changed

+50
-18
lines changed

5 files changed

+50
-18
lines changed

‎.github/workflows/run-tests.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ jobs:
8080
run: npm ci
8181
- name: 'Build'
8282
run: npm run build
83+
- name: 'Vendor deno helpers for integration tests'
84+
run: deno vendor eszip.ts
85+
working-directory: tools/deno
8386
- name: Resolve Next.js version
8487
id: resolve-next-version
8588
shell: bash

‎tests/integration/use-cache.test.ts‎

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,37 @@ describe.skipIf(!nextVersionSatisfies('>=15.3.0-canary.13'))('use cache', () =>
155155
// much more performant
156156
let ctx: FixtureTestContext
157157
beforeAll(async () => {
158-
ctx = {
159-
deployID: generateRandomObjectID(),
160-
siteID: v4(),
161-
} as FixtureTestContext
162-
163-
vi.stubEnv('SITE_ID', ctx.siteID)
164-
vi.stubEnv('DEPLOY_ID', ctx.deployID)
165-
vi.stubEnv('NETLIFY_PURGE_API_TOKEN', 'fake-token')
166-
await startMockBlobStore(ctx as FixtureTestContext)
167-
168-
await createFixture('use-cache', ctx)
169-
await runPlugin(ctx)
158+
console.log(`[${new Date().toISOString()}] Starting use-cache beforeAll`)
159+
try {
160+
ctx = {
161+
deployID: generateRandomObjectID(),
162+
siteID: v4(),
163+
} as FixtureTestContext
164+
ctx.debug = true
165+
166+
vi.stubEnv('SITE_ID', ctx.siteID)
167+
vi.stubEnv('DEPLOY_ID', ctx.deployID)
168+
vi.stubEnv('NETLIFY_PURGE_API_TOKEN', 'fake-token')
169+
await startMockBlobStore(ctx as FixtureTestContext)
170+
171+
await createFixture('use-cache', ctx)
172+
await runPlugin(ctx)
173+
console.log(`[${new Date().toISOString()}] Finished use-cache beforeAll`)
174+
} catch (err) {
175+
console.log(`[${new Date().toISOString()}] use-cache beforeAll failed`, err)
176+
throw err
177+
}
170178
})
171179

172180
afterAll(async () => {
173-
await afterTestCleanup(ctx)
181+
console.log(`[${new Date().toISOString()}] Finished use-cache afterAll`)
182+
try {
183+
await afterTestCleanup(ctx)
184+
console.log(`[${new Date().toISOString()}] Finished use-cache afterAll`)
185+
} catch (err) {
186+
console.log(`[${new Date().toISOString()}] use-cache afterAll failed`, err)
187+
throw err
188+
}
174189
})
175190

176191
describe('default (in-memory cache entries, shared tag manifests)', () => {

‎tests/utils/contexts.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export interface FixtureTestContext extends TestContext {
1616
edgeFunctionPort: number
1717
edgeFunctionOutput: WriteStream
1818
cleanup?: (() => Promise<void>)[]
19+
debug?: boolean
1920
}

‎tests/utils/fixture.ts‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,24 @@ export async function runPlugin(
293293
})
294294
const { asset } = result.manifest.bundles[0]
295295

296-
await execaCommand(`deno -v`, { cwd: dist, stdio: 'inherit' })
297-
await execaCommand(`deno info`, { cwd: dist, stdio: 'inherit' })
298-
await execaCommand(`which deno`, { cwd: dist, stdio: 'inherit' })
296+
if (ctx.debug) {
297+
await execaCommand(`deno -v`, { cwd: dist, stdio: 'inherit' })
298+
await execaCommand(`deno info`, { cwd: dist, stdio: 'inherit' })
299+
await execaCommand(`which deno`, { cwd: dist, stdio: 'inherit' })
299300

300-
const cmd = `deno run --allow-read --allow-write --allow-net --allow-env ${eszipHelper} extract ./${asset} .`
301-
await execaCommand(cmd, { cwd: dist })
301+
console.log(`[${new Date().toISOString()}] start to extract`, dist)
302+
}
303+
304+
try {
305+
const cmd = `deno run --allow-read --allow-write --allow-net --allow-env ${eszipHelper} extract ./${asset} .`
306+
await execaCommand(cmd, { cwd: dist })
307+
console.log(`[${new Date().toISOString()}] finished extracting`, dist)
308+
} catch (err) {
309+
if (ctx.debug) {
310+
console.log(`[${new Date().toISOString()}] failed extracting`, dist, err)
311+
}
312+
throw err
313+
}
302314

303315
// start the edge functions server:
304316
const servePath = base.resolveFromPackagePath('.netlify', 'edge-functions-serve')

‎tools/deno/deno.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /