Compare commits

..

2 Commits

Author SHA1 Message Date
Suneha Bose 277e07e88f remove bundle intg test 2026-03-04 11:48:42 -08:00
Suneha Bose 6ad4fe0a14 migrate to esbuild and vitest 2026-03-03 16:35:16 -08:00
29 changed files with 2074 additions and 71387 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v3.29.5
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
@@ -86,6 +86,6 @@ jobs:
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v3.29.5
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.29.5
with:
category: '/language:${{matrix.language}}'
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 'lts/*'
cache: 'npm'
+1
View File
@@ -331,3 +331,4 @@ node_modules
coverage
# Transpiled JS
lib/
-39
View File
@@ -1,44 +1,5 @@
# Change Log
## [5.0.0] - 2026-04-07
### Features
- #227 Migrate to ESM with esbuild, vitest
### Runtime and platform
- #222 Update Node version from 20 to 24
### Dependabot updates
- #231 Bump github/codeql-action in /.github/workflows in the actions group
- #230 Bump typescript in the actions group across 1 directory
- #228 Bump picomatch
- #226 Bump github/codeql-action in /.github/workflows in the actions group
- #223 Bump undici from 6.23.0 to 6.24.0
- #221 Bump the actions group in /.github/workflows with 2 updates
- #218 Bump the actions group in /.github/workflows with 2 updates
- #219 Bump minimatch
- #217 Bump undici and @actions/http-client
- #216 Bump github/codeql-action in /.github/workflows in the actions group
- #214 Bump the actions group in /.github/workflows with 2 updates
- #212 Bump the actions group in /.github/workflows with 2 updates
- #211 Bump the actions group with 3 updates
- #210 Bump the actions group with 2 updates
- #208 Bump @types/node from 25.0.2 to 25.0.3 in the actions group
- #209 Bump github/codeql-action in /.github/workflows in the actions group
- #206 Bump the actions group with 3 updates
- #207 Bump github/codeql-action in /.github/workflows in the actions group
- #205 Bump the actions group in /.github/workflows with 4 updates
- #204 Bump the actions group with 2 updates
- #202 Bump the actions group in /.github/workflows with 2 updates
- #203 Bump prettier from 3.6.2 to 3.7.3 in the actions group
- #201 Bump glob from 10.4.5 to 10.5.0
- #200 Bump js-yaml from 3.14.1 to 3.14.2
- #198 Bump js-yaml from 4.1.0 to 4.1.1
- #199 Bump the actions group with 2 updates
## [4.0.2] - 2025-11-13
- #[164](https://github.com/Azure/k8s-set-context/pull/164) Adding optional kubeconfig encoding variable
+8 -4
View File
@@ -19,7 +19,7 @@ Refer to the [action metadata file](./action.yml) for details about inputs. Note
### Kubeconfig approach
```yaml
- uses: azure/k8s-set-context@v5
- uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: <your kubeconfig>
@@ -50,7 +50,7 @@ Please refer to documentation on fetching [kubeconfig for any generic K8s cluste
### Service account approach
```yaml
- uses: azure/k8s-set-context@v5
- uses: azure/k8s-set-context@v4
with:
method: service-account
k8s-url: <URL of the cluster's API server>
@@ -74,7 +74,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o yaml
### Service account approach for arc cluster
```yaml
- uses: azure/k8s-set-context@v5
- uses: azure/k8s-set-context@v4
with:
method: service-account
cluster-type: arc
@@ -86,7 +86,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o yaml
### Service principal approach for arc cluster
```yaml
- uses: azure/k8s-set-context@v5
- uses: azure/k8s-set-context@v4
with:
method: service-principal
cluster-type: arc
@@ -107,3 +107,7 @@ provided by the bot. You will only need to do this once across all repos using o
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
### Local development
Use `npm run build` to bundle the action with esbuild (output is `lib/index.cjs`, referenced by `action.yml`) and `npm run test` to execute the Vitest suite, including an integration test that runs the built action.
+2 -2
View File
@@ -39,5 +39,5 @@ inputs:
branding:
color: 'blue'
runs:
using: 'node24'
main: 'lib/index.js'
using: 'node20'
main: 'lib/index.cjs'
-70335
View File
File diff suppressed because one or more lines are too long
+1855 -890
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -1,12 +1,11 @@
{
"name": "k8s-set-context-action",
"version": "5.0.0",
"version": "4.0.2",
"private": true,
"main": "lib/index.js",
"main": "lib/index.cjs",
"type": "module",
"scripts": {
"build": "tsc --noEmit && esbuild src/run.ts --bundle --platform=node --target=node20 --format=esm --outfile=lib/index.js --banner:js=\"import { createRequire } from 'module';const require = createRequire(import.meta.url);\"",
"typecheck": "tsc --noEmit",
"build": "tsc --noEmit && node ./scripts/build.mjs",
"test": "vitest run",
"test-coverage": "vitest run --coverage",
"format": "prettier --write .",
@@ -21,19 +20,20 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/exec": "^3.0.0",
"@actions/io": "^3.0.2",
"@actions/core": "^2.0.2",
"@actions/exec": "^2.0.0",
"@actions/io": "^2.0.0",
"@kubernetes/client-node": "^1.4.0",
"husky": "^9.1.7",
"js-yaml": "^4.1.1"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/node": "^25.5.2",
"esbuild": "^0.28.0",
"@types/node": "^25.0.9",
"@vitest/coverage-v8": "^2.0.4",
"esbuild": "^0.24.0",
"prettier": "^3.8.0",
"typescript": "^6.0.2",
"vitest": "^4.1.1"
"typescript": "^5.9.3",
"vitest": "^2.0.4"
}
}
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env node
import {build} from 'esbuild'
import {mkdir} from 'fs/promises'
import {dirname} from 'path'
const outFile = 'lib/index.cjs'
const main = async () => {
await mkdir(dirname(outFile), {recursive: true})
await build({
entryPoints: ['src/run.ts'],
bundle: true,
platform: 'node',
target: 'node20',
format: 'cjs',
sourcemap: true,
outfile: outFile,
legalComments: 'none'
})
}
main().catch((err) => {
console.error(err)
process.exit(1)
})
+41 -18
View File
@@ -1,33 +1,56 @@
import {vi, describe, it, expect} from 'vitest'
import {getRequiredInputError} from '../tests/util.js'
import {run} from './action.js'
vi.mock('fs')
vi.mock('./utils.js')
import {getRequiredInputError} from '../tests/util'
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
import {run} from './action'
import * as fs from 'fs'
import * as path from 'path'
import os from 'os'
import * as utils from './utils'
import * as core from '@actions/core'
describe('Run', () => {
const initialEnv = {...process.env}
const tempDirs: string[] = []
beforeEach(() => {
vi.restoreAllMocks()
process.env = {...initialEnv}
vi.spyOn(core, 'warning').mockImplementation(() => {})
vi.spyOn(core, 'debug').mockImplementation(() => {})
})
afterEach(() => {
tempDirs.forEach((dir) => {
try {
fs.rmSync(dir, {recursive: true, force: true})
} catch {}
})
tempDirs.length = 0
})
it('throws error without cluster type', async () => {
await expect(run()).rejects.toThrow(getRequiredInputError('cluster-type'))
})
it('writes kubeconfig and sets context', async () => {
const {getKubeconfig, setContext} = await import('./utils.js')
const fs = await import('fs')
const kubeconfig = 'kubeconfig'
const fixedTimestamp = 42
process.env['INPUT_CLUSTER-TYPE'] = 'default'
process.env['RUNNER_TEMP'] = '/sample/path'
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kubeconfig-test-'))
tempDirs.push(tmpDir)
process.env['RUNNER_TEMP'] = tmpDir
vi.mocked(getKubeconfig).mockResolvedValue(kubeconfig)
vi.mocked(setContext).mockReturnValue(kubeconfig)
vi.mocked(fs.writeFileSync).mockImplementation(() => {})
vi.mocked(fs.chmodSync).mockImplementation(() => {})
vi.spyOn(Date, 'now').mockReturnValue(fixedTimestamp)
vi.spyOn(utils, 'getKubeconfig').mockResolvedValue(kubeconfig)
vi.spyOn(utils, 'setContext').mockImplementation(() => kubeconfig)
await run()
await expect(run()).resolves.toBeUndefined()
expect(getKubeconfig).toHaveBeenCalled()
expect(fs.writeFileSync).toHaveBeenCalled()
expect(fs.chmodSync).toHaveBeenCalled()
expect(setContext).toHaveBeenCalled()
const outputPath = path.join(tmpDir, `kubeconfig_${fixedTimestamp}`)
expect(fs.existsSync(outputPath)).toBe(true)
expect(fs.readFileSync(outputPath, 'utf-8')).toBe(kubeconfig)
expect(process.env['KUBECONFIG']).toBe(outputPath)
expect(utils.getKubeconfig).toHaveBeenCalled()
expect(utils.setContext).toHaveBeenCalledWith(kubeconfig)
})
})
+3 -3
View File
@@ -1,8 +1,8 @@
import * as core from '@actions/core'
import * as path from 'path'
import * as fs from 'fs'
import {Cluster, parseCluster} from './types/cluster.js'
import {setContext, getKubeconfig} from './utils.js'
import {Cluster, parseCluster} from './types/cluster'
import {setContext, getKubeconfig} from './utils'
/**
* Sets the Kubernetes context based on supplied action inputs
@@ -14,7 +14,7 @@ export async function run() {
required: true
})
)
const runnerTempDirectory: string = process.env['RUNNER_TEMP'] ?? ''
const runnerTempDirectory: string = process.env['RUNNER_TEMP']
const kubeconfigPath: string = path.join(
runnerTempDirectory,
`kubeconfig_${Date.now()}`
+15 -10
View File
@@ -1,13 +1,18 @@
import {vi, describe, test, it, expect, beforeEach} from 'vitest'
import {beforeEach, describe, expect, it, test, vi} from 'vitest'
import * as core from '@actions/core'
import * as actions from '@actions/exec'
import * as io from '@actions/io'
import {getRequiredInputError} from '../../tests/util.js'
import {getArcKubeconfig, KUBECONFIG_LOCATION} from './arc.js'
import * as az from './azCommands.js'
vi.mock('@actions/io')
vi.mock('./azCommands.js')
import {getRequiredInputError} from '../../tests/util'
import {getArcKubeconfig, KUBECONFIG_LOCATION} from './arc'
import * as az from './azCommands'
describe('Arc kubeconfig', () => {
beforeEach(() => {
vi.restoreAllMocks()
vi.spyOn(core, 'warning').mockImplementation(() => {})
vi.spyOn(core, 'debug').mockImplementation(() => {})
})
test('it throws error without resource group', async () => {
await expect(getArcKubeconfig()).rejects.toThrow(
getRequiredInputError('resource-group')
@@ -31,9 +36,9 @@ describe('Arc kubeconfig', () => {
process.env['INPUT_RESOURCE-GROUP'] = group
process.env['INPUT_CLUSTER-NAME'] = name
vi.mocked(io.which).mockResolvedValue(path)
vi.mocked(az.runAzCliCommand).mockResolvedValue(undefined)
vi.mocked(az.runAzKubeconfigCommandBlocking).mockResolvedValue(
vi.spyOn(io, 'which').mockResolvedValue(path)
vi.spyOn(az, 'runAzCliCommand').mockResolvedValue()
vi.spyOn(az, 'runAzKubeconfigCommandBlocking').mockResolvedValue(
kubeconfig
)
})
+2 -2
View File
@@ -1,8 +1,8 @@
import * as core from '@actions/core'
import * as io from '@actions/io'
import {Method, parseMethod} from '../types/method.js'
import {Method, parseMethod} from '../types/method'
import * as path from 'path'
import {runAzCliCommand, runAzKubeconfigCommandBlocking} from './azCommands.js'
import {runAzCliCommand, runAzKubeconfigCommandBlocking} from './azCommands'
const RUNNER_TEMP: string = process.env['RUNNER_TEMP'] || ''
export const KUBECONFIG_LOCATION: string = path.join(
+6 -6
View File
@@ -1,17 +1,17 @@
import {vi, describe, test, expect, beforeEach} from 'vitest'
import {describe, expect, test, vi} from 'vitest'
import * as core from '@actions/core'
import * as actions from '@actions/exec'
import {runAzCliCommand} from './azCommands.js'
vi.mock('@actions/exec')
import {runAzCliCommand} from './azCommands'
describe('Az commands', () => {
test('it runs an az cli command', async () => {
vi.spyOn(core, 'debug').mockImplementation(() => {})
const path = 'path'
const args = ['args']
vi.mocked(actions.exec).mockResolvedValue(0)
vi.spyOn(actions, 'exec').mockResolvedValue(0)
await runAzCliCommand(path, args)
expect(await runAzCliCommand(path, args))
expect(actions.exec).toHaveBeenCalledWith(path, args, {})
})
})
+2 -1
View File
@@ -1,5 +1,6 @@
import * as fs from 'fs'
import {ExecOptions, exec} from '@actions/exec'
import {ExecOptions} from '@actions/exec/lib/interfaces'
import {exec} from '@actions/exec'
import {spawn} from 'child_process'
const AZ_TIMEOUT_SECONDS: number = 120
+37 -15
View File
@@ -1,9 +1,22 @@
import {vi, describe, test, expect, beforeEach, afterEach} from 'vitest'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'
import * as fs from 'fs'
import {getRequiredInputError} from '../../tests/util.js'
import {createKubeconfig, getDefaultKubeconfig} from './default.js'
import * as core from '@actions/core'
import {getRequiredInputError} from '../../tests/util'
import {createKubeconfig, getDefaultKubeconfig} from './default'
describe('Default kubeconfig', () => {
const originalEnv = {...process.env}
beforeEach(() => {
vi.restoreAllMocks()
vi.spyOn(core, 'warning').mockImplementation(() => {})
vi.spyOn(core, 'debug').mockImplementation(() => {})
})
afterEach(() => {
process.env = {...originalEnv}
})
test('it creates a kubeconfig with proper format', () => {
const certAuth = 'certAuth'
const token = 'token'
@@ -51,11 +64,6 @@ describe('Default kubeconfig', () => {
process.env['INPUT_METHOD'] = 'default'
})
afterEach(() => {
delete process.env['INPUT_KUBECONFIG']
delete process.env['INPUT_KUBECONFIG-ENCODING']
})
test('it throws error without kubeconfig', () => {
expect(() => getDefaultKubeconfig()).toThrow(
getRequiredInputError('kubeconfig')
@@ -71,25 +79,39 @@ describe('Default kubeconfig', () => {
test('returns kubeconfig as plaintext when encoding is plaintext', () => {
const kc = 'example kc'
process.env['INPUT_KUBECONFIG'] = kc
process.env['INPUT_KUBECONFIG-ENCODING'] = 'plaintext'
vi.spyOn(core, 'getInput').mockImplementation((name: string) => {
if (name === 'method') return 'default'
if (name === 'kubeconfig-encoding') return 'plaintext'
if (name === 'kubeconfig') return kc
return ''
})
expect(getDefaultKubeconfig()).toBe(kc)
})
test('it gets default config through base64 kubeconfig input', () => {
const kc = 'example kc'
const base64Kc = Buffer.from(kc, 'utf-8').toString('base64')
process.env['INPUT_KUBECONFIG'] = base64Kc
process.env['INPUT_KUBECONFIG-ENCODING'] = 'base64'
vi.spyOn(core, 'getInput').mockImplementation((name: string) => {
if (name === 'method') return 'default'
if (name === 'kubeconfig-encoding') return 'base64'
if (name === 'kubeconfig') return base64Kc
return ''
})
expect(getDefaultKubeconfig()).toBe(kc)
})
test('it throws error for unknown kubeconfig-encoding', () => {
const kc = 'example kc'
process.env['INPUT_KUBECONFIG'] = kc
process.env['INPUT_KUBECONFIG-ENCODING'] = 'foobar'
const unknownEncoding = 'foobar'
vi.spyOn(core, 'getInput').mockImplementation((name: string) => {
if (name === 'method') return 'default'
if (name === 'kubeconfig-encoding') return unknownEncoding
if (name === 'kubeconfig') return kc
return ''
})
expect(() => getDefaultKubeconfig()).toThrow(
"Invalid kubeconfig-encoding: 'foobar'. Must be 'plaintext' or 'base64'."
+2 -2
View File
@@ -1,8 +1,8 @@
import * as core from '@actions/core'
import * as jsyaml from 'js-yaml'
import {KubeConfig} from '@kubernetes/client-node'
import {K8sSecret, parseK8sSecret} from '../types/k8sSecret.js'
import {Method, parseMethod} from '../types/method.js'
import {K8sSecret, parseK8sSecret} from '../types/k8sSecret'
import {Method, parseMethod} from '../types/method'
/**
* Gets the kubeconfig based on provided method for a default Kubernetes cluster
+1 -1
View File
@@ -1,4 +1,4 @@
import {run} from './action.js'
import {run} from './action'
import * as core from '@actions/core'
// Run the application
+3 -3
View File
@@ -1,9 +1,9 @@
import {describe, test, expect} from 'vitest'
import {Cluster, parseCluster} from './cluster.js'
import {describe, expect, test} from 'vitest'
import {Cluster, parseCluster} from './cluster'
describe('Cluster type', () => {
test('it has required values', () => {
const vals = Object.values(Cluster) as string[]
const vals = <any>Object.values(Cluster)
expect(vals.includes('arc')).toBe(true)
expect(vals.includes('generic')).toBe(true)
})
+6 -7
View File
@@ -8,10 +8,9 @@ export enum Cluster {
* @param str The cluster type (case insensitive)
* @returns The Cluster enum or undefined if it can't be parsed
*/
export const parseCluster = (str: string): Cluster | undefined => {
const key = Object.keys(Cluster).find(
(k) =>
Cluster[k as keyof typeof Cluster].toLowerCase() === str.toLowerCase()
) as keyof typeof Cluster | undefined
return key !== undefined ? Cluster[key] : undefined
}
export const parseCluster = (str: string): Cluster | undefined =>
Cluster[
Object.keys(Cluster).filter(
(k) => Cluster[k].toString().toLowerCase() === str.toLowerCase()
)[0] as keyof typeof Cluster
]
+2 -2
View File
@@ -1,5 +1,5 @@
import {describe, test, expect} from 'vitest'
import {parseK8sSecret} from './k8sSecret.js'
import {describe, expect, test} from 'vitest'
import {parseK8sSecret, K8sSecret} from './k8sSecret'
describe('K8sSecret type', () => {
describe('Parsing from any', () => {
+3 -3
View File
@@ -1,9 +1,9 @@
import {describe, test, expect} from 'vitest'
import {Method, parseMethod} from './method.js'
import {describe, expect, test} from 'vitest'
import {Method, parseMethod} from './method'
describe('Method type', () => {
test('it has required values', () => {
const vals = Object.values(Method) as string[]
const vals = <any>Object.values(Method)
expect(vals.includes('kubeconfig')).toBe(true)
expect(vals.includes('service-account')).toBe(true)
expect(vals.includes('service-principal')).toBe(true)
+6 -7
View File
@@ -9,10 +9,9 @@ export enum Method {
* @param str The method (case insensitive)
* @returns The Method enum or undefined if it can't be parsed
*/
export const parseMethod = (str: string): Method | undefined => {
const key = Object.keys(Method).find(
(k) =>
Method[k as keyof typeof Method].toLowerCase() === str.toLowerCase()
) as keyof typeof Method | undefined
return key !== undefined ? Method[key] : undefined
}
export const parseMethod = (str: string): Method | undefined =>
Method[
Object.keys(Method).filter(
(k) => Method[k].toString().toLowerCase() === str.toLowerCase()
)[0] as keyof typeof Method
]
+13 -8
View File
@@ -1,17 +1,22 @@
import {vi, describe, test, expect} from 'vitest'
import {beforeEach, describe, expect, test, vi} from 'vitest'
import fs from 'fs'
import * as arc from './kubeconfigs/arc.js'
import * as def from './kubeconfigs/default.js'
import {Cluster} from './types/cluster.js'
import {getKubeconfig, setContext} from './utils.js'
import * as arc from './kubeconfigs/arc'
import * as def from './kubeconfigs/default'
import {Cluster} from './types/cluster'
import {getKubeconfig, setContext} from './utils'
import * as core from '@actions/core'
describe('Utils', () => {
beforeEach(() => {
vi.restoreAllMocks()
vi.spyOn(core, 'warning').mockImplementation(() => {})
vi.spyOn(core, 'debug').mockImplementation(() => {})
})
describe('get kubeconfig', () => {
test('it gets arc kubeconfig when type is arc', async () => {
const arcKubeconfig = 'arckubeconfig'
vi.spyOn(arc, 'getArcKubeconfig').mockImplementation(
async () => arcKubeconfig
)
vi.spyOn(arc, 'getArcKubeconfig').mockResolvedValue(arcKubeconfig)
expect(await getKubeconfig(Cluster.ARC)).toBe(arcKubeconfig)
})
+3 -3
View File
@@ -1,9 +1,9 @@
import * as core from '@actions/core'
import * as fs from 'fs'
import {KubeConfig} from '@kubernetes/client-node'
import {getDefaultKubeconfig} from './kubeconfigs/default.js'
import {getArcKubeconfig} from './kubeconfigs/arc.js'
import {Cluster} from './types/cluster.js'
import {getDefaultKubeconfig} from './kubeconfigs/default'
import {getArcKubeconfig} from './kubeconfigs/arc'
import {Cluster} from './types/cluster'
/**
* Gets the kubeconfig based on Kubernetes cluster type
+1 -1
View File
@@ -3,5 +3,5 @@
* @param inputName Name of input
* @returns Error with explanation message
*/
export const getRequiredInputError = (inputName) =>
export const getRequiredInputError = (inputName: string): Error =>
Error(`Input required and not supplied: ${inputName}`)
+10 -9
View File
@@ -1,14 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "./src",
"outDir": "./lib",
"noImplicitAny": false,
"baseUrl": ".",
"module": "ESNext", // or "NodeNext" depending on your setup
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"noEmit": true,
"types": ["node", "vitest/globals"]
"paths": {
"@actions/core": ["node_modules/@actions/core"],
"@kubernetes/client-node": ["node_modules/@kubernetes/client-node"]
}
},
"exclude": ["node_modules", "**/*.test.ts", "vitest.config.ts", "tests/"]
"exclude": ["node_modules", "lib"]
}
+12 -2
View File
@@ -2,9 +2,19 @@ import {defineConfig} from 'vitest/config'
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['**/*.test.ts'],
clearMocks: true
restoreMocks: true,
clearMocks: true,
mockReset: true,
coverage: {
provider: 'v8',
thresholds: {
statements: 22,
branches: 0,
functions: 40,
lines: 22
}
}
}
})