From 1b02f105dc735395e907705455fb8de0ac7b2699 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Thu, 7 Jul 2022 07:50:14 -0700 Subject: [PATCH] Add config for vscode-jest extension Summary: Provides a much nicer devx, shows test pass / failure in the editor and error messages in line https://pxl.cl/25G0x When the extension is installed with this config it will watch all test and run what is needed, automatically updating the editor with test status It also supports debugging tests individually right in the editor see https://github.com/jest-community/vscode-jest for full docs Also Once VS code @ fb is updated to a newer base of vscode, we will get access to to the testing sidebar feature https://pxl.cl/25G0R Reviewed By: lblasa, aigoncharov Differential Revision: D37009812 fbshipit-source-id: e1918a0817d4703089b6300840fcf9564b871682 --- desktop/.vscode/launch.json | 14 ++++++++++++++ desktop/.vscode/settings.json | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/desktop/.vscode/launch.json b/desktop/.vscode/launch.json index 9a569efdc..ce0914950 100644 --- a/desktop/.vscode/launch.json +++ b/desktop/.vscode/launch.json @@ -46,6 +46,20 @@ "protocol": "inspector", "internalConsoleOptions": "openOnSessionStart", "runtimeArgs": ["--require", "ts-node/register"] + }, + { + "type": "node", + "name": "vscode-jest-tests", + "request": "launch", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "disableOptimisticBPs": true, + "program": "${workspaceFolder}/node_modules/.bin/jest", + "cwd": "${workspaceFolder}", + "args": ["--config", "jest.config.js", "--runInBand", "--watchAll=false"], + "env": { + "TZ": "Pacific/Pohnpei" + } } ], "compounds": [ diff --git a/desktop/.vscode/settings.json b/desktop/.vscode/settings.json index 3bc74cf41..026519bec 100644 --- a/desktop/.vscode/settings.json +++ b/desktop/.vscode/settings.json @@ -32,5 +32,10 @@ "jest.runAllTestsFirst": false, "jest.pathToConfig": "jest.config.js", "jest.pathToJest": "node_modules/.bin/jest", - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + "jest.jestCommandLine": "export TZ=Pacific/Pohnpei; node_modules/.bin/jest --config jest.config.js", + "jest.autoRun": { + "watch": true, + "onStartup": ["all-tests"] + } }