forked from getsentry/sentry-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.json
More file actions
150 lines (147 loc) · 6.38 KB
/
launch.json
File metadata and controls
150 lines (147 loc) · 6.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// For available variables, visit: https://code.visualstudio.com/docs/editor/variables-reference
"version": "0.2.0",
"inputs": [
{
// Get the name of the package containing the file in the active tab.
"id": "getPackageName",
"type": "command",
"command": "shellCommand.execute",
"args": {
// Get the current file's absolute path, chop off everything up to and including the repo's `packages`
// directory, then split on `/` and take the first entry
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
"cwd": "${workspaceFolder}",
// normally `input` commands bring up a selector for the user, but given that there should only be one
// choice here, this lets us skip the prompt
"useSingleResult": true
}
}
],
"configurations": [
// Debug the ts-node script in the currently active window
{
"name": "Debug ts-node script (open file)",
"type": "pwa-node",
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": ["ts-node", "-P", "${workspaceFolder}/tsconfig.dev.json", "${file}"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
// Run rollup using the config file which is in the currently active tab.
{
"name": "Debug rollup (config from open file)",
"type": "pwa-node",
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": ["rollup", "-c", "${file}"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
// Run a specific test file in watch mode (must have file in currently active tab when hitting the play button).
// NOTE: If you try to run this and VSCode complains that the command `shellCommand.execute` can't be found, go
// install the recommended extension Tasks Shell Input.
{
"name": "Debug unit tests - just open file",
"type": "node",
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--watch",
// this runs one test at a time, rather than running them in parallel (necessary for debugging so that you know
// you're hitting a single test's breakpoints, in order)
"--runInBand",
// coverage messes up the source maps
"--coverage",
"false",
// remove this to run all package tests
"${relativeFile}"
],
"sourceMaps": true,
"smartStep": true,
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
// "outputCapture" option here; default is to show console logs), but not both
"console": "integratedTerminal",
// since we're not using it, don't automatically switch to it
"internalConsoleOptions": "neverOpen"
},
// Run a specific test file in watch mode (must have file in currently active tab when hitting the play button).
// NOTE: If you try to run this and VSCode complains that the command `shellCommand.execute` can't be found, go
// install the recommended extension Tasks Shell Input.
{
"name": "Debug playwright tests (just open file)",
"type": "pwa-node",
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": [
// `nodemon` is basically `node --watch`
"nodemon",
// be default it only watches JS files, so have it watch TS files instead
"--ext",
"ts",
"${workspaceFolder}/node_modules/playwright/node_modules/.bin/playwright",
"test",
"${file}"
],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
// show stdout and stderr output in the debug console
"outputCapture": "std"
},
// @sentry/nextjs - Run a specific integration test file
// Must have test file in currently active tab when hitting the play button, and must already have run `yarn` in test app directory
{
"name": "Debug @sentry/nextjs integration tests - just open file",
"type": "node",
"cwd": "${workspaceFolder}/packages/nextjs",
"request": "launch",
// since we're not using the normal test runner, we need to make sure we're using the current version of all local
// SDK packages and then manually rebuild the test app
"preLaunchTask": "Prepare nextjs integration test app for debugging",
// running `server.js` directly (rather than running the tests through yarn) allows us to skip having to reinstall
// dependencies on every new test run
"program": "${workspaceFolder}/packages/nextjs/test/integration/test/server.js",
"args": [
"--debug",
// remove these two lines to run all integration tests
"--filter",
"${fileBasename}"
],
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
// this controls which files are sourcemapped
"outFiles": [
// our SDK code
"${workspaceFolder}/**/cjs/**/*.js",
// the built test app
"${workspaceFolder}/packages/nextjs/test/integration/.next/**/*.js",
"!**/node_modules/**"
],
"resolveSourceMapLocations": [
"${workspaceFolder}/**/cjs/**",
"${workspaceFolder}/packages/nextjs/test/integration/.next/**",
"!**/node_modules/**"
],
"internalConsoleOptions": "openOnSessionStart"
}
]
}