Skip to content

Convert pure tests to Jest#1780

Merged
koesie10 merged 3 commits intomainfrom
koesie10/jest-pure-tests
Nov 22, 2022
Merged

Convert pure tests to Jest#1780
koesie10 merged 3 commits intomainfrom
koesie10/jest-pure-tests

Conversation

@koesie10
Copy link
Copy Markdown
Member

This converts all pure tests to Jest. This was done by first running npx jest-codemods with the Mocha transformation, then manually fixing any places where it hadn't automatically converted the correct thing or had missed things (mostly Sinon).

This also sets up VSCode correctly for running Jest.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This converts all pure tests to Jest. This was done by first running
`npx jest-codemods` with the Mocha transformation, then manually fixing
any places where it hadn't automatically converted the correct thing
or had missed things (mostly Sinon).

This also sets up VSCode correctly for running Jest.
The config store was not being disposed in tests, resulting in Chokidar
watchers being left open. This was causing tests to not exit since there
were still open file descriptors.

This commit also fixes the `DbConfigStore` to make the correct `super`
call in its `dispose` method.
@koesie10 koesie10 marked this pull request as ready for review November 22, 2022 11:22
@koesie10 koesie10 requested review from a team as code owners November 22, 2022 11:22
Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread extensions/ql-vscode/test/pure-tests/sarif-processing.test.ts Outdated
When `jest-codemods` was run, it replaced the error message `array.join`
by a comment for the error message. Since Jest does not support custom
error messages out-of-the-box, this will instead do an equality check
with an empty array, which will ensure that the received array is
printed.
@koesie10 koesie10 enabled auto-merge November 22, 2022 15:11
@koesie10 koesie10 merged commit a88039b into main Nov 22, 2022
@koesie10 koesie10 deleted the koesie10/jest-pure-tests branch November 22, 2022 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants