Skip to content

Commit bc06691

Browse files
committed
fix: resolve cwd from user config
closes #646
1 parent 9e6341a commit bc06691

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/config/file.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ export async function loadConfigFile(
135135
}
136136

137137
return {
138-
configs: exported.map((config) => ({ cwd, ...config })),
138+
configs: exported.map((config) => ({
139+
...config,
140+
cwd: config.cwd ? path.resolve(cwd, config.cwd) : cwd,
141+
})),
139142
file,
140143
}
141144
}

src/config/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'node:path'
12
import { createDebug } from 'obug'
23
import { loadConfigFile } from './file.ts'
34
import { resolveUserConfig } from './options.ts'
@@ -22,6 +23,10 @@ export async function resolveConfig(inlineConfig: InlineConfig): Promise<{
2223
}> {
2324
debug('inline config %O', inlineConfig)
2425

26+
if (inlineConfig.cwd) {
27+
inlineConfig.cwd = path.resolve(inlineConfig.cwd)
28+
}
29+
2530
const { configs: rootConfigs, file } = await loadConfigFile(inlineConfig)
2631
const files: string[] = []
2732
if (file) {

0 commit comments

Comments
 (0)