-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Storage] Enable VS Code Debugging for storage packages #2770
Changes from all commits
620df6e
0579004
130588a
3d9d241
8a221ff
d591087
991d834
a2b7846
f3a4689
ab9f8d1
0a58686
c51bff9
179bc0e
71ebb89
d6895e6
5ae7564
ee7650a
364e5c0
12caebf
33d663e
fb0063d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode"] | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,58 @@ | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
// Use IntelliSense to learn about possible attributes. | ||||||||||||||||||||||||||||||||
// Hover to view descriptions of existing attributes. | ||||||||||||||||||||||||||||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||||||||||||||||||||||||||||||||
"version": "0.2.0", | ||||||||||||||||||||||||||||||||
"configurations": [ | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
"type": "node", | ||||||||||||||||||||||||||||||||
"request": "launch", | ||||||||||||||||||||||||||||||||
"name": "Debug Javascript Samples", | ||||||||||||||||||||||||||||||||
"program": "${workspaceFolder}/samples/javascript/basic.js", | ||||||||||||||||||||||||||||||||
"preLaunchTask": "npm: build:js-samples" | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
"type": "node", | ||||||||||||||||||||||||||||||||
"request": "launch", | ||||||||||||||||||||||||||||||||
"name": "Debug Typescript Samples", | ||||||||||||||||||||||||||||||||
"program": "${workspaceFolder}/samples/typescript/basic.ts", | ||||||||||||||||||||||||||||||||
"preLaunchTask": "npm: build:ts-samples", | ||||||||||||||||||||||||||||||||
"outFiles": ["${workspaceFolder}/dist-esm/samples/typescript/*.js"] | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is able to add a debug config to test "current" test file? Especially useful to debug one failed case in one file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems I didn't find it, where is the entry? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. azure-sdk-for-js/sdk/storage/storage-blob/.vscode/launch.json Lines 22 to 36 in 5ae7564
|
||||||||||||||||||||||||||||||||
"type": "node", | ||||||||||||||||||||||||||||||||
"request": "launch", | ||||||||||||||||||||||||||||||||
"name": "Debug Mocha Test [Without Rollup]", | ||||||||||||||||||||||||||||||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||||||||||||||||||||||||||||||||
"args": [ | ||||||||||||||||||||||||||||||||
"-r", | ||||||||||||||||||||||||||||||||
"ts-node/register", | ||||||||||||||||||||||||||||||||
"--timeout", | ||||||||||||||||||||||||||||||||
"999999", | ||||||||||||||||||||||||||||||||
"--colors", | ||||||||||||||||||||||||||||||||
"${workspaceFolder}/test/*.spec.ts" | ||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||
"env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, | ||||||||||||||||||||||||||||||||
"envFile": "${workspaceFolder}/../.env", | ||||||||||||||||||||||||||||||||
"console": "integratedTerminal", | ||||||||||||||||||||||||||||||||
"internalConsoleOptions": "neverOpen", | ||||||||||||||||||||||||||||||||
"protocol": "inspector" | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
"type": "node", | ||||||||||||||||||||||||||||||||
"request": "launch", | ||||||||||||||||||||||||||||||||
"name": "Debug Unit Tests", | ||||||||||||||||||||||||||||||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||||||||||||||||||||||||||||||||
"args": [ | ||||||||||||||||||||||||||||||||
"-u", | ||||||||||||||||||||||||||||||||
"tdd", | ||||||||||||||||||||||||||||||||
"--timeout", | ||||||||||||||||||||||||||||||||
"999999", | ||||||||||||||||||||||||||||||||
"--colors", | ||||||||||||||||||||||||||||||||
"${workspaceFolder}/dist-test/index.node.js" | ||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||
"internalConsoleOptions": "openOnSessionStart", | ||||||||||||||||||||||||||||||||
"preLaunchTask": "npm: build:test" | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.DS_Store": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[json]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[yaml]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"editor.rulers": [ | ||
100 | ||
], | ||
"typescript.preferences.quoteStyle": "double", | ||
"javascript.preferences.quoteStyle": "double" | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -79,6 +79,8 @@ | |||
"build:browserzip": "gulp zip", | ||||
"build:es6": "tsc -p tsconfig.json", | ||||
"build:nodebrowser": "rollup -c 2>&1", | ||||
"build:js-samples": "npm run clean && npm run build:es6 && cross-env ONLY_NODE=true rollup -c 2>&1", | ||||
"build:ts-samples": "npm run clean && cd samples && tsc -p . ", | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For debugging the samples, Or something like cc: @bsiegel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those script names are fine, the build system doesn't care about any aside from the ones that are in the documentation. Personally I like those names. I'm mildly curious why the build:js-samples seems to do the exact same thing as the regular "build" script (except it doesn't generate a zipfile). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the command build:js-samples ,instead of doing npm run build:nodebrowser , we can just do cross-env ONLY_NODE=true rollup -c 2>&1 and successfully execute & debug the samples.
|
||||
"build:test": "npm run build:es6 && rollup -c rollup.test.config.js 2>&1", | ||||
"build": "npm run build:es6 && npm run build:nodebrowser && npm run build:browserzip", | ||||
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
Aborter, | ||
BlobServiceClient, | ||
StorageClient | ||
} from "../.."; // Change to "@azure/storage-blob" in your package | ||
} from "../../src"; // Change to "@azure/storage-blob" in your package | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jeremymeng There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update - When the above script is executed as part of "preLaunchTask"[VSCode debug config], the execution fails when the exact path "src" is not provided. |
||
|
||
async function main() { | ||
// Fill in following settings before running this sample | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Javascript Samples", | ||
"program": "${workspaceFolder}/samples/javascript/basic.js", | ||
"preLaunchTask": "npm: build:js-samples" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Typescript Samples", | ||
"program": "${workspaceFolder}/samples/typescript/basic.ts", | ||
"preLaunchTask": "npm: build:ts-samples", | ||
"outFiles": ["${workspaceFolder}/dist-esm/samples/typescript/*.js"] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Mocha Test [Without Rollup]", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-r", | ||
"ts-node/register", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/test/*.spec.ts" | ||
], | ||
"env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, | ||
"envFile": "${workspaceFolder}/../.env", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
"protocol": "inspector" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Unit Tests", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/dist-test/index.node.js" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"preLaunchTask": "npm: build:test" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.DS_Store": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[json]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[yaml]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"editor.rulers": [ | ||
100 | ||
], | ||
"typescript.preferences.quoteStyle": "double", | ||
"javascript.preferences.quoteStyle": "double" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Javascript Samples", | ||
"program": "${workspaceFolder}/samples/javascript/basic.js", | ||
"preLaunchTask": "npm: build:js-samples" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Typescript Samples", | ||
"program": "${workspaceFolder}/samples/typescript/basic.ts", | ||
"preLaunchTask": "npm: build:ts-samples", | ||
"outFiles": ["${workspaceFolder}/dist-esm/samples/typescript/*.js"] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Mocha Test [Without Rollup]", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-r", | ||
"ts-node/register", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/test/*.spec.ts" | ||
], | ||
"env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, | ||
"envFile": "${workspaceFolder}/../.env", | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
"protocol": "inspector" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Unit Tests", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/dist-test/index.node.js" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"preLaunchTask": "npm: build:test" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.DS_Store": true | ||
}, | ||
"[typescript]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[json]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"[yaml]": { | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"editor.detectIndentation": false | ||
}, | ||
"editor.rulers": [ | ||
100 | ||
], | ||
"typescript.preferences.quoteStyle": "double", | ||
"javascript.preferences.quoteStyle": "double" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!