Commit Graph

2705 Commits

Author SHA1 Message Date
Koen Vlaswinkel
558eb19c97 Remove unnecessary calls to mockReset 2022-11-24 10:24:48 +01:00
Koen Vlaswinkel
31b64d2f73 Fix incorrect to.contain transformation
For `to.contain`, `jest-codemods` seems to have converted these to be
`expect.arrayContaining`, even for strings. This will make the correct
change for strings.
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
d02a5cd3dc Do not use toHaveLength for objects
Mocha supported `.to.have.length` for objects, but Jest only allows
`toHaveLength` on objects which have a length property (such as arrays).
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
e895078913 Do not use .skip from within tests
Jest does not support skipping tests when the test has already started
(which could also be in a before hook), so we need to manually return
from the tests when the CLI version does not support a tested feature.
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
1a10fd35f1 Remove calls to fail
Instead of calling `fail`, we can just let the error be caught by Jest,
which will automatically fail the tests. For other instances where we're
calling `fail` in case an error was not thrown, we will instead use
`.rejects.toThrow`.
2022-11-24 10:23:13 +01:00
Koen Vlaswinkel
614785fb7a Do not dispose the extension after every test file 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
4f8d68d8a2 Always activate the extension before running tests 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
dc6de0f8a8 Fix async describes 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
e5967c3851 First pass on converting cli-integration tests to Jest
This is a first pass on converting the cli-integration tests to Jest. It
uses a custom Jest runner (based on the jest-runner-vscode) to install
required extensions. It will also necessary to move some code for
installating the CLI to ensure it was possible to install the CLI from
outside VSCode.

