-
Notifications
You must be signed in to change notification settings - Fork 77
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
Debug config for tests in current file #1790
base: main
Are you sure you want to change the base?
Conversation
Nice!
there are a few ways to proceed here, ordered by the order in which i would attempt to solve this:
|
Note it's not just
This is what I'd like to do, but I feel like I need to understand the TypeScript tooling better to do so. @robknight might have more insight on this. Ideally VSCode would be able to run exactly the same command as I actually can make a working config for the same file which calls ts-mocha directly (as
I'll put this PR in draft and upload my alternative version for discusssion. |
Updates:
|
I think that would be OK. |
How would I go about setting that up and making sure it stays up-to-date. Do I just need to manually fill in the references normally filled in by yarn fix-references? Is the presence of that file ever going to confuse other parts of the build? I'm annoyed that I can't even put a comment in that file saying what it's for, because JSON doesn't allow that. If the compiler ignores unknown fields, I may try putting a comment in a string in the JSON. |
What's the status of this @robknight @artwyman -- still active or can we close? |
This is still useful, and I frequently cherry-pick it if I want to debug a unit test. I wasn't able to fully solve the path issues to make it generally useful for all packages. Rob's help would probably be needed to make it a generalized solution. The alternative would be to just merge it as-is. For people who know what to do, it will work for many packages, and can be manually fixed up for whatever package they need. If the JSON config file allowed comments, I'd be more comfortable with simply landing the code in its partially-working state because I could write a big comment explaining when it works, and how to update it for other uses. Without that it feels more like that knowledge will be lost and the partial config might cause frustration down the line. |
Adds a new VSCode debug configuration to launch unit tests from the currently open file.
This works on most but not all of the tests in the repo. The passport-server tests in particular don't work. See below for more details if you want to help fix it.
To use this:
The remaining issue in passport-server tests seems to have to do with type definitions for some Chai add-ons. It might occur everywhere those add-ons are used, or it might be specific to the fact that passport-server builds an app rather tha a library. Here's the error when I try to run
lemonadePipeline.spec.ts
:I welcome suggestions on how to fix this final issue, but I think this config is useful for the tests where it works.