-
Notifications
You must be signed in to change notification settings - Fork 497
feat: use vitest to make unitest #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4e5dde0
feat: use vitest to make unitest
CoolPlayLin 25332c5
add getCommand unittest
CoolPlayLin 95d644a
add unittest to workflow
CoolPlayLin b41d844
add verify locale(it fails I don't know why)
CoolPlayLin 4e5284a
fix typo
CoolPlayLin c340af2
bugfix for key-checking
CoolPlayLin 5d2463a
fix
CoolPlayLin 3f9af05
Revert "fix"
CoolPlayLin b4e75ba
Squashed commit of the following:
CoolPlayLin 8f0fe1f
Merge branch 'main' into CoolPlayLin/vitest
CoolPlayLin cc65b9d
fix lock file
CoolPlayLin 3444b9c
🤔
CoolPlayLin f074859
add test for validate no unnecessary keys
CoolPlayLin a2f2e90
add locale validate
CoolPlayLin ec91736
add support for reusable locale
CoolPlayLin e4459e0
add test for `sortDependencies` & add snapshot
CoolPlayLin 39e61e2
:sparkles: feat: add error message
CoolPlayLin e7ee1f1
:bug: fix: nothing
CoolPlayLin 837838b
:bug: fix: nothing
CoolPlayLin d2aebec
:bug: fix: delete unnecessary assertions
CoolPlayLin 431cfda
:hammer: chore: delete locale test
CoolPlayLin 69b980d
:hammer: chore: delete schema
CoolPlayLin e06e995
:hammer: chore: delete 'test:update-snapshot' in package.json
CoolPlayLin ad687fb
:bug: fix: resolve suggestions in code reviews
CoolPlayLin ab7bb79
:bug: fix: delete unncessary change
CoolPlayLin b4ccf03
:hammer: chore: format test
CoolPlayLin 347cbab
Merge branch 'main' into CoolPlayLin/vitest
CoolPlayLin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
__test__/getCommand.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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') | ||
}) | ||
}) |
47 changes: 47 additions & 0 deletions
__test__/sortDependencies.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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' | ||
} | ||
}) | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
pnpm-lock.yaml
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
vitest.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ['__test__/**.spec.ts'] | ||
} | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.