@@ -7,18 +7,18 @@ parameters actually does.
77I've gone ahead and annotated all the options, hopefully this will save some time, at least until VS
88code updates its test extensions again.
99
10- #### To debug a single Jest test:
10+ #### To debug a single Vitest test:
1111
12- 1 . Open a jest test (a file that ends with \* .test.js)
12+ 1 . Open a vitest test (a file that ends with \* .test.js or \* .test.ts )
1313
14141 . Make sure the test file is selected, especially if you have multiple files open. This process
1515 will fail confusingly and without obvious error if you have not launched the debugger with the
16- actual Jest test file selected, and it's easy to accidentally click into another file if you've
16+ actual Vitest test file selected, and it's easy to accidentally click into another file if you've
1717 got a dozen open.
1818
19191 . Place a breakpoint in the margin of the file. You can place breakpoints anywhere in your source,
20- but you must launch the debugger while the jest file is selected because that is where jest and
21- webpack will start compiling. Alternatively, you can manually override the selected file in the
20+ but you must launch the debugger while the vitest file is selected because that is where vitest
21+ will start compiling. Alternatively, you can manually override the selected file in the
2222 configuration definition, like if you're testing the same file over and over again and don't want
2323 to worry about selecting it.
2424
@@ -30,7 +30,7 @@ code updates its test extensions again.
30301 . Click on the "Run and Debug" tab from the vscode icons on the left and choose the sample launch
3131 configuration (defined below) from the dropdown "run and debug". Or just hit F5.
3232
33- 1 . Wait a bit, for webpack to compile everything, eventually you should be able to hover over
33+ 1 . Wait a bit, for vitest to compile everything, eventually you should be able to hover over
3434 variables near your breakpoint and see their values in the "Variables" section of the Run and
3535 Debug pane.
3636
@@ -41,28 +41,25 @@ code updates its test extensions again.
4141 "configurations" : [
4242 {
4343 "type" : " node" ,
44- "name" : " debug selected jest test" ,
44+ "name" : " debug selected vitest test" ,
4545 "request" : " launch" ,
4646
47- // launches version of jest from inside the node_modules
47+ // launches version of vitest from inside the node_modules
4848 // this means you need to have run yarn first
49- "program" : " ${workspaceFolder}/client/node_modules/jest/bin/jest " ,
49+ "program" : " ${workspaceFolder}/client/node_modules/vitest/vitest.mjs " ,
5050 "args" : [
51- // Alias -i.
52- // Normally jest opens up a bunch of workers to run all your tests faster
53- // but we don't want that right now.
54- " --runInBand" ,
51+ // Run tests in a single thread for debugging
52+ " --no-threads" ,
5553
56- // finds jest config
57- " --config" ,
58- " ${workspaceFolder}/client/tests/jest/jest.config.js" ,
54+ // Run in watch mode so tests can be re-run
55+ " --watch" ,
5956
6057 // This is how vscode references the currently selected file
6158 " ${file}"
6259 ],
6360 "cwd" : " ${workspaceFolder}/client" ,
6461
65- // opens jest output in integrated terminal
62+ // opens vitest output in integrated terminal
6663 "console" : " integratedTerminal" ,
6764
6865 // allows you to place breakpoints right in vscode's gutter
0 commit comments