env:
CYPRESS_INSTALL_BINARY: 0
- run: pnpm build
+ - run: pnpm test:unit
# Use cache to share the output across different jobs
# No need to cache node_modules because they are all bundled
--- /dev/null
+import { it, describe, expect } from 'vitest'
+import getCommand from '../utils/getCommand'
+
+describe('getCommand', () => {
+ it('should generate the correct command for yarn', () => {
+ expect(getCommand('yarn', 'install')).toBe('yarn')
+ expect(getCommand('yarn', 'dev')).toBe('yarn dev')
+ expect(getCommand('yarn', 'build')).toBe('yarn build')
+ })
+ it('should generate the correct command for npm', () => {
+ expect(getCommand('npm', 'install')).toBe('npm install')
+ expect(getCommand('npm', 'dev')).toBe('npm run dev')
+ expect(getCommand('npm', 'build')).toBe('npm run build')
+ })
+ it('should generate the correct command for pnpm', () => {
+ expect(getCommand('pnpm', 'install')).toBe('pnpm install')
+ expect(getCommand('pnpm', 'dev')).toBe('pnpm dev')
+ expect(getCommand('pnpm', 'build')).toBe('pnpm build')
+ })
+})
--- /dev/null
+import { it, describe, expect } from 'vitest'
+import sortDependencies from '../utils/sortDependencies'
+
+describe('sortDependencies', () => {
+ it('should sort dependencies and dev dependencies', () => {
+ const packageJson = {
+ dependencies: {
+ vue: '^3.3.4',
+ 'vue-router': '^4.2.5',
+ pinia: '^2.1.7'
+ },
+ devDependencies: {
+ '@vitejs/plugin-vue-jsx': '^3.0.2',
+ jsdom: '^22.1.0',
+ 'start-server-and-test': '^2.0.1',
+ vite: '^4.4.11',
+ '@vue/test-utils': '^2.4.1',
+ cypress: '^13.3.1',
+ eslint: '^8.49.0',
+ '@vitejs/plugin-vue': '^4.4.0',
+ 'eslint-plugin-cypress': '^2.15.1',
+ 'eslint-plugin-vue': '^9.17.0',
+ vitest: '^0.34.6'
+ }
+ }
+ expect(sortDependencies(packageJson)).toStrictEqual({
+ dependencies: {
+ pinia: '^2.1.7',
+ vue: '^3.3.4',
+ 'vue-router': '^4.2.5'
+ },
+ devDependencies: {
+ '@vitejs/plugin-vue': '^4.4.0',
+ '@vitejs/plugin-vue-jsx': '^3.0.2',
+ '@vue/test-utils': '^2.4.1',
+ cypress: '^13.3.1',
+ eslint: '^8.49.0',
+ 'eslint-plugin-cypress': '^2.15.1',
+ 'eslint-plugin-vue': '^9.17.0',
+ jsdom: '^22.1.0',
+ 'start-server-and-test': '^2.0.1',
+ vite: '^4.4.11',
+ vitest: '^0.34.6'
+ }
+ })
+ })
+})
"snapshot": "zx ./scripts/snapshot.mjs",
"pretest": "run-s build snapshot",
"test": "zx ./scripts/test.mjs",
+ "test:unit": "vitest",
"prepublishOnly": "zx ./scripts/prepublish.mjs"
},
"repository": {
"npm-run-all2": "^6.1.1",
"prettier": "^3.1.0",
"prompts": "^2.4.2",
+ "vitest": "^0.34.6",
"zx": "^7.2.3"
},
"lint-staged": {
prompts:
specifier: ^2.4.2
version: 2.4.2
+ vitest:
+ specifier: ^0.34.6
+ version: 0.34.6(jsdom@22.1.0)
zx:
specifier: ^7.2.3
version: 7.2.3
--- /dev/null
+import { defineConfig } from 'vitest/config'
+
+export default defineConfig({
+ test: {
+ include: ['__test__/**.spec.ts']
+ }
+})