move TTC capture to unit test (#7268)

* move TTC capture to unit test

* progress with artifact

* fmt

* abstract cases

* add another case

* add another test

* update snapshots with proper file names

* force to JSON

* fmt

* make jest happy

* add another example and other tweaks

* fix

* tweak

* add logs

* more logs

* strip out kcl version

* remove logs

* add comment explainer

* more comments

* more comment

* remove package-lock line
This commit is contained in:
Kurt Hutten
2025-06-06 11:29:20 +10:00
committed by GitHub
parent c43ec280f2
commit 0bce7d3c1c
7 changed files with 1117 additions and 1 deletions

View File

@ -0,0 +1,17 @@
import type { GlobalSetupContext } from 'vitest/node'
export default function setup({ provide, config }: GlobalSetupContext) {
// Check if snapshot update mode is enabled
// Only update existing snapshots when mode is 'all' (triggered by -u flag)
// 'new' mode only creates snapshots for tests that don't have any, but doesn't update existing ones
const isUpdateSnapshots = config.snapshotOptions.updateSnapshot === 'all'
// Provide the update flag to tests
provide('vitest:updateSnapshots', isUpdateSnapshots)
}
declare module 'vitest' {
export interface ProvidedContext {
'vitest:updateSnapshots': boolean
}
}