Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions packages/api-server/src/__tests__/fastify.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from 'node:path'

import fastify from 'fastify'
import { vol } from 'memfs'
import {
Expand Down Expand Up @@ -28,7 +26,7 @@ vi.mock('fastify', () => {
})

// Suppress terminal logging.
// console.log = vi.fn()
console.log = vi.fn()

// Set up RWJS_CWD.
let original_RWJS_CWD: string | undefined
Expand All @@ -54,32 +52,16 @@ const userConfig = {
requestTimeout: 25_000,
}

console.log('dirname', __dirname)
const fileOSRoot = path.parse(__dirname).root
console.log('fileOSRoot', fileOSRoot)
const configPath = await vi.hoisted(async () => {
const path = await import('node:path')

vi.mock('/graphql/cedar-app/api/server.config.js', () => {
return {
default: {
config: userConfig,
},
}
})
vi.mock('/D:/graphql/cedar-app/api/server.config.js', () => {
return {
default: {
config: userConfig,
},
}
})
vi.mock('D:/graphql/cedar-app/api/server.config.js', () => {
return {
default: {
config: userConfig,
},
}
// This will be `D:\` on Windows (or some other drive letter) and `/` on Unix
const osRoot = path.parse(__dirname).root.replace('\\', '/')

return osRoot + 'graphql/cedar-app/api/server.config.js'
})
vi.mock('\\graphql\\cedar-app\\api\\server.config.js', () => {

vi.mock(configPath, () => {
return {
default: {
config: userConfig,
Expand Down
Loading