Skip to content
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

Converted about 25 *.test.ts files to --strictNullChecks (mostly automatically) #65581

Merged
merged 6 commits into from
Dec 24, 2018
Merged

Converted about 25 *.test.ts files to --strictNullChecks (mostly automatically) #65581

merged 6 commits into from
Dec 24, 2018

Conversation

JoshuaKGoldberg
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg commented Dec 22, 2018

Continues #65233.

I can split this up into smaller PRs if you'd like 😄 figured I'd try to avoid spamming the PR system first...

These diffs were generated with the following strategy:

  1. Run TypeStat on a whitelist of files in src/**/*.test.ts with the fixes.strictNullChecks option
    • This added ! assertions everywhere and a small percentage of the | null / | undefined types
  2. Run npm run strict-null-check-watch and fixed up errors manually
  3. Manually touching up changes in some places (e.g. (void 0)! -> undefined!)

I also went manually did a bunch of these changes on a separate branch to confirm they seem reasonable. Most changes are just adding ! assertions. A few places, such as comparers.ts and terminalEnvironment.test.ts, I manually redid types in step 3 instead.

  • './vs/base/test/browser/ui/tree/asyncDataTree.test.ts",
  • './vs/editor/contrib/linesOperations/test/linesOperations.test.ts",
  • './vs/editor/contrib/linesOperations/test/moveLinesCommand.test.ts",
  • './vs/editor/contrib/multicursor/test/multicursor.test.ts",
  • './vs/editor/contrib/suggest/test/completionModel.test.ts",
  • './vs/editor/contrib/wordOperations/test/wordOperations.test.ts",
  • './vs/editor/contrib/wordPartOperations/test/wordPartOperations.test.ts",
  • './vs/platform/configuration/test/common/configurationModels.test.ts",
  • './vs/platform/extensions/test/node/extensionValidator.test.ts",
  • './vs/platform/instantiation/test/common/instantiationService.test.ts",
  • './vs/platform/keybinding/test/common/keybindingLabels.test.ts",
  • './vs/platform/keybinding/test/common/keybindingResolver.test.ts",
  • './vs/platform/markers/test/common/markerService.test.ts",
  • './vs/platform/telemetry/test/electron-browser/appInsightsAppender.test.ts",
  • './vs/platform/telemetry/test/electron-browser/telemetryService.test.ts",
  • './vs/workbench/parts/markers/test/electron-browser/markersModel.test.ts",
  • './vs/workbench/parts/snippets/test/electron-browser/snippetFile.test.ts",
  • './vs/workbench/parts/snippets/test/electron-browser/snippetsService.test.ts",
  • './vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts",
  • './vs/workbench/parts/terminal/test/electron-browser/terminalLinkHandler.test.ts",
  • './vs/workbench/parts/terminal/test/node/terminalEnvironment.test.ts",
  • './vs/workbench/services/commands/test/common/commandService.test.ts",
  • './vs/workbench/services/configuration/test/common/configurationModels.test.ts",
  • './vs/workbench/services/decorations/test/browser/decorationsService.test.ts",
  • './vs/workbench/services/extensions/test/node/rpcProtocol.test.ts",
  • './vs/workbench/services/keybinding/test/keybindingIO.test.ts",
  • './vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts",

Josh Goldberg added 5 commits December 21, 2018 00:14
# Conflicts:
#	src/tsconfig.strictNullChecks.json
#	src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts
#	src/vs/base/test/browser/ui/grid/gridview.test.ts
#	src/vs/base/test/browser/ui/splitview/splitview.test.ts
#	src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts
#	src/vs/base/test/common/async.test.ts
#	src/vs/base/test/common/diff/diff.test.ts
#	src/vs/base/test/common/strings.test.ts
#	src/vs/base/test/node/config.test.ts
#	src/vs/code/test/node/windowsFinder.test.ts
#	src/vs/editor/contrib/codeAction/test/codeAction.test.ts
#	src/vs/editor/contrib/codeAction/test/codeActionModel.test.ts
#	src/vs/editor/contrib/comment/test/lineCommentCommand.test.ts
#	src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts
@JoshuaKGoldberg
Copy link
Contributor Author

JoshuaKGoldberg commented Dec 22, 2018

Heh, looks like some files here are already in PR. Will remove.

@JoshuaKGoldberg JoshuaKGoldberg changed the title Converted about 50 *.test.ts files to --strictNullChecks (mostly automatically) Converted about 25 *.test.ts files to --strictNullChecks (mostly automatically) Dec 22, 2018
@mjbvz mjbvz added this to the December/January 2019 milestone Dec 24, 2018
@mjbvz mjbvz merged commit d659000 into microsoft:master Dec 24, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Dec 24, 2018

Very nice work. Thanks!

@JoshuaKGoldberg JoshuaKGoldberg deleted the strict-null-checks-auto-1 branch December 24, 2018 15:17
mjbvz pushed a commit that referenced this pull request Dec 28, 2018
* Converted another ~70 test files to strictNullChecks

These are the remaining test files that didn't require any changes to non-test file types. I'll send those in separately.

Most changes were automatic and small (`!`s).
The only non-trival change is that `extHostSearch.ts` needs an interface for its test data.

Again used [TypeStat](https://github.com/JoshuaKGoldberg/TypeStat) when possible per #65581. I'm happy to split this up into smaller PRs if you'd prefer!

* Added missing `!`s to `commands.test.ts`
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants