mirror of
https://github.com/lights0123/n-link.git
synced 2026-08-08 10:43:29 +00:00
test: set up vitest for n-link-core components
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9b71c3ba76
commit
8578541f1e
|
|
@ -7,7 +7,8 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri"
|
"tauri": "tauri",
|
||||||
|
"test": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.11.1",
|
"@tauri-apps/api": "^2.11.1",
|
||||||
|
|
@ -23,12 +24,15 @@
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tauri-apps/cli": "^2",
|
"@tauri-apps/cli": "^2",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
"@vue/test-utils": "^2.4.6",
|
||||||
"autoprefixer": "^10.5.4",
|
"autoprefixer": "^10.5.4",
|
||||||
|
"happy-dom": "^15.11.7",
|
||||||
"postcss": "^8.5.21",
|
"postcss": "^8.5.21",
|
||||||
"sass": "^1.101.3",
|
"sass": "^1.101.3",
|
||||||
"tailwindcss": "^3.4.19",
|
"tailwindcss": "^3.4.19",
|
||||||
"typescript": "~5.6.2",
|
"typescript": "~5.6.2",
|
||||||
"vite": "^6.0.3",
|
"vite": "^6.0.3",
|
||||||
|
"vitest": "^2.1.8",
|
||||||
"vue-tsc": "^2.1.10"
|
"vue-tsc": "^2.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
desktop/vitest.config.ts
Normal file
16
desktop/vitest.config.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
import vue from '@vitejs/plugin-vue';
|
||||||
|
import { fileURLToPath, URL } from 'node:url';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'n-link-core': fileURLToPath(new URL('../n-link-core', import.meta.url)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
environment: 'happy-dom',
|
||||||
|
include: ['../n-link-core/components/**/*.spec.ts', 'src/**/*.spec.ts'],
|
||||||
|
},
|
||||||
|
});
|
||||||
11
n-link-core/components/smoke.spec.ts
Normal file
11
n-link-core/components/smoke.spec.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import { defineComponent, h } from 'vue';
|
||||||
|
|
||||||
|
describe('vitest setup', () => {
|
||||||
|
it('mounts a component', () => {
|
||||||
|
const C = defineComponent({ render: () => h('div', 'hello') });
|
||||||
|
const wrapper = mount(C);
|
||||||
|
expect(wrapper.text()).toBe('hello');
|
||||||
|
});
|
||||||
|
});
|
||||||
1944
package-lock.json
generated
1944
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue