Skip to content

Commit

Permalink
test: add root option to loadConfig in options test
Browse files Browse the repository at this point in the history
  • Loading branch information
apaleslimghost committed Nov 11, 2024
1 parent 33b2edd commit 85ada6c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/cli/test/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ options:
`)
)

const config = await loadConfig(logger, { validate: false })
const config = await loadConfig(logger, { validate: false, root: process.cwd() })
const plugin = config.plugins['app root']
expect(plugin.valid).toBe(true)
expect((plugin as Valid<Plugin>).value.rcFile?.options.hooks[0].Test.baz).toEqual('bar')
Expand All @@ -49,7 +49,7 @@ options:
`)
)

const config = await loadConfig(logger, { validate: false })
const config = await loadConfig(logger, { validate: false, root: process.cwd() })
const plugin = config.plugins['app root']
expect(plugin.valid).toBe(true)
expect((plugin as Valid<Plugin>).value.rcFile?.options.hooks[0].Test.hello).toEqual('world')
Expand All @@ -66,7 +66,7 @@ options:
`)
)

const config = await loadConfig(logger, { validate: false })
const config = await loadConfig(logger, { validate: false, root: process.cwd() })
const plugin = config.plugins['app root']
expect(plugin.valid).toBe(true)
expect((plugin as Valid<Plugin>).value.rcFile?.options.hooks[0].Test.hello).toBeUndefined()
Expand All @@ -86,7 +86,7 @@ options:
`)
)

const config = await loadConfig(logger, { validate: false })
const config = await loadConfig(logger, { validate: false, root: process.cwd() })
const plugin = config.plugins['app root']
expect(plugin.valid).toBe(true)
expect((plugin as Valid<Plugin>).value.rcFile?.options.hooks[0].Test.hello).toEqual('bar')
Expand All @@ -102,7 +102,7 @@ options:
`)
)

expect(loadConfig(logger, { validate: false })).rejects.toThrowErrorMatchingInlineSnapshot(
expect(loadConfig(logger, { validate: false, root: process.cwd() })).rejects.toThrowErrorMatchingInlineSnapshot(
`"cannot reference plugin options when specifying options"`
)
})
Expand All @@ -122,7 +122,7 @@ options:

expect.assertions(2)
try {
await loadConfig(logger, { validate: false })
await loadConfig(logger, { validate: false, root: process.cwd() })
} catch (error) {
expect(error.details.split('\n\n')).toHaveLength(3)
expect(error.details).toMatchInlineSnapshot(`
Expand Down

0 comments on commit 85ada6c

Please sign in to comment.