Skip to content

Migrate no-workspace integration tests to Jest #1782

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

Merged
merged 10 commits into from
Nov 24, 2022

Conversation

koesie10
Copy link
Member

This migrates all no-workspace VSCode integration tests to Jest by running npx jest-codemods, followed by manual fixes (mostly for Sinon and Proxyquire).

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.

@koesie10 koesie10 changed the base branch from main to jest-migration/integration-tests November 22, 2022 14:56
This migrates all no-workspace VSCode integration tests to Jest by
running `npx jest-codemods`, followed by manual fixes (mostly for Sinon
and Proxyquire).
This results in parallel downloads of VSCode, which is not supported.
The timeouts need to be set either on a per-file basis, or per test by
using the parameter in `it`. Since we have both Mocha and Jest types, we
need to declare in the test file which one we're using.
@koesie10 koesie10 force-pushed the jest-migration/no-workspace branch from e370f26 to a985bcb Compare November 23, 2022 10:23
@koesie10 koesie10 marked this pull request as ready for review November 23, 2022 13:21
@koesie10 koesie10 requested review from a team as code owners November 23, 2022 13:21
Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, although with the caveat that I'm not an expert on Jest and I haven't been following along with the conversion chat as much as other people have been. I also didn't read the auto-generated commit, but I read the rest of the commits, and the resulting code looks pretty good.

The windows tests seem to be failing. Is that an unrelated error or something to do with this PR?

So long as the tests pass and the auto-conversion looks somewhat sensible, is it better to get a quick review and merge this PR to minimise disruption?

@koesie10
Copy link
Member Author

Thanks for the review!

The windows tests seem to be failing. Is that an unrelated error or something to do with this PR?

That is related to this PR. The jest-runner-vscode doesn't seem to properly support running a "non-standard" configuration on Windows, so we aren't currently able to run these tests on Windows. See the internal linked issue for more details.

So long as the tests pass and the auto-conversion looks somewhat sensible, is it better to get a quick review and merge this PR to minimise disruption?

I think that is indeed the best course of action. The PR is going to a feature branch anyway and I think the configuration can be re-used by other integration test directories, so it's valuable to have those in there.

Copy link
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.

Generally looks good to me. I can't say I've looked at all the changes though... there's A LOT!

When running locally I get 1 error - launching with no specified workspace › should not activate the extension at first, but happy for us to look at that separately.

Instead of calling `fail` and catching an error, this will use the
`rejects.toThrow` assertion to check that a Promise rejects with a
specific error.
@koesie10
Copy link
Member Author

Thanks for the review!

When running locally I get 1 error - launching with no specified workspace › should not activate the extension at first, but happy for us to look at that separately.

Have you removed the out directory prior to building/watching this branch? The activation.test.ts file has been moved to a separate directory and building/watching doesn't actually clear the out directory, so it could be that there is still a file out/vscode-tests/no-workspace/activation.test.js, which should now be located at out/vscode-tests/no-workspace/activation/activation.test.js.

@koesie10 koesie10 merged commit c31635f into jest-migration/integration-tests Nov 24, 2022
@koesie10 koesie10 deleted the jest-migration/no-workspace branch November 24, 2022 09:21
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.

3 participants