Skip to content

Commit 0e879c6

Browse files
authored
chore(api-server): Cleanup after premature merge (#160)
When working on #159 I discovered an issue with Windows-related paths. As I was debugging and troubleshooting, the PR merged prematurely as I forgot I had auto-merge turned on. This PR cleans up the WIP debugging :D
1 parent 7530187 commit 0e879c6

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

packages/api-server/src/__tests__/fastify.test.ts

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import path from 'node:path'
2-
31
import fastify from 'fastify'
42
import { vol } from 'memfs'
53
import {
@@ -28,7 +26,7 @@ vi.mock('fastify', () => {
2826
})
2927

3028
// Suppress terminal logging.
31-
// console.log = vi.fn()
29+
console.log = vi.fn()
3230

3331
// Set up RWJS_CWD.
3432
let original_RWJS_CWD: string | undefined
@@ -54,32 +52,16 @@ const userConfig = {
5452
requestTimeout: 25_000,
5553
}
5654

57-
console.log('dirname', __dirname)
58-
const fileOSRoot = path.parse(__dirname).root
59-
console.log('fileOSRoot', fileOSRoot)
55+
const configPath = await vi.hoisted(async () => {
56+
const path = await import('node:path')
6057

61-
vi.mock('/graphql/cedar-app/api/server.config.js', () => {
62-
return {
63-
default: {
64-
config: userConfig,
65-
},
66-
}
67-
})
68-
vi.mock('/D:/graphql/cedar-app/api/server.config.js', () => {
69-
return {
70-
default: {
71-
config: userConfig,
72-
},
73-
}
74-
})
75-
vi.mock('D:/graphql/cedar-app/api/server.config.js', () => {
76-
return {
77-
default: {
78-
config: userConfig,
79-
},
80-
}
58+
// This will be `D:\` on Windows (or some other drive letter) and `/` on Unix
59+
const osRoot = path.parse(__dirname).root.replace('\\', '/')
60+
61+
return osRoot + 'graphql/cedar-app/api/server.config.js'
8162
})
82-
vi.mock('\\graphql\\cedar-app\\api\\server.config.js', () => {
63+
64+
vi.mock(configPath, () => {
8365
return {
8466
default: {
8567
config: userConfig,

0 commit comments

Comments
 (0)