Open cshenrik opened 1 year ago
Hi @cshenrik thanks for the feature request. I will bring this up with the team about including default debug configuration in the sam init templates. As for the steps 11 and 12, this would be something to bring up with the AWS toolkit vscode. I found an issue that might be related to this https://github.com/aws/aws-toolkit-vscode/issues/3210.
Hi @hnnasit,
Thanks for replying.
I don't think this is related to the aws-toolkit plugin, as I'm not trying to run/debug the lambda function. I'm only trying to debug a Jest test.
Regards, Henrik
Describe your idea/feature/enhancement
I wish SAM CLI would make it easier to set up a new Typescript project that works out of the box with Visual Studio Code.
More specifically, I wish breakpoints in VS Code worked out of the box in Jest tests with the "Hello World Example TypeScript" starter template in SAM CLI.
Here's what I have tried:
SAM CLI v. 1.73 VSCode v. 1.75.1 Jest VSCode plugin v. 5.2.3.
sam init
. Choose "Hello World Example TypeScript" and nodejs18.x.npm install
in the hello-world folder.test-handler.test.ts
, the editor marksdescribe
,it
, andexpect
as errors.**/*.test.ts
fromexclude
in tsconfig.json. Then the above errors are fixed.lambdaHandler
function./hello-world
to the path to the Jest executable in the launch configuration.Error: Could not find a config file based on provided values: path: "/home/henrik/code/sam-jest-vscode" cwd: "/home/henrik/code/sam-jest-vscode"
/hello-world
tocwd
in the launch configuration.sourceMap
to true intsconfig.json
, but it doesn't fix the problem.Proposal
Add a Jest test launch configuration to the starter templates, so all of this just works out of the box. Also remove
**/*.test.ts
fromexclude
in tsconfig.json.