From 6ea87c8a083ec5f6635d25972a301c7a7e0af8ee Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 1 Jun 2026 10:53:15 +0200 Subject: [PATCH] chore(machine): set up vitest for apps/machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First test surface for the Electron + Vue 3 app — apps/machine has had no tests until now (workspace packages cover state-machine, nostr-client, clink, lnbits). Cassette config #56 shipped untested under the same posture; #57 (operator fee config consumer) introduces enough load- bearing parser + state-store logic to want unit coverage, so growing the test substrate now. Adds `test` / `test:watch` scripts + vitest devDep + minimal config that picks up `src/**/*.test.ts` and `electron/**/*.test.ts`. No tests land here — that comes with the feature commit. Co-Authored-By: Claude Opus 4.7 --- apps/machine/package.json | 5 ++++- apps/machine/vitest.config.ts | 15 +++++++++++++++ pnpm-lock.yaml | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 apps/machine/vitest.config.ts diff --git a/apps/machine/package.json b/apps/machine/package.json index 04702c6..a0320d5 100644 --- a/apps/machine/package.json +++ b/apps/machine/package.json @@ -18,7 +18,9 @@ "build:electron": "pnpm build && electron-builder", "preview": "vite preview", "typecheck": "vue-tsc --noEmit", - "lint": "eslint src/" + "lint": "eslint src/", + "test": "vitest run", + "test:watch": "vitest" }, "dependencies": { "@bitSpire/clink": "workspace:*", @@ -55,6 +57,7 @@ "tw-animate-css": "^1.4.0", "typescript": "^5.7.0", "vite": "^6.0.0", + "vitest": "^2.1.9", "vue-tsc": "^2.1.0" }, "build": { diff --git a/apps/machine/vitest.config.ts b/apps/machine/vitest.config.ts new file mode 100644 index 0000000..cfcd8b9 --- /dev/null +++ b/apps/machine/vitest.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'vitest/config' +import { fileURLToPath, URL } from 'node:url' + +export default defineConfig({ + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, + }, + test: { + include: ['src/**/*.test.ts', 'electron/**/*.test.ts'], + globals: false, + environment: 'node', + }, +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c06824c..fe5f4df 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -120,6 +120,9 @@ importers: vite: specifier: ^6.0.0 version: 6.4.1(@types/node@22.19.7)(jiti@2.6.1)(lightningcss@1.30.2)(tsx@4.21.0) + vitest: + specifier: ^2.1.9 + version: 2.1.9(@types/node@22.19.7)(lightningcss@1.30.2) vue-tsc: specifier: ^2.1.0 version: 2.2.12(typescript@5.9.3) @@ -1559,6 +1562,7 @@ packages: '@xmldom/xmldom@0.8.11': resolution: {integrity: sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==} engines: {node: '>=10.0.0'} + deprecated: this version has critical issues, please update to the latest version abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} @@ -2521,6 +2525,7 @@ packages: lucide-vue-next@0.563.0: resolution: {integrity: sha512-zsE/lCKtmaa7bGfhSpN84br1K9YoQ5pCN+2oKWjQQG3Lo6ufUUKBuHSjNFI6RvUevxaajNXb8XwFUKeTXG3sIA==} + deprecated: Package deprecated. Please use @lucide/vue instead. peerDependencies: vue: '>=3.0.1' @@ -2824,6 +2829,7 @@ packages: prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. hasBin: true prettier@3.8.1: @@ -3117,7 +3123,7 @@ packages: tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exhorbitant rates) by contacting i@izs.me + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me temp-file@3.4.0: resolution: {integrity: sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==}