Skip to content

Commit b0cc3cd

Browse files
authored
chore: reenable skipped windows tests that were skipped in the meantime (#306)
* chore: reenable windows test that was fixed in the meantime * chore: also reenable wasm tests * chore: and also the page router tests * chore: and also the cache handler tests * chore: and also edge handler! this is getting better and better * fix: place temp dirs on same drive * chore: remove unused imports * fix: skip one test
1 parent d06ca25 commit b0cc3cd

File tree

8 files changed

+32
-40
lines changed

8 files changed

+32
-40
lines changed

.github/workflows/run-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,4 @@ jobs:
107107
run: npm run test:ci -- --shard=${{ matrix.shard }}
108108
env:
109109
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
110+
TEMP: ${{ github.workspace }}/..

tests/integration/build/copy-next-code.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { copyNextServerCode } from '../../../src/build/content/server.js'
77
import { PluginContext } from '../../../src/build/plugin-context.js'
88
import { FixtureTestContext, createFsFixture } from '../../utils/fixture.js'
99
import { readFile, readdir } from 'node:fs/promises'
10-
import { platform } from 'node:process'
1110

1211
test<FixtureTestContext>('should copy the next standalone folder correctly for a simple site', async (ctx) => {
1312
const reqServerFiles = JSON.stringify({ config: { distDir: '.next' } })

tests/integration/cache-handler.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
getBlobEntries,
1717
startMockBlobStore,
1818
} from '../utils/helpers.js'
19-
import { platform } from 'node:process'
2019

2120
// Disable the verbose logging of the lambda-local runtime
2221
getLogger().level = 'alert'
@@ -35,7 +34,7 @@ beforeEach<FixtureTestContext>(async (ctx) => {
3534
})
3635

3736
describe('page router', () => {
38-
test.skipIf(platform === 'win32')<FixtureTestContext>('page router with static revalidate', async (ctx) => {
37+
test<FixtureTestContext>('page router with static revalidate', async (ctx) => {
3938
await createFixture('page-router', ctx)
4039
console.time('runPlugin')
4140
await runPlugin(ctx)

tests/integration/edge-handler.test.ts

+15-22
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from '../utils/fixture.js'
99
import { generateRandomObjectID, startMockBlobStore } from '../utils/helpers.js'
1010
import { LocalServer } from '../utils/local-server.js'
11-
import { platform } from 'process'
1211

1312
beforeEach<FixtureTestContext>(async (ctx) => {
1413
// set for each test a new deployID and siteID
@@ -19,11 +18,9 @@ beforeEach<FixtureTestContext>(async (ctx) => {
1918
await startMockBlobStore(ctx)
2019
})
2120

22-
test.skipIf(platform === 'win32')<FixtureTestContext>(
23-
'should add request/response headers',
24-
async (ctx) => {
25-
await createFixture('middleware', ctx)
26-
await runPlugin(ctx)
21+
test<FixtureTestContext>('should add request/response headers', async (ctx) => {
22+
await createFixture('middleware', ctx)
23+
await runPlugin(ctx)
2724

2825
const origin = await LocalServer.run(async (req, res) => {
2926
expect(req.url).toBe('/test/next')
@@ -50,11 +47,9 @@ test.skipIf(platform === 'win32')<FixtureTestContext>(
5047
},
5148
)
5249

53-
test.skipIf(platform === 'win32')<FixtureTestContext>(
54-
'should add request/response headers when using src dir',
55-
async (ctx) => {
56-
await createFixture('middleware-src', ctx)
57-
await runPlugin(ctx)
50+
test<FixtureTestContext>('should add request/response headers when using src dir', async (ctx) => {
51+
await createFixture('middleware-src', ctx)
52+
await runPlugin(ctx)
5853

5954
const origin = await LocalServer.run(async (req, res) => {
6055
expect(req.url).toBe('/test/next')
@@ -81,7 +76,7 @@ test.skipIf(platform === 'win32')<FixtureTestContext>(
8176
},
8277
)
8378

84-
describe.skipIf(platform === 'win32')('redirect', () => {
79+
describe('redirect', () => {
8580
test<FixtureTestContext>('should return a redirect response', async (ctx) => {
8681
await createFixture('middleware', ctx)
8782
await runPlugin(ctx)
@@ -130,7 +125,7 @@ describe.skipIf(platform === 'win32')('redirect', () => {
130125
})
131126
})
132127

133-
describe.skipIf(platform === 'win32')('rewrite', () => {
128+
describe('rewrite', () => {
134129
test<FixtureTestContext>('should rewrite to an external URL', async (ctx) => {
135130
await createFixture('middleware', ctx)
136131
await runPlugin(ctx)
@@ -190,12 +185,10 @@ describe.skipIf(platform === 'win32')('rewrite', () => {
190185
})
191186
})
192187

193-
describe.skipIf(platform === 'win32')(
194-
"aborts middleware execution when the matcher conditions don't match the request",
195-
() => {
196-
test<FixtureTestContext>('when the path is excluded', async (ctx) => {
197-
await createFixture('middleware', ctx)
198-
await runPlugin(ctx)
188+
describe("aborts middleware execution when the matcher conditions don't match the request", () => {
189+
test<FixtureTestContext>('when the path is excluded', async (ctx) => {
190+
await createFixture('middleware', ctx)
191+
await runPlugin(ctx)
199192

200193
const origin = await LocalServer.run(async (req, res) => {
201194
expect(req.url).toBe('/_next/data')
@@ -238,8 +231,8 @@ describe.skipIf(platform === 'win32')(
238231
functions: ['___netlify-edge-handler-middleware'],
239232
origin,
240233
url: '/foo',
241-
})
242-
234+
})
235+
243236
expect(await response1.text()).toBe('Hello from origin!')
244237
expect(response1.status).toBe(200)
245238
expect(response1.headers.has('x-hello-from-middleware-res')).toBeTruthy()
@@ -305,7 +298,7 @@ describe.skipIf(platform === 'win32')(
305298
},
306299
)
307300

308-
describe.skipIf(platform === 'win32')('should run middleware on data requests', () => {
301+
describe('should run middleware on data requests', () => {
309302
test<FixtureTestContext>('when `trailingSlash: false`', async (ctx) => {
310303
await createFixture('middleware', ctx)
311304
await runPlugin(ctx)

tests/integration/page-router.test.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test<FixtureTestContext>('Should add pathname to cache-tags for pages route', as
6363
expect(staticFetch1.headers?.['netlify-cache-tag']).toBe('_N_T_/static/revalidate-manual')
6464
})
6565

66-
test.skipIf(platform === 'win32')<FixtureTestContext>('Should revalidate path with On-demand Revalidation', async (ctx) => {
66+
test<FixtureTestContext>('Should revalidate path with On-demand Revalidation', async (ctx) => {
6767
await createFixture('page-router', ctx)
6868
await runPlugin(ctx)
6969

@@ -115,14 +115,17 @@ test<FixtureTestContext>('Should return JSON for data req to page route', async
115115
expect(data.pageProps.show).toBeDefined()
116116
})
117117

118-
test.skipIf(platform === "win32")<FixtureTestContext>('Should set permanent "netlify-cdn-cache-control" header on fully static pages"', async (ctx) => {
119-
await createFixture('page-router', ctx)
120-
await runPlugin(ctx)
118+
test.skipIf(platform === 'win32')<FixtureTestContext>(
119+
'Should set permanent "netlify-cdn-cache-control" header on fully static pages"',
120+
async (ctx) => {
121+
await createFixture('page-router', ctx)
122+
await runPlugin(ctx)
121123

122-
const response = await invokeFunction(ctx, {
123-
url: '/static/fully-static',
124-
})
124+
const response = await invokeFunction(ctx, {
125+
url: '/static/fully-static',
126+
})
125127

126-
expect(response.headers?.['netlify-cdn-cache-control']).toBe('max-age=31536000')
127-
expect(response.headers?.['cache-control']).toBe('public, max-age=0, must-revalidate')
128-
})
128+
expect(response.headers?.['netlify-cdn-cache-control']).toBe('max-age=31536000')
129+
expect(response.headers?.['cache-control']).toBe('public, max-age=0, must-revalidate')
130+
},
131+
)

tests/integration/request-context.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type { CacheHandler } from 'next/dist/server/lib/incremental-cache/index.
1818
import { SERVER_HANDLER_NAME } from '../../src/build/plugin-context.js'
1919
import { realpathSync } from 'node:fs'
2020
import { join } from 'node:path'
21-
import { platform } from 'node:process'
2221

2322
// Disable the verbose logging of the lambda-local runtime
2423
getLogger().level = 'alert'
@@ -85,7 +84,7 @@ function spyOnRequestContext(ctx: FixtureTestContext) {
8584
return mockedRequestContextModule.getRequestContext
8685
}
8786

88-
describe.skipIf(platform === 'win32')(
87+
describe(
8988
'request-context does NOT leak between concurrent requests',
9089
() => {
9190
test<FixtureTestContext>('pages router', async (ctx) => {

tests/integration/static.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
getBlobEntries,
1919
startMockBlobStore,
2020
} from '../utils/helpers.js'
21-
import { platform } from 'node:process'
2221

2322
// Disable the verbose logging of the lambda-local runtime
2423
getLogger().level = 'alert'

tests/integration/wasm.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from '../utils/fixture.js'
1212
import { generateRandomObjectID, startMockBlobStore } from '../utils/helpers.js'
1313
import { LocalServer } from '../utils/local-server.js'
14-
import { platform } from 'node:process'
1514

1615
// Disable the verbose logging of the lambda-local runtime
1716
getLogger().level = 'alert'
@@ -28,7 +27,7 @@ beforeEach<FixtureTestContext>(async (ctx) => {
2827
await startMockBlobStore(ctx)
2928
})
3029

31-
describe.skipIf(platform === 'win32')('WASM', () => {
30+
describe('WASM', () => {
3231
beforeEach<FixtureTestContext>(async (ctx) => {
3332
// set for each test a new deployID and siteID
3433
ctx.deployID = generateRandomObjectID()

0 commit comments

Comments
 (0)