Open Chriscbr opened 6 months ago
Should this be a replacement for the DEBUG env flag or should setting --debug simply set DEBUG?
I think DEBUG
and --debug
should be the same
I think DEBUG and --debug should be the same
Makes sense, I'm down for that. Once we have better support for debugging wing itself I feel like we'll have to add more nuance to this. As a user, when I add --debug
I don't necessarily want to get more verbosity for stuff outside my own code. I may not even want to change stacktraces at all, I may just want to attach a debugger.
Got it. Yes, maybe this should be --debugger
or --attach
or --inspect
(homage to node's switch).
Also, the --debug feature should already work https://github.com/winglang/wing/blob/62513f9606760376c418402c5320c7ff717bd398/apps/wing/src/cli.ts#L102-L104
Just tried it and looks like it only works for preflight errors.
So the bug to fix here is to unify https://github.com/winglang/wing/blob/62513f9606760376c418402c5320c7ff717bd398/apps/wing/src/commands/test/test.ts#L212 to work more like https://github.com/winglang/wing/blob/62513f9606760376c418402c5320c7ff717bd398/apps/wing/src/commands/compile.ts#L162-L174 and respect DEBUG
Hi there, I want to start contributing by working on this issue.
Bienvenue :) You got it @le-incroyable1-dev Let us know if you have any questions - either by leaving a comment here or on Slack.
@le-incroyable1-dev how is it going? do you need any help ?
Hi, so just to clarify I need to add the stack trace in the error output in test.ts
just like its done in compile.ts
. I tried to do that but it doesn't really seem to have any difference in the error displayed??
Yes, that's what you should do. Are you making sure you're using your local version of wing when running wing test
?
Here are some instructions, just in case: https://www.winglang.io/contributing/start-here/development
@staycoolcall911 I'm getting this error when I'm trying to run the local version of wing
I'm working on wsl
@le-incroyable1-dev Make sure to compile the CLI project first, run turbo compile -F winglang
(or pnpm turbo compile -F winglang
if you don't have turbo installed globally)
@MarkMcCulloh Whenever I try to compile or build I get the same error, I tried to find a solution for this earlier too but no luck, I'm stuck here
@le-incroyable1-dev I see the cargo: not found
error, I do remember trying to diagnose this.
Is this still within wsl? What shell are you using? Do you know which shell profile(s) are being loaded in both an interactive and non-interactive shell?
I remember that you do have rustup/cargo installed and can access it from your normal shell usage, but from within pnpm/turbo you cannot. Would you be able to check if the PATH environment variable is set correctly from within whatever profile is loaded in those cases?
A possible debug step may be to create a completely separate directory outside the repo and to create a package.json with the following contents:
{
"scripts": {
"test": "pwd && echo $SHELL && echo $PATH && which cargo"
}
}
Then run pnpm test
and post the output here
Okay, so I'll work on fixing my local build. Meanwhile, I'm trying to work on the issue through a codespace. I've noticed that the test.ts
file uses the TestResult object type to display the error message, and the implementation of TestResult doesn't seem to have a workaround for getting the entire error stack trace. Could anyone suggest something?
I believe TestResult.error
should already have the full verbose error and it's getting trimmed by prettyPrintError
.
I think my initial advice here should work https://github.com/winglang/wing/issues/5883#issuecomment-1989366155
Another interesting improvement would be to refactor prettyPrintError to be able to optionally include the verbose stack trace too so we avoid the duplicated logic.
@MarkMcCulloh as you said, TestResult.error
does include the full verbose error. So just to clarify, could you please explain what you meant by refactor prettyPrintError to be able to optionally include the verbose stack trace too so we avoid the duplicated logic
. Just like it says in the issue, I've changed the code so that the debug flag shows the complete error, and by default it prints the trimmed error only.
@MarkMcCulloh I think that refactoring orettyPrintError should be addressed in a different PR as part of a different issue. @le-incroyable1-dev can you share your current changes through a PR?
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
I tried this:
I ran
wing test main.w
with this code:This happened:
I get an error as expected:
But if I'm trying to debug something internal to Wing SDK, I'd like to see all JavaScript code instead of seeing the stack trace stop at "b.get()".
I expected this:
Passing
--debug
flag should show an unfiltered (or at least, less-filtered) stack traceIs there a workaround?
No response
Anything else?
No response
Wing Version
0.59.45
Node.js Version
20.9.0
Platform(s)
MacOS
Community Notes