Skip to content

Commit a209ce9

Browse files
committed
unify unit test config
1 parent 5c31e41 commit a209ce9

File tree

1 file changed

+38
-112
lines changed

1 file changed

+38
-112
lines changed

.vscode/launch.json

Lines changed: 38 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -3,150 +3,76 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
6-
// TODO: these are all alike save the package, so figure out how to make that variable
6+
"inputs": [
7+
{
8+
"id": "getPackageName",
9+
"type": "command",
10+
"command": "shellCommand.execute",
11+
"args": {
12+
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
13+
"cwd": "${workspaceFolder}" ,
14+
// normally `input` commands bring up a selector for the user, but given that there should only be one
15+
// choice here, this lets us skip the prompt
16+
"useSingleResult": true
17+
}
18+
}
19+
],
720
"configurations": [
8-
9-
// @sentry/core - run a specific test file in watch mode
10-
// must have file in currently active tab when hitting the play button
21+
// Run a specific test file in watch mode (must have file in currently active tab when hitting the play button).
22+
// NOTE: If you try to run this and VSCode complains that the command `shellCommand.execute` can't be found, go
23+
// install the recommended extension Tasks Shell Input.
1124
{
25+
"name": "Debug unit tests - just open file",
1226
"type": "node",
27+
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
1328
"request": "launch",
14-
"cwd": "${workspaceFolder}/packages/core",
15-
"name": "Debug @sentry/core tests - just open file",
1629
"program": "${workspaceFolder}/node_modules/.bin/jest",
1730
"args": [
1831
"--watch",
32+
// this makes the output less noisy (and at some point in the past seemed necessary to fix... something)
1933
"--runInBand",
34+
// TODO: when we unify jest config, we may need to change this
2035
"--config",
21-
"${workspaceFolder}/packages/core/package.json",
36+
"${workspaceFolder}/packages/${input:getPackageName}/package.json",
37+
// coverage messes up the source maps
2238
"--coverage",
23-
"false", // coverage messes up the source maps
24-
"${relativeFile}" // remove this to run all package tests
39+
"false",
40+
// remove this to run all package tests
41+
"${relativeFile}"
2542
],
26-
"disableOptimisticBPs": true,
2743
"sourceMaps": true,
2844
"smartStep": true,
29-
"console": "integratedTerminal", // otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on "outputCapture" option here), but not both
30-
"internalConsoleOptions": "neverOpen", // since we're not using it, don't automatically switch to it
45+
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
46+
// "outputCapture" option here; default is to show console logs), but not both
47+
"console": "integratedTerminal",
48+
// since we're not using it, don't automatically switch to it
49+
"internalConsoleOptions": "neverOpen",
3150
},
3251

33-
// @sentry/nextjs - run a specific test file in watch mode
34-
// must have file in currently active tab when hitting the play button
35-
{
36-
"type": "node",
37-
"request": "launch",
38-
"cwd": "${workspaceFolder}/packages/nextjs",
39-
"name": "Debug @sentry/nextjs tests - just open file",
40-
"program": "${workspaceFolder}/node_modules/.bin/jest",
41-
"args": [
42-
"--watch",
43-
"--runInBand",
44-
"--config",
45-
"${workspaceFolder}/packages/nextjs/package.json",
46-
"--coverage",
47-
"false", // coverage messes up the source maps
48-
"${relativeFile}" // remove this to run all package tests
49-
],
50-
"disableOptimisticBPs": true,
51-
"sourceMaps": true,
52-
"smartStep": true,
53-
"console": "integratedTerminal", // otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on "outputCapture" option here), but not both
54-
"internalConsoleOptions": "neverOpen", // since we're not using it, don't automatically switch to it
55-
},
5652

57-
// @sentry/nextjs - run a specific integration test file
58-
// must have file in currently active tab when hitting the play button
53+
// @sentry/nextjs - Run a specific integration test file
54+
// Must have file in currently active tab when hitting the play button
5955
{
56+
"name": "Debug @sentry/nextjs integration tests - just open file",
6057
"type": "node",
61-
"request": "launch",
6258
"cwd": "${workspaceFolder}/packages/nextjs",
63-
"name": "Debug @sentry/nextjs integration tests - just open file",
59+
"request": "launch",
6460
// TODO create a build task
6561
// "preLaunchTask": "yarn build",
62+
63+
// this is going straight to `server.js` (rather than running the tests through yarn) in order to be able to skip
64+
// having to reinstall dependencies on every new test run
6665
"program": "${workspaceFolder}/packages/nextjs/test/integration/test/server.js",
6766
"args": [
6867
"--debug",
6968
// remove these two lines to run all integration tests
7069
"--filter",
7170
"${fileBasename}"
7271
],
73-
"disableOptimisticBPs": true,
7472
"sourceMaps": true,
7573
"skipFiles": [
7674
"<node_internals>/**", "**/tslib/**"
7775
],
7876
},
79-
80-
// @sentry/node - run a specific test file in watch mode
81-
// must have file in currently active tab when hitting the play button
82-
{
83-
"type": "node",
84-
"request": "launch",
85-
"cwd": "${workspaceFolder}/packages/node",
86-
"name": "Debug @sentry/node tests - just open file",
87-
"program": "${workspaceFolder}/node_modules/.bin/jest",
88-
"args": [
89-
"--watch",
90-
"--runInBand",
91-
"--config",
92-
"${workspaceFolder}/packages/node/package.json",
93-
"--coverage",
94-
"false", // coverage messes up the source maps
95-
"${relativeFile}" // remove this to run all package tests
96-
],
97-
"disableOptimisticBPs": true,
98-
"sourceMaps": true,
99-
"smartStep": true,
100-
"console": "integratedTerminal", // otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on "outputCapture" option here), but not both
101-
"internalConsoleOptions": "neverOpen", // since we're not using it, don't automatically switch to it
102-
},
103-
104-
// @sentry/tracing - run a specific test file in watch mode
105-
// must have file in currently active tab when hitting the play button
106-
{
107-
"type": "node",
108-
"request": "launch",
109-
"cwd": "${workspaceFolder}/packages/tracing",
110-
"name": "Debug @sentry/tracing tests - just open file",
111-
"program": "${workspaceFolder}/node_modules/.bin/jest",
112-
"args": [
113-
"--watch",
114-
"--runInBand",
115-
"--config",
116-
"${workspaceFolder}/packages/tracing/package.json",
117-
"--coverage",
118-
"false", // coverage messes up the source maps
119-
"${relativeFile}" // remove this to run all package tests
120-
],
121-
"disableOptimisticBPs": true,
122-
"sourceMaps": true,
123-
"smartStep": true,
124-
"console": "integratedTerminal", // otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on "outputCapture" option here), but not both
125-
"internalConsoleOptions": "neverOpen", // since we're not using it, don't automatically switch to it
126-
},
127-
128-
// @sentry/utils - run a specific test file in watch mode
129-
// must have file in currently active tab when hitting the play button
130-
{
131-
"type": "node",
132-
"request": "launch",
133-
"cwd": "${workspaceFolder}/packages/utils",
134-
"name": "Debug @sentry/utils tests - just open file",
135-
"program": "${workspaceFolder}/node_modules/.bin/jest",
136-
"args": [
137-
"--watch",
138-
"--runInBand",
139-
"--config",
140-
"${workspaceFolder}/packages/utils/package.json",
141-
"--coverage",
142-
"false", // coverage messes up the source maps
143-
"${relativeFile}" // remove this to run all package tests
144-
],
145-
"disableOptimisticBPs": true,
146-
"sourceMaps": true,
147-
"smartStep": true,
148-
"console": "integratedTerminal", // otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on "outputCapture" option here), but not both
149-
"internalConsoleOptions": "neverOpen", // since we're not using it, don't automatically switch to it
150-
},
15177
]
15278
}

0 commit comments

Comments
 (0)