From acbaf5daa8379821ae0cfad346fe1017f3c14389 Mon Sep 17 00:00:00 2001 From: electrovir Date: Wed, 27 Nov 2024 16:25:42 +0000 Subject: [PATCH] [minor] log when a snapshot file is updated --- package-lock.json | 88 +++++++++--------- package.json | 2 +- packages/compile/package.json | 6 +- packages/core/package.json | 2 +- packages/deps/package.json | 4 +- packages/docs/package.json | 4 +- packages/format/package.json | 4 +- packages/frontend/package.json | 4 +- packages/help/package.json | 4 +- packages/init/package.json | 4 +- packages/lint/package.json | 4 +- packages/plugin-testing/package.json | 4 +- packages/publish/package.json | 4 +- packages/scripts/package.json | 4 +- packages/spellcheck/package.json | 6 +- packages/test/package.json | 4 +- .../src/web-snapshot-plugin/snapshot-store.ts | 92 ++++++++----------- .../web-snapshot-plugin.ts | 4 +- packages/virmator/package.json | 26 +++--- 19 files changed, 128 insertions(+), 142 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea17455e..a4d31ebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@virmator/mono-repo-root", - "version": "13.9.0", + "version": "13.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@virmator/mono-repo-root", - "version": "13.9.0", + "version": "13.10.0", "workspaces": [ "packages/*" ], @@ -17654,18 +17654,18 @@ }, "packages/compile": { "name": "@virmator/compile", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0" + "@virmator/core": "^13.10.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", "@types/node": "^22.9.0", - "@virmator/plugin-testing": "^13.9.0", + "@virmator/plugin-testing": "^13.10.0", "c8": "^10.1.2", "chalk": "^5.3.0", "concurrently": "^9.1.0", @@ -17683,7 +17683,7 @@ }, "packages/core": { "name": "@virmator/core", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", @@ -17709,13 +17709,13 @@ }, "packages/deps": { "name": "@virmator/deps", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { @@ -17733,13 +17733,13 @@ }, "packages/docs": { "name": "@virmator/docs", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "chalk": "^5.3.0", "mri": "^1.2.0" }, @@ -17758,12 +17758,12 @@ }, "packages/format": { "name": "@virmator/format", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { @@ -17786,13 +17786,13 @@ }, "packages/frontend": { "name": "@virmator/frontend", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { @@ -17808,13 +17808,13 @@ }, "packages/help": { "name": "@virmator/help", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0" + "@virmator/core": "^13.10.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", @@ -17828,13 +17828,13 @@ }, "packages/init": { "name": "@virmator/init", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "simple-git": "^3.27.0" }, "devDependencies": { @@ -17850,12 +17850,12 @@ }, "packages/lint": { "name": "@virmator/lint", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { @@ -17885,13 +17885,13 @@ }, "packages/plugin-testing": { "name": "@virmator/plugin-testing", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "cli-args-vir": "^1.0.0", "type-fest": "^4.27.0" }, @@ -17909,13 +17909,13 @@ }, "packages/publish": { "name": "@virmator/publish", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "chalk": "^5.3.0", "mri": "^1.2.0", "semver": "^7.6.3", @@ -17935,7 +17935,7 @@ }, "packages/scripts": { "name": "@virmator/scripts", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", @@ -17943,7 +17943,7 @@ "@augment-vir/node": "^30.8.2", "mri": "^1.2.0", "tsx": "^4.19.2", - "virmator": "^13.9.0" + "virmator": "^13.10.0" }, "devDependencies": { "@types/node": "^22.9.0" @@ -17954,19 +17954,19 @@ }, "packages/spellcheck": { "name": "@virmator/spellcheck", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", "@types/node": "^22.9.0", - "@virmator/plugin-testing": "^13.9.0", + "@virmator/plugin-testing": "^13.10.0", "c8": "^10.1.2", "concurrently": "^9.1.0", "cspell": "^8.16.0", @@ -17979,13 +17979,13 @@ }, "packages/test": { "name": "@virmator/test", - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "@web/dev-server-core": "^0.7.4", "@web/test-runner-core": "^0.13.4", "glob": "^11.0.0", @@ -18013,23 +18013,23 @@ } }, "packages/virmator": { - "version": "13.9.0", + "version": "13.10.0", "license": "(MIT or CC0 1.0)", "dependencies": { "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/compile": "^13.9.0", - "@virmator/core": "^13.9.0", - "@virmator/deps": "^13.9.0", - "@virmator/docs": "^13.9.0", - "@virmator/format": "^13.9.0", - "@virmator/frontend": "^13.9.0", - "@virmator/help": "^13.9.0", - "@virmator/init": "^13.9.0", - "@virmator/lint": "^13.9.0", - "@virmator/publish": "^13.9.0", - "@virmator/spellcheck": "^13.9.0", - "@virmator/test": "^13.9.0", + "@virmator/compile": "^13.10.0", + "@virmator/core": "^13.10.0", + "@virmator/deps": "^13.10.0", + "@virmator/docs": "^13.10.0", + "@virmator/format": "^13.10.0", + "@virmator/frontend": "^13.10.0", + "@virmator/help": "^13.10.0", + "@virmator/init": "^13.10.0", + "@virmator/lint": "^13.10.0", + "@virmator/publish": "^13.10.0", + "@virmator/spellcheck": "^13.10.0", + "@virmator/test": "^13.10.0", "tsx": "^4.19.2" }, "bin": { diff --git a/package.json b/package.json index 73aa8dfd..9b8d81a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/mono-repo-root", - "version": "13.9.0", + "version": "13.10.0", "private": true, "type": "module", "workspaces": [ diff --git a/packages/compile/package.json b/packages/compile/package.json index 3f0ccee7..18abf8d6 100644 --- a/packages/compile/package.json +++ b/packages/compile/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/compile", - "version": "13.9.0", + "version": "13.10.0", "description": "Default TS compile plugin for virmator.", "keywords": [ "virmator", @@ -34,12 +34,12 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0" + "@virmator/core": "^13.10.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", "@types/node": "^22.9.0", - "@virmator/plugin-testing": "^13.9.0", + "@virmator/plugin-testing": "^13.10.0", "c8": "^10.1.2", "chalk": "^5.3.0", "concurrently": "^9.1.0", diff --git a/packages/core/package.json b/packages/core/package.json index 623908a6..3f545b41 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/core", - "version": "13.9.0", + "version": "13.10.0", "description": "Shared core functionality for all virmator plugins and the virmator CLI.", "keywords": [ "automation", diff --git a/packages/deps/package.json b/packages/deps/package.json index 9095bcb4..e9bf55c3 100644 --- a/packages/deps/package.json +++ b/packages/deps/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/deps", - "version": "13.9.0", + "version": "13.10.0", "description": "Default TS deps plugin for virmator.", "keywords": [ "virmator", @@ -36,7 +36,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { diff --git a/packages/docs/package.json b/packages/docs/package.json index 5c1f4de4..2b5da555 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/docs", - "version": "13.9.0", + "version": "13.10.0", "description": "Default TS docs plugin for virmator.", "keywords": [ "virmator", @@ -35,7 +35,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "chalk": "^5.3.0", "mri": "^1.2.0" }, diff --git a/packages/format/package.json b/packages/format/package.json index 7d5fb1e5..dea05f2d 100644 --- a/packages/format/package.json +++ b/packages/format/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/format", - "version": "13.9.0", + "version": "13.10.0", "description": "Default format plugin for virmator.", "keywords": [ "virmator", @@ -33,7 +33,7 @@ "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 16d8aa25..a1b8922c 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/frontend", - "version": "13.9.0", + "version": "13.10.0", "description": "Default frontend plugin for virmator.", "keywords": [ "virmator", @@ -37,7 +37,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { diff --git a/packages/help/package.json b/packages/help/package.json index 30a03e31..a8f0dfc8 100644 --- a/packages/help/package.json +++ b/packages/help/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/help", - "version": "13.9.0", + "version": "13.10.0", "description": "Default help plugin for virmator.", "keywords": [ "virmator", @@ -34,7 +34,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0" + "@virmator/core": "^13.10.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", diff --git a/packages/init/package.json b/packages/init/package.json index 7b8fa425..24afc417 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/init", - "version": "13.9.0", + "version": "13.10.0", "description": "Default init plugin for virmator.", "keywords": [ "virmator", @@ -33,7 +33,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "simple-git": "^3.27.0" }, "devDependencies": { diff --git a/packages/lint/package.json b/packages/lint/package.json index 196e0ec9..c4f53dcd 100644 --- a/packages/lint/package.json +++ b/packages/lint/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/lint", - "version": "13.9.0", + "version": "13.10.0", "description": "Default ESLint linting plugin for virmator.", "keywords": [ "virmator", @@ -33,7 +33,7 @@ "dependencies": { "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { diff --git a/packages/plugin-testing/package.json b/packages/plugin-testing/package.json index 5cd963d0..a943e770 100644 --- a/packages/plugin-testing/package.json +++ b/packages/plugin-testing/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/plugin-testing", - "version": "13.9.0", + "version": "13.10.0", "description": "Testing for virmator plugins.", "keywords": [ "virmator", @@ -33,7 +33,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "cli-args-vir": "^1.0.0", "type-fest": "^4.27.0" }, diff --git a/packages/publish/package.json b/packages/publish/package.json index d3228f03..cbff03ad 100644 --- a/packages/publish/package.json +++ b/packages/publish/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/publish", - "version": "13.9.0", + "version": "13.10.0", "description": "Default publish plugin for virmator.", "keywords": [ "virmator", @@ -36,7 +36,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "chalk": "^5.3.0", "mri": "^1.2.0", "semver": "^7.6.3", diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 14c11fa4..f757b287 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/scripts", - "version": "13.9.0", + "version": "13.10.0", "private": true, "description": "Internal virmator scripts.", "keywords": [ @@ -32,7 +32,7 @@ "@augment-vir/node": "^30.8.2", "mri": "^1.2.0", "tsx": "^4.19.2", - "virmator": "^13.9.0" + "virmator": "^13.10.0" }, "devDependencies": { "@types/node": "^22.9.0" diff --git a/packages/spellcheck/package.json b/packages/spellcheck/package.json index ff27a009..ec1c6634 100644 --- a/packages/spellcheck/package.json +++ b/packages/spellcheck/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/spellcheck", - "version": "13.9.0", + "version": "13.10.0", "description": "Default spellcheck plugin for virmator", "keywords": [ "virmator", @@ -34,13 +34,13 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "mri": "^1.2.0" }, "devDependencies": { "@augment-vir/test": "^30.8.2", "@types/node": "^22.9.0", - "@virmator/plugin-testing": "^13.9.0", + "@virmator/plugin-testing": "^13.10.0", "c8": "^10.1.2", "concurrently": "^9.1.0", "cspell": "^8.16.0", diff --git a/packages/test/package.json b/packages/test/package.json index 32fe9f8e..1a29834f 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -1,6 +1,6 @@ { "name": "@virmator/test", - "version": "13.9.0", + "version": "13.10.0", "description": "Default test plugin for virmator.", "keywords": [ "virmator", @@ -38,7 +38,7 @@ "@augment-vir/assert": "^30.8.2", "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/core": "^13.9.0", + "@virmator/core": "^13.10.0", "@web/dev-server-core": "^0.7.4", "@web/test-runner-core": "^0.13.4", "glob": "^11.0.0", diff --git a/packages/test/src/web-snapshot-plugin/snapshot-store.ts b/packages/test/src/web-snapshot-plugin/snapshot-store.ts index 7928cdad..519782fd 100644 --- a/packages/test/src/web-snapshot-plugin/snapshot-store.ts +++ b/packages/test/src/web-snapshot-plugin/snapshot-store.ts @@ -1,12 +1,7 @@ -import {assert} from '@augment-vir/assert'; -import { - getOrSet, - PromiseQueue, - PromiseQueueUpdateEvent, - wrapInTry, - type MaybePromise, -} from '@augment-vir/common'; -import {writeFile} from 'node:fs/promises'; +import {check} from '@augment-vir/assert'; +import {getOrSet, log, PromiseQueue, wrapInTry, type MaybePromise} from '@augment-vir/common'; +import {readFile, writeFile} from 'node:fs/promises'; +import {relative} from 'node:path'; import {defineTypedCustomEvent, ListenTarget} from 'typed-event-target'; import type {SnapshotPayload} from './snapshot-payload.js'; @@ -31,62 +26,54 @@ export class SnapshotStore extends ListenTarget { this.dispatch(new SnapshotStoreUpdateEvent({detail: {size: this.getWriteQueueSize()}})); } - protected async getSnapshotFile(testFilePath: string): Promise { - const snapshotFilePath = createSnapshotOutputPath(testFilePath); - + protected async getCachedSnapshotFile(testFilePath: string): Promise { const snapshotFile = await getOrSet(this.snapshotFiles, testFilePath, async () => { - const existingSnapshot = await wrapInTry(() => import(snapshotFilePath), { - fallbackValue: undefined, - }); + const existingSnapshot = await wrapInTry( + () => import(createSnapshotOutputPath(testFilePath)), + { + fallbackValue: undefined, + }, + ); - return existingSnapshot || {}; - }); + if (!check.isObject(existingSnapshot)) { + return {}; + } - assert.isObject(snapshotFile, `Invalid snapshot file at '${snapshotFilePath}'`); + return existingSnapshot; + }); this.snapshotFiles[testFilePath] = snapshotFile; return snapshotFile; } - protected saveSnapshotFile(testFilePath: string) { - return getOrSet(this.writeQueues, testFilePath, () => { - const queue = new PromiseQueue(); - - queue.listen(PromiseQueueUpdateEvent, () => { - this.updateQueue(); - }); + public isFinalizing = false; - return queue; - }).add(async () => { - await writeFile( - createSnapshotOutputPath(testFilePath), - createOutputText(await this.getSnapshotFile(testFilePath)), - ); - }); - } + public async finalizeSnapshotFile(testFilePath: string) { + this.isFinalizing = true; + const snapshotsFile = await this.getCachedSnapshotFile(testFilePath); + const currentFileContents = String(await readFile(createSnapshotOutputPath(testFilePath))); + const accessedSnapshotNames = Array.from(this.accessedSnapshots[testFilePath] || []); - public isCleaning = false; + const sortedSnapshots: SnapshotsFile = {}; - public async cleanSnapshotFile(testFilePath: string) { - this.isCleaning = true; - const snapshotsFile: SnapshotsFile = await this.getSnapshotFile(testFilePath); - const accessedSnapshotNames = Array.from(this.accessedSnapshots[testFilePath] || []); - let changesMade = false as boolean; + Object.keys(snapshotsFile) + .sort() + .forEach((snapshotName) => { + if (accessedSnapshotNames.includes(snapshotName)) { + sortedSnapshots[snapshotName] = snapshotsFile[snapshotName]; + } + }); - Object.keys(snapshotsFile).forEach((snapshotName) => { - if (!accessedSnapshotNames.includes(snapshotName)) { - changesMade = true; - delete snapshotsFile[snapshotName]; - } - }); + const newFileContents = createOutputText(await this.getCachedSnapshotFile(testFilePath)); - this.isCleaning = false; - if (changesMade) { - await this.saveSnapshotFile(testFilePath); - } else { - this.updateQueue(); + this.isFinalizing = false; + if (currentFileContents !== newFileContents) { + const outputPath = createSnapshotOutputPath(testFilePath); + log.faint(`Snapshots file updated: '${relative(process.cwd(), outputPath)}'`); + await writeFile(outputPath, newFileContents); } + this.updateQueue(); } public getWriteQueueSize() { @@ -98,7 +85,7 @@ export class SnapshotStore extends ListenTarget { payload: Readonly>, ) { try { - const snapshotFile = await this.getSnapshotFile(testFilePath); + const snapshotFile = await this.getCachedSnapshotFile(testFilePath); const currentSnapshot = snapshotFile[payload.name]; getOrSet(this.accessedSnapshots, testFilePath, () => new Set()).add(payload.name); @@ -118,8 +105,7 @@ export class SnapshotStore extends ListenTarget { snapshotName: string; snapshotContent: unknown; }) { - (await this.getSnapshotFile(testFilePath))[snapshotName] = snapshotContent; - await this.saveSnapshotFile(testFilePath); + (await this.getCachedSnapshotFile(testFilePath))[snapshotName] = snapshotContent; } public override destroy() { diff --git a/packages/test/src/web-snapshot-plugin/web-snapshot-plugin.ts b/packages/test/src/web-snapshot-plugin/web-snapshot-plugin.ts index 1a3ba7f1..5264c861 100644 --- a/packages/test/src/web-snapshot-plugin/web-snapshot-plugin.ts +++ b/packages/test/src/web-snapshot-plugin/web-snapshot-plugin.ts @@ -39,7 +39,7 @@ export function snapshotPlugin(repoPath: string): TestRunnerPlugin { if (snapshotUpdatesAllowed) { await Promise.all( testFilePaths.map((testFilePath) => - snapshotStore.cleanSnapshotFile(testFilePath), + snapshotStore.finalizeSnapshotFile(testFilePath), ), ); } @@ -56,7 +56,7 @@ export function snapshotPlugin(repoPath: string): TestRunnerPlugin { } }); - if (snapshotStore.isCleaning || snapshotStore.getWriteQueueSize()) { + if (snapshotStore.isFinalizing || snapshotStore.getWriteQueueSize()) { await writesFinished.promise; } }, diff --git a/packages/virmator/package.json b/packages/virmator/package.json index 912e8b97..b67b3be0 100644 --- a/packages/virmator/package.json +++ b/packages/virmator/package.json @@ -1,6 +1,6 @@ { "name": "virmator", - "version": "13.9.0", + "version": "13.10.0", "description": "Handle common package configs, commands, and dependencies.", "keywords": [ "automation", @@ -39,18 +39,18 @@ "dependencies": { "@augment-vir/common": "^30.8.2", "@augment-vir/node": "^30.8.2", - "@virmator/compile": "^13.9.0", - "@virmator/core": "^13.9.0", - "@virmator/deps": "^13.9.0", - "@virmator/docs": "^13.9.0", - "@virmator/format": "^13.9.0", - "@virmator/frontend": "^13.9.0", - "@virmator/help": "^13.9.0", - "@virmator/init": "^13.9.0", - "@virmator/lint": "^13.9.0", - "@virmator/publish": "^13.9.0", - "@virmator/spellcheck": "^13.9.0", - "@virmator/test": "^13.9.0", + "@virmator/compile": "^13.10.0", + "@virmator/core": "^13.10.0", + "@virmator/deps": "^13.10.0", + "@virmator/docs": "^13.10.0", + "@virmator/format": "^13.10.0", + "@virmator/frontend": "^13.10.0", + "@virmator/help": "^13.10.0", + "@virmator/init": "^13.10.0", + "@virmator/lint": "^13.10.0", + "@virmator/publish": "^13.10.0", + "@virmator/spellcheck": "^13.10.0", + "@virmator/test": "^13.10.0", "tsx": "^4.19.2" }, "devDependencies": {