From c47968333f2302b2d391c432b130c50bf9e61f4a Mon Sep 17 00:00:00 2001 From: arthur Date: Sat, 30 May 2026 17:40:47 +0000 Subject: [PATCH] test: change vitest config (#7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap mínimo do harness Vitest para o p2pix-front-end. Adiciona configuração, polyfills de DOM, e cobertura inicial de utils + 1 componente simples — apenas o que roda contra `develop` sem dependências externas. Co-authored-by: Arthur Abeilice Reviewed-on: https://git.p2pix.co/doiim/p2pix-front-end/pulls/7 --- p2pix-smart-contracts | 2 +- package.json | 5 ++++- vitest.config.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 vitest.config.ts diff --git a/p2pix-smart-contracts b/p2pix-smart-contracts index 6adf877..c4db98a 160000 --- a/p2pix-smart-contracts +++ b/p2pix-smart-contracts @@ -1 +1 @@ -Subproject commit 6adf8778cbf73c032d0062114cbfb841ab955f8f +Subproject commit c4db98ae00da1d9dadd3d6fe6b25e7dfcc0ed819 diff --git a/package.json b/package.json index 5a064c1..fafcab7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,10 @@ "lint:fix": "eslint --fix", "format": "prettier --write \"src/**/*.{ts,vue,json}\"", "format:check": "prettier --check \"src/**/*.{ts,vue,json}\"", - "wagmi:gen": "wagmi generate" + "wagmi:gen": "wagmi generate", + "test": "vitest run --passWithNoTests", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage" }, "dependencies": { "@floating-ui/vue": "^1.1.11", diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..37e6d23 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,40 @@ +import { fileURLToPath, URL } from 'node:url'; +import { defineConfig, mergeConfig } from 'vitest/config'; +import viteConfig from './vite.config'; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + environment: 'happy-dom', + globals: true, + include: ['tests/**/*.{test,spec}.ts'], + exclude: [ + 'p2pix-smart-contracts/**', + 'vendor/**', + '**/node_modules/**', + ], + coverage: { + provider: 'v8', + reporter: ['text', 'html', 'lcov'], + include: ['src/**/*.{ts,vue}'], + exclude: [ + 'src/main.ts', + 'src/router/**', + 'src/assets/**', + 'src/generated.ts', + 'src/subgraph/generated.ts', + '**/*.d.ts', + '**/__mocks__/**', + 'p2pix-smart-contracts/**', + 'vendor/**', + ], + }, + }, + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, + }, + }), +);