Skip to content

Commit ffc7d04

Browse files
don't use installGlobals (#803)
1 parent d1293e9 commit ffc7d04

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

server/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import crypto from 'crypto'
22
import { createRequestHandler } from '@remix-run/express'
3-
import { type ServerBuild, installGlobals } from '@remix-run/node'
3+
import { type ServerBuild } from '@remix-run/node'
44
import { ip as ipAddress } from 'address'
55
import chalk from 'chalk'
66
import closeWithGrace from 'close-with-grace'
@@ -11,8 +11,6 @@ import getPort, { portNumbers } from 'get-port'
1111
import helmet from 'helmet'
1212
import morgan from 'morgan'
1313

14-
installGlobals()
15-
1614
const MODE = process.env.NODE_ENV ?? 'development'
1715
const IS_PROD = MODE === 'production'
1816
const IS_DEV = MODE === 'development'

tests/setup/custom-matchers.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ expect.extend({
7474
}
7575
},
7676
async toHaveSessionForUser(response: Response, userId: string) {
77-
const setCookies = getSetCookie(response.headers)
77+
const setCookies = response.headers.getSetCookie()
7878
const sessionSetCookie = setCookies.find(
7979
(c) => setCookieParser.parseString(c).name === 'en_session',
8080
)
@@ -115,7 +115,7 @@ expect.extend({
115115
}
116116
},
117117
async toSendToast(response: Response, toast: ToastInput) {
118-
const setCookies = getSetCookie(response.headers)
118+
const setCookies = response.headers.getSetCookie()
119119
const toastSetCookie = setCookies.find(
120120
(c) => setCookieParser.parseString(c).name === 'en_toast',
121121
)
@@ -164,11 +164,3 @@ declare module 'vitest' {
164164
interface Assertion<T = any> extends CustomMatchers<T> {}
165165
interface AsymmetricMatchersContaining extends CustomMatchers {}
166166
}
167-
168-
function getSetCookie(headers: Headers) {
169-
// this is a sort of polyfill for headers.getSetCookie
170-
// https://github.com/microsoft/TypeScript/issues/55270
171-
// https://github.com/remix-run/remix/issues/7067
172-
// @ts-expect-error see the two issues above
173-
return headers.getAll('set-cookie') as Array<string>
174-
}

tests/setup/setup-test-env.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import './db-setup.ts'
33
import '#app/utils/env.server.ts'
44
// we need these to be imported first 👆
55

6-
import { installGlobals } from '@remix-run/node'
76
import { cleanup } from '@testing-library/react'
87
import { afterEach, beforeEach, vi, type MockInstance } from 'vitest'
98
import { server } from '#tests/mocks/index.ts'
109
import './custom-matchers.ts'
1110

12-
installGlobals()
13-
1411
afterEach(() => server.resetHandlers())
1512
afterEach(() => cleanup())
1613

0 commit comments

Comments
 (0)