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
Strict Null Checking Part II: The Testing! #65233
Comments
List of eligible test filesUpdated: December 24, 2018
|
Hi, I'm fairly new to open source contribution, so I though I'd start here by tackling |
@punteek tbh I just figured it out, I'm about to make a PR for it now. |
Hello. Edit: Seems that @isidorn has fixed the only error it has in 442cf88. I was working on it but nevertheless I'm going to submit my PR to add the file in the "tsconfig.strictNullChecks.json". |
Hello, |
Thanks everyone for your help! Thanks to your PRs, we now are now a good deal closer to being able to enable strict null checking for the entire VS Code codebase |
A sequel to October's hit: #60565, Strict Null Checking VS Code
Backstory
We are incrementally working to enable TypeScript's strict null checks for the core of VS Code: #60565. Strict null checks help to catch silly programming mistakes and generally enforce a more explicit and safer coding style. Enabling strict null checks should reduce the number of undefined access exceptions VS Code users hit and help VS Code contributors move more quickly
This time
With #60565, we have already migrated over 800 files to be strict null checked but have not yet enabled strict null for many of our unit tests. That's where you can help out.
This item tracks enabling strict null checks for the
*.test.ts
files in the core VS Code codebase (under./src
). This work can be done on a file-by-file basis and should be fairly straightforward. If you are interested in contributing to VS Code, enabling strict null checking for a few test files is a great way to help out and a great way to learn more about the codebase.How to contribute
Setup a VS Code development environment if you have not already done so: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
Make sure you are on the latest commit of VS Code from master.
Pick a strict null check eligible test file from the list posted below.
Add the file in the
files
section of thesrc/tsconfig.strictNullChecks.json
file in the VS Code codebase.Run
yarn strict-null-check
, oryarn strict-null-check -- --watch
to run the null checks in watch modeFix null check related errors. See the guidelines below for more details. Some files may only have a single error while others may have hundreds. We welcome all incremental fixes
Run the tests to make sure they still pass
Submit a PR with your change. Try to keep each PR to converting a single file
General guidelines for fixing strict null errors in tests
Annotate nullable types and fix simple type errors
Use the
!
not null assertion to skip null checking when testing APIs that may return undefined. For example, if we were testing thedivide
function:❗️ If you aren't sure about how to fix a given error, just ask or leave it unfixed. We can only merge PRs that have a passing build so if you do skip any errors, make sure your PR does not actually add the file to
src/tsconfig.strictNullChecks.json
.(Also please do not close this issue in your PR. This issue will be left open until we have enable strict null checking for all tests)
The text was updated successfully, but these errors were encountered: