-
Notifications
You must be signed in to change notification settings - Fork 6
feat(vitest): support vitest v4 #71
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
4 commits
Select commit
Hold shift + click to select a range
229fd77
chore: update lock file format
adriencaccia 866b5e1
feat(vitest): support vitest v4
colinaaa 4613be9
feat(vitest-plugin): retrieve vitest major version to know which conf…
adriencaccia 485c0ca
chore: bump vitest to v4 in examples and add explicit vitest v3 examp…
adriencaccia 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,13 @@ | ||
| { | ||
| "name": "with-vitest-v3", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "bench-vitest": "vitest bench --run" | ||
| }, | ||
| "devDependencies": { | ||
| "@codspeed/vitest-plugin": "workspace:*", | ||
| "typescript": "^5.1.3", | ||
| "vitest": "^3.2.4" | ||
| } | ||
| } |
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 { bench, describe } from "vitest"; | ||
| import { iterativeFibonacci, recursiveFibonacci } from "./fibonacci"; | ||
|
|
||
| describe("fibonacci", () => { | ||
| bench("recursive fibo 15", () => { | ||
| recursiveFibonacci(15); | ||
| }); | ||
|
|
||
| bench("recursive fibo 20", () => { | ||
| recursiveFibonacci(20); | ||
| }); | ||
|
|
||
| bench("iterative fibo 15", () => { | ||
| iterativeFibonacci(15); | ||
| }); | ||
|
|
||
| bench("iterative fibo 20", () => { | ||
| iterativeFibonacci(20); | ||
| }); | ||
| }); |
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,17 @@ | ||
| export function recursiveFibonacci(n: number): number { | ||
| if (n < 2) { | ||
| return n; | ||
| } | ||
| return recursiveFibonacci(n - 1) + recursiveFibonacci(n - 2); | ||
| } | ||
|
|
||
| export function iterativeFibonacci(n: number): number { | ||
| let a = 0; | ||
| let b = 1; | ||
| for (let i = 0; i < n; i++) { | ||
| const temp = a + b; | ||
| a = b; | ||
| b = temp; | ||
| } | ||
| return a; | ||
| } |
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,13 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "lib": ["es2023"], | ||
| "module": "ESNext", | ||
| "verbatimModuleSyntax": true, | ||
| "target": "es2022", | ||
| "strict": true, | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "moduleResolution": "Node" | ||
| } | ||
| } |
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,6 @@ | ||
| import codspeedPlugin from "@codspeed/vitest-plugin"; | ||
| import { defineConfig } from "vitest/config"; | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [codspeedPlugin()], | ||
| }); |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.