Skip to content

Commit 0b431c4

Browse files
committed
fix: test typing error
1 parent e765ddd commit 0b431c4

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/common.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ test.group('vite-plugin-validate-env', (group) => {
1919

2020
await fs.add(`.env.development`, `VITE_TEST=not boolean`)
2121

22+
// @ts-expect-error - `config` is the handler
2223
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
2324
await assert.rejects(
2425
fn,
@@ -33,6 +34,7 @@ test.group('vite-plugin-validate-env', (group) => {
3334

3435
await fs.add(`.env.development`, `VITE_TEST=not boolean`)
3536

37+
// @ts-expect-error - `config` is the handler
3638
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
3739
await assert.rejects(fn, 'E_INVALID_ENV_VALUE: Heyhey')
3840
})
@@ -48,6 +50,7 @@ test.group('vite-plugin-validate-env', (group) => {
4850

4951
await fs.add(`.env.development`, `VITE_TEST=not valid`)
5052

53+
// @ts-expect-error - `config` is the handler
5154
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
5255
await assert.rejects(fn, 'Value must be "valid"')
5356
})
@@ -69,6 +72,7 @@ test.group('vite-plugin-validate-env', (group) => {
6972

7073
await fs.add(`.env.development`, `VITE_URL_TRAILING=test.com`)
7174

75+
// @ts-expect-error - `config` is the handler
7276
await plugin.config!(viteConfig, viteEnvConfig)
7377
assert.equal(process.env.VITE_URL_TRAILING, 'test.com/')
7478
})
@@ -86,6 +90,7 @@ test.group('vite-plugin-validate-env', (group) => {
8690
}`
8791
)
8892

93+
// @ts-expect-error - `config` is the handler
8994
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
9095
await assert.rejects(fn, 'Error validating')
9196
})
@@ -95,6 +100,7 @@ test.group('vite-plugin-validate-env', (group) => {
95100

96101
await fs.add(`.env.development`, `VITE_MY_VAR=true`)
97102

103+
// @ts-expect-error - `config` is the handler
98104
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
99105
await assert.rejects(fn, 'Missing configuration for vite-plugin-validate-env')
100106
})

tests/zod.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ test.group('Zod validation adaptater', () => {
1919

2020
await fs.add(`.env.development`, `VITE_TEST=htest`)
2121

22+
// @ts-expect-error - `config` is the handler
2223
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
2324
await assert.rejects(fn, 'E_INVALID_ENV_VALUE: Invalid value for "VITE_TEST" : Invalid url')
2425
})
@@ -36,6 +37,7 @@ test.group('Zod validation adaptater', () => {
3637

3738
await fs.add(`.env.development`, `VITE_TEST=hello`)
3839

40+
// @ts-expect-error - `config` is the handler
3941
await plugin.config!(viteConfig, viteEnvConfig)
4042
assert.equal(process.env.VITE_TEST, 'HELLO')
4143
})
@@ -50,6 +52,7 @@ test.group('Zod validation adaptater', () => {
5052

5153
await fs.add(`.env.development`, `VITE_LONG_STRING=superlongstring`)
5254

55+
// @ts-expect-error - `config` is the handler
5356
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
5457
await assert.rejects(
5558
fn,
@@ -69,6 +72,7 @@ test.group('Zod validation adaptater', () => {
6972

7073
await fs.add(`.env.development`, `VITE_REFINED=superlongstring`)
7174

75+
// @ts-expect-error - `config` is the handler
7276
const fn = plugin.config!.bind(plugin, viteConfig, viteEnvConfig)
7377
await assert.rejects(
7478
fn,

0 commit comments

Comments
 (0)