From 55dc14772d9db82e06073dfe9b041d915f8b787f Mon Sep 17 00:00:00 2001 From: erkelost <1256029807@qq.com> Date: Wed, 27 Sep 2023 17:40:29 +0800 Subject: [PATCH 1/4] fix: test error --- .../__tests__/__snapshots__/compileTemplate.spec.ts.snap | 8 +++++--- crates/fervid_napi/__tests__/compileTemplate.spec.ts | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/fervid_napi/__tests__/__snapshots__/compileTemplate.spec.ts.snap b/crates/fervid_napi/__tests__/__snapshots__/compileTemplate.spec.ts.snap index ade3579..01dfc0c 100644 --- a/crates/fervid_napi/__tests__/__snapshots__/compileTemplate.spec.ts.snap +++ b/crates/fervid_napi/__tests__/__snapshots__/compileTemplate.spec.ts.snap @@ -115,7 +115,7 @@ export default { item2, index ]) - }) + }, null, 2) ]), false ? (_openBlock(), _createElementBlock(_Fragment, null, [ _createTextVNode(\\" this is a v-if template \\") @@ -137,9 +137,11 @@ export default { } ]), textContent: _ctx.foo + _ctx.bar - }) + }, null, 4) ]) - })), [ + }, 8, [ + \\"test-bound\\" + ])), [ [ _directive_test_directive, foo - bar, diff --git a/crates/fervid_napi/__tests__/compileTemplate.spec.ts b/crates/fervid_napi/__tests__/compileTemplate.spec.ts index 59b0e7c..7058dd7 100644 --- a/crates/fervid_napi/__tests__/compileTemplate.spec.ts +++ b/crates/fervid_napi/__tests__/compileTemplate.spec.ts @@ -4,8 +4,7 @@ import { join } from 'node:path' import { cwd } from 'node:process' import { compileSync } from '../index' - -const input = readFileSync(join(cwd(), '../crates/fervid/benches/fixtures/input.vue'), { +const input = readFileSync(join(cwd(), '../fervid/benches/fixtures/input.vue'), { encoding: 'utf-8', }) From 5c9341331725d8779866c066354e0e598a05610f Mon Sep 17 00:00:00 2001 From: erkelost <1256029807@qq.com> Date: Wed, 27 Sep 2023 17:44:25 +0800 Subject: [PATCH 2/4] chore: update config --- crates/fervid_napi/vitest.config.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crates/fervid_napi/vitest.config.ts diff --git a/crates/fervid_napi/vitest.config.ts b/crates/fervid_napi/vitest.config.ts new file mode 100644 index 0000000..6cc8b72 --- /dev/null +++ b/crates/fervid_napi/vitest.config.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + include: ['**/*.spec.ts'], + coverage: { + reporter: ['json'], + }, + environment: 'node', + deps: { + interopDefault: false, + }, + }, +}) From e35db6bbb89c9146cdd5e8659887508ba32afb55 Mon Sep 17 00:00:00 2001 From: erkelost <1256029807@qq.com> Date: Wed, 27 Sep 2023 17:47:04 +0800 Subject: [PATCH 3/4] chore: update config --- crates/fervid_napi/__tests__/compileTemplate.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/fervid_napi/__tests__/compileTemplate.spec.ts b/crates/fervid_napi/__tests__/compileTemplate.spec.ts index 7058dd7..8083155 100644 --- a/crates/fervid_napi/__tests__/compileTemplate.spec.ts +++ b/crates/fervid_napi/__tests__/compileTemplate.spec.ts @@ -1,10 +1,9 @@ import { test, expect } from 'vitest' import { readFileSync } from 'node:fs' import { join } from 'node:path' -import { cwd } from 'node:process' import { compileSync } from '../index' -const input = readFileSync(join(cwd(), '../fervid/benches/fixtures/input.vue'), { +const input = readFileSync(join(__dirname, '../../fervid/benches/fixtures/input.vue'), { encoding: 'utf-8', }) From 49c3eebd97254692709b3bc37b1375eeecb13c01 Mon Sep 17 00:00:00 2001 From: erkelost <1256029807@qq.com> Date: Wed, 27 Sep 2023 17:47:20 +0800 Subject: [PATCH 4/4] chore: update config --- crates/fervid_napi/__tests__/compileTemplate.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fervid_napi/__tests__/compileTemplate.spec.ts b/crates/fervid_napi/__tests__/compileTemplate.spec.ts index 8083155..5343262 100644 --- a/crates/fervid_napi/__tests__/compileTemplate.spec.ts +++ b/crates/fervid_napi/__tests__/compileTemplate.spec.ts @@ -3,6 +3,7 @@ import { readFileSync } from 'node:fs' import { join } from 'node:path' import { compileSync } from '../index' + const input = readFileSync(join(__dirname, '../../fervid/benches/fixtures/input.vue'), { encoding: 'utf-8', })