|
3 | 3 | // Hover to view descriptions of existing attributes. |
4 | 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
5 | 5 | "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 | + ], |
7 | 20 | "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. |
11 | 24 | { |
| 25 | + "name": "Debug unit tests - just open file", |
12 | 26 | "type": "node", |
| 27 | + "cwd": "${workspaceFolder}/packages/${input:getPackageName}", |
13 | 28 | "request": "launch", |
14 | | - "cwd": "${workspaceFolder}/packages/core", |
15 | | - "name": "Debug @sentry/core tests - just open file", |
16 | 29 | "program": "${workspaceFolder}/node_modules/.bin/jest", |
17 | 30 | "args": [ |
18 | 31 | "--watch", |
| 32 | + // this makes the output less noisy (and at some point in the past seemed necessary to fix... something) |
19 | 33 | "--runInBand", |
| 34 | + // TODO: when we unify jest config, we may need to change this |
20 | 35 | "--config", |
21 | | - "${workspaceFolder}/packages/core/package.json", |
| 36 | + "${workspaceFolder}/packages/${input:getPackageName}/package.json", |
| 37 | + // coverage messes up the source maps |
22 | 38 | "--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}" |
25 | 42 | ], |
26 | | - "disableOptimisticBPs": true, |
27 | 43 | "sourceMaps": true, |
28 | 44 | "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", |
31 | 50 | }, |
32 | 51 |
|
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 | | - }, |
56 | 52 |
|
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 test file in currently active tab when hitting the play button, and must already have run `yarn` in test app directory |
59 | 55 | { |
| 56 | + "name": "Debug @sentry/nextjs integration tests - just open file", |
60 | 57 | "type": "node", |
61 | | - "request": "launch", |
62 | 58 | "cwd": "${workspaceFolder}/packages/nextjs", |
63 | | - "name": "Debug @sentry/nextjs integration tests - just open file", |
64 | | - // TODO create a build task |
65 | | - // "preLaunchTask": "yarn build", |
| 59 | + "request": "launch", |
| 60 | + // since we're not using the normal test runner, we need to make sure we're using the current version of all local |
| 61 | + // SDK packages and then manually rebuild the test app |
| 62 | + "preLaunchTask": "Prepare nextjs integration test app for debugging", |
| 63 | + // running `server.js` directly (rather than running the tests through yarn) allows us to skip having to reinstall |
| 64 | + // dependencies on every new test run |
66 | 65 | "program": "${workspaceFolder}/packages/nextjs/test/integration/test/server.js", |
67 | 66 | "args": [ |
68 | 67 | "--debug", |
69 | 68 | // remove these two lines to run all integration tests |
70 | 69 | "--filter", |
71 | 70 | "${fileBasename}" |
72 | 71 | ], |
73 | | - "disableOptimisticBPs": true, |
74 | | - "sourceMaps": true, |
75 | | - "skipFiles": [ |
76 | | - "<node_internals>/**", "**/tslib/**" |
77 | | - ], |
78 | | - }, |
79 | 72 |
|
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 |
| 73 | + "skipFiles": [ |
| 74 | + "<node_internals>/**", |
| 75 | + // this prevents us from landing in a neverending cycle of TS async-polyfill functions as we're stepping through |
| 76 | + // our code |
| 77 | + "${workspaceFolder}/node_modules/tslib/**/*" |
96 | 78 | ], |
97 | | - "disableOptimisticBPs": true, |
98 | 79 | "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 |
| 80 | + // this controls which files are sourcemapped |
| 81 | + "outFiles": [ |
| 82 | + // our SDK code |
| 83 | + "${workspaceFolder}/**/dist/**/*.js", |
| 84 | + // the built test app |
| 85 | + "${workspaceFolder}/packages/nextjs/test/integration/.next/**/*.js", |
| 86 | + "!**/node_modules/**" |
120 | 87 | ], |
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 |
| 88 | + "resolveSourceMapLocations": [ |
| 89 | + "${workspaceFolder}/**/dist/**", |
| 90 | + "${workspaceFolder}/packages/nextjs/test/integration/.next/**", |
| 91 | + "!**/node_modules/**" |
144 | 92 | ], |
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 |
| 93 | + "internalConsoleOptions": "openOnSessionStart" |
| 94 | + |
150 | 95 | }, |
151 | 96 | ] |
152 | 97 | } |
0 commit comments