-
Notifications
You must be signed in to change notification settings - Fork 479
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 23 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
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,22 @@ | ||
import { it, describe, expect } from 'vitest' | ||
import getCommand from '../utils/getCommand' | ||
|
||
describe("should generate correct command", () => { | ||
it('for yarn', () => { | ||
expect(getCommand('yarn', 'install')).toBe('yarn') | ||
expect(getCommand('yarn', 'dev')).toBe('yarn dev') | ||
expect(getCommand('yarn', 'build')).toBe('yarn build') | ||
|
||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) | ||
it('for npm', () => { | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(getCommand('npm', 'install')).toBe('npm install') | ||
expect(getCommand('npm', 'dev')).toBe('npm run dev') | ||
expect(getCommand('npm', 'build')).toBe('npm run build') | ||
|
||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) | ||
it('for pnpm', () => { | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(getCommand('pnpm', 'install')).toBe('pnpm install') | ||
expect(getCommand('pnpm', 'dev')).toBe('pnpm dev') | ||
expect(getCommand('pnpm', 'build')).toBe('pnpm build') | ||
}) | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) |
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,80 @@ | ||
import { it, describe, expect } from 'vitest' | ||
import sortDependencies from '../utils/sortDependencies' | ||
|
||
describe('should output correct sorted value', () => { | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
it('#1', () => { | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const packageJson = { | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^4.4.0", | ||
"@vitejs/plugin-vue-jsx": "^3.0.2", | ||
"eslint": "^8.49.0", | ||
"eslint-plugin-cypress": "^2.15.1", | ||
"vite": "^4.4.11", | ||
"vitest": "^0.34.6", | ||
"@vue/test-utils": "^2.4.1", | ||
"cypress": "^13.3.1", | ||
"eslint-plugin-vue": "^9.17.0", | ||
"jsdom": "^22.1.0", | ||
"start-server-and-test": "^2.0.1", | ||
} | ||
} | ||
expect(sortDependencies(packageJson)).toStrictEqual({ | ||
"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" | ||
} | ||
} | ||
) | ||
}) | ||
it('#2', () => { | ||
CoolPlayLin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.
Uh oh!
There was an error while loading. Please reload this page.