Skip to content

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

Merged
Matt Bierner (mjbvz) merged 6 commits into
microsoft:masterfrom
JoshuaKGoldberg:strict-null-checks-auto-1
Dec 24, 2018
Merged

Converted about 25 *.test.ts files to --strictNullChecks (mostly automatically)#65581
Matt Bierner (mjbvz) merged 6 commits into
microsoft:masterfrom
JoshuaKGoldberg:strict-null-checks-auto-1

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg Josh Goldberg ✨ (JoshuaKGoldberg) commented Dec 22, 2018

Copy link
Copy Markdown
Contributor

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

Josh Goldberg ✨ (JoshuaKGoldberg) commented Dec 22, 2018

Copy link
Copy Markdown
Contributor Author

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

@JoshuaKGoldberg Josh Goldberg ✨ (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
Matt Bierner (mjbvz) merged commit d659000 into microsoft:master Dec 24, 2018
@mjbvz

Copy link
Copy Markdown
Contributor

Very nice work. Thanks!

@JoshuaKGoldberg
Josh Goldberg ✨ (JoshuaKGoldberg) deleted the strict-null-checks-auto-1 branch December 24, 2018 15:17
Matt Bierner (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