Most of the conversion has been done by `npx jest-codemods`, but all
migration of Sinon has been done manually.
2022-11-24 10:22:45 +01:00
Koen Vlaswinkel
c31635fe90 Merge pull request #1782 from github/jest-migration/no-workspace
Migrate no-workspace integration tests to Jest
2022-11-24 10:21:50 +01:00
Koen Vlaswinkel
e26e1113be Remove calls to fail
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.
2022-11-24 10:04:37 +01:00
Koen Vlaswinkel
01f6576e95 Clarify comment for activation test 2022-11-24 09:58:10 +01:00
Koen Vlaswinkel
347d234906 Use projects arg to run the Jest tests 2022-11-24 09:56:08 +01:00
Koen Vlaswinkel
043a7b1039 Use resetMocks option to reset mocks before every test 2022-11-24 09:55:48 +01:00
Koen Vlaswinkel
a985bcb872 Use different method of running tests 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
90dd97fbc0 Use correct jest-runner-vscode for no-workspace 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
0296db8b25 Move jest-runner-vscode config to correct location 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
65bb61b530 Set timeouts on tests correctly
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.
2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
3da0034953 Do not run integration tests in parallel
This results in parallel downloads of VSCode, which is not supported.
2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
a0ab34bf55 Migrate no-workspace integration tests to Jest
This migrates all no-workspace VSCode integration tests to Jest by
running `npx jest-codemods`, followed by manual fixes (mostly for Sinon
and Proxyquire).
2022-11-23 11:23:13 +01:00
Koen Vlaswinkel
cc869daf05 Merge pull request #1783 from github/koesie10/split-workflow-files
Split workflow run into more jobs
2022-11-23 10:59:54 +01:00
Koen Vlaswinkel
1c820b4812 Switch from npm install to npm ci in CI 2022-11-23 10:44:45 +01:00
Koen Vlaswinkel
d215c7e2de Split workflow run into more jobs
The unit tests and linting is now run separately, which will hopefully
speed up the time it takes for the integration tests to complete.
2022-11-23 10:19:34 +01:00
Koen Vlaswinkel
a88039bf0b Merge pull request #1780 from github/koesie10/jest-pure-tests
Convert pure tests to Jest
2022-11-22 16:13:05 +01:00
Koen Vlaswinkel
f5c39d7931 Improve error message for empty array
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.
2022-11-22 15:54:22 +01:00
Charis Kyriakou
261933b6a9 Install VS Code jest runner (#1781) 2022-11-22 11:01:46 +00:00
Nora
33eb33405e Merge pull request #1776 from github/nora/update-compiler-target
Update compiler target version in gulp and extension tsconfig
2022-11-22 11:55:14 +01:00
Koen Vlaswinkel
ec60f3f000 Dispose config store in tests
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.
2022-11-22 11:53:21 +01:00
Koen Vlaswinkel
0974700557 Convert pure tests to Jest
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.
2022-11-22 10:39:21 +01:00
Koen Vlaswinkel
03f1547160 Merge pull request #1777 from github/koesie10/jest-config-projects
Add project-based Jest config
2022-11-22 09:44:23 +01:00
Andrew Eisenberg
91a5db7359 Merge pull request #1779 from github/version/bump-to-v1.7.7
Bump version to v1.7.7
2022-11-21 12:02:20 -08:00
aeisenberg
fbd2cbd3aa Bump version to v1.7.7 2022-11-21 19:39:04 +00:00
Andrew Eisenberg
f36ab18310 Merge pull request #1778 from github/v1.7.6
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.6
v1.7.6
2022-11-21 09:42:39 -08:00
Andrew Eisenberg
663b26328b v1.7.6 2022-11-21 09:01:47 -08:00
Koen Vlaswinkel
55534e19d6 Add project-based Jest config
This moves the view Jest config to the view directory and adds a new
jest.config.js file which only references the view directory as a
project. This will make it easier to add multiple Jest configs for
separate projects.
2022-11-21 16:41:47 +01:00
Nora
b6f33d7c7b Update compiler target version in gulp and extension tsconfig 2022-11-21 15:49:38 +01:00
Andrew Eisenberg
e93d8393ca Merge pull request #1774 from github/aeisenberg/fix-mrva-packs
Allow synthetic variant analysis packs to handle `${workspace}`
2022-11-18 15:00:05 -08:00
Andrew Eisenberg
24bbd5153c Allow synthetic variant analysis packs to handle ${workspace}
`${workspace}` references are new in CLI version 2.11.3. These mean that
the version depended upon in a pack must be the version available in the
current codeql workspace.

When generating a variant analysis pack, however, we copy the target
query and generate a synthetic pack with the original dependencies.
This breaks workspace references since the synthetic pack is no longer
in the same workspace.

A simple workaround is to replace `${workspace}` with `*` references.
2022-11-18 14:47:07 -08:00
Andrew Eisenberg
4eb465277a Update gitignore to avoid codeql metadata files
Also, we're no longer using the rush package manager, so delete that
from gitignore.
2022-11-18 11:33:53 -08:00
Koen Vlaswinkel
3e7e4b86bd Merge pull request #1525 from github/koesie10/prettier
Add Prettier
2022-11-17 09:58:47 +01:00
Koen Vlaswinkel
f515663640 Add .git-blame-ignore-revs file for previous commit
See https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/
2022-11-16 19:07:01 +01:00
Koen Vlaswinkel
ebcdf8ad0b Run Prettier on all files
This will change all existing files to match Prettier formatting.

The command used is `npm run format`.
2022-11-16 19:06:13 +01:00
Koen Vlaswinkel
f41ca1a330 Add Prettier
This adds Prettier and makes it replace tsfmt. VSCode is set to use
Prettier for formatting TypeScript/TSX files and format on save since
Prettier is very fast and does not cause any noticeable delay.
2022-11-16 19:04:17 +01:00
Koen Vlaswinkel
6219b43051 Merge pull request #1766 from github/koesie10/export-results-sorting-filtering
Add filtering and sorting to exported results
2022-11-16 19:01:36 +01:00
Koen Vlaswinkel
47297800ab Merge remote-tracking branch 'origin/main' into koesie10/export-results-sorting-filtering 2022-11-16 18:44:36 +01:00
Koen Vlaswinkel
5838f1b6a3 Merge pull request #1765 from github/koesie10/selected-copy
Use selected repositories for copying repo lists
2022-11-16 18:41:46 +01:00
Koen Vlaswinkel
bbaa27a1f0 Split filter and sort methods and simplify type checks 2022-11-16 16:32:17 +01:00
dependabot[bot]
d7fd84c8e1 Bump loader-utils from 1.4.1 to 1.4.2 in /extensions/ql-vscode (#1772)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 15:03:23 +00:00
Koen Vlaswinkel
6aaa7d63a7 Simplify type checks for repositoryIds 2022-11-16 13:02:55 +01:00
Robert
ed0868ba26 Merge pull request #1768 from github/robertbrignull/openVariantAnalysis
Remove the openVariantAnalysis command
2022-11-16 11:04:02 +00:00