|
1 | 1 | import { load } from 'cheerio' |
2 | 2 | import { getLogger } from 'lambda-local' |
3 | | -import { cp } from 'node:fs/promises' |
4 | 3 | import { HttpResponse, http, passthrough } from 'msw' |
5 | 4 | import { setupServer } from 'msw/node' |
6 | 5 | import { v4 } from 'uuid' |
7 | | -import { Mock, afterAll, afterEach, beforeAll, beforeEach, expect, test, vi } from 'vitest' |
| 6 | +import { afterAll, afterEach, beforeAll, beforeEach, expect, test, vi } from 'vitest' |
8 | 7 | import { type FixtureTestContext } from '../utils/contexts.js' |
9 | 8 | import { createFixture, invokeFunction, runPlugin } from '../utils/fixture.js' |
10 | 9 | import { generateRandomObjectID, startMockBlobStore } from '../utils/helpers.js' |
| 10 | +import { nextVersionSatisfies } from '../utils/next-version-helpers.mjs' |
11 | 11 |
|
12 | 12 | vi.mock('node:fs/promises', async (importOriginal) => { |
13 | 13 | const fsPromisesModule = (await importOriginal()) as typeof import('node:fs/promises') |
@@ -61,12 +61,17 @@ afterEach(() => { |
61 | 61 | vi.unstubAllEnvs() |
62 | 62 | }) |
63 | 63 |
|
64 | | -test<FixtureTestContext>('Test that the hello-world-turbopack next app is working', async (ctx) => { |
65 | | - await createFixture('hello-world-turbopack', ctx) |
66 | | - await runPlugin(ctx) |
| 64 | +// https://github.com/vercel/next.js/pull/77808 makes turbopack builds no longer gated only to canaries |
| 65 | +// allowing to run this test on both stable and canary versions of Next.js |
| 66 | +test.skipIf(!nextVersionSatisfies('>=15.3.0-canary.43'))<FixtureTestContext>( |
| 67 | + 'Test that the hello-world-turbopack next app is working', |
| 68 | + async (ctx) => { |
| 69 | + await createFixture('hello-world-turbopack', ctx) |
| 70 | + await runPlugin(ctx) |
67 | 71 |
|
68 | | - // test the function call |
69 | | - const home = await invokeFunction(ctx) |
70 | | - expect(home.statusCode).toBe(200) |
71 | | - expect(load(home.body)('h1').text()).toBe('Hello, Next.js!') |
72 | | -}) |
| 72 | + // test the function call |
| 73 | + const home = await invokeFunction(ctx) |
| 74 | + expect(home.statusCode).toBe(200) |
| 75 | + expect(load(home.body)('h1').text()).toBe('Hello, Next.js!') |
| 76 | + }, |
| 77 | +) |
0 commit comments