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

test: migrate jest-runner-vscode to @vscode/test-cli #580

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9deb173
Install `@vscode/test-cli` and `@vscode/test-electron`
ybiquitous Aug 26, 2024
8a57e57
Configure vscode-test-cli
ybiquitous Aug 26, 2024
3e178ce
Migrate `test/e2e/__tests__/validate.ts`
ybiquitous Aug 26, 2024
6775b83
Fix caching VS Code binaries in CI
ybiquitous Aug 26, 2024
760c40c
Add 'Autofix' to cspell words
ybiquitous Aug 26, 2024
e1b230e
Enable `skipLibCheck` to prevent type errors in `node_modules/`
ybiquitous Aug 26, 2024
bfbf8c8
Migrate `test/e2e/__tests__/stylelint-resolution.ts`
ybiquitous Aug 26, 2024
6f2372d
Refactor to rename `common.ts` to `helpers.ts`
ybiquitous Aug 26, 2024
73a27e0
Migrate `test/e2e/__tests__/restart.ts`
ybiquitous Aug 26, 2024
e48dd59
Migrate `test/e2e/__tests__/report-needless-disables.ts`
ybiquitous Aug 26, 2024
f822d95
Migrate `test/e2e/__tests__/report-invalid-scope-disables.ts`
ybiquitous Aug 26, 2024
50ef3f6
Migrate `test/e2e/__tests__/report-descriptionless-disables.ts`
ybiquitous Aug 26, 2024
282e71d
Migrate `test/e2e/__tests__/lint.ts`
ybiquitous Aug 26, 2024
fd61523
Migrate `test/e2e/__tests__/ignore.ts`
ybiquitous Aug 26, 2024
0f3ada8
Fix flakiness for `test/e2e/__tests__/restart.ts`
ybiquitous Aug 26, 2024
7b8873d
Migrate `test/e2e/__tests__/{format,ignore-disables}.ts`
ybiquitous Aug 26, 2024
74436c0
Migrate `test/e2e/__tests__/custom-syntax.ts`
ybiquitous Aug 26, 2024
a06280a
Migrate `test/e2e/__tests__/config-file.ts`
ybiquitous Aug 26, 2024
56e33bc
Increase timeout in `test/e2e/__tests__/restart.ts`
ybiquitous Aug 26, 2024
1e0e603
Migrate `test/e2e/__tests__/config-basedir.ts`
ybiquitous Aug 26, 2024
96e4ad5
Migrate `test/e2e/__tests__/code-actions.ts`
ybiquitous Aug 26, 2024
8075270
Remove no longer needed `scripts/download-vscode.ts`
ybiquitous Aug 26, 2024
41b42ac
Remove no longer needed files for E2E with Jest
ybiquitous Aug 26, 2024
a9e6df1
Remove no longer needed `p-wait-for` dependency
ybiquitous Aug 26, 2024
05632eb
Remove no longer needed `jest-runner-vscode` dependency
ybiquitous Aug 26, 2024
09b0486
Remove `test/e2e/jest.config.js` reference
ybiquitous Aug 26, 2024
4ca5f8c
Suppress `jest/expect-expect` ESLint problems for E2E tests
ybiquitous Aug 26, 2024
d34fc21
Remove comment-out type
ybiquitous Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ const config = {
'jest/unbound-method': 'error',
},
},
{
files: ['test/e2e/__tests__/**/*'],
rules: {
'jest/expect-expect': 'off',
},
},
],
};

Expand Down
4 changes: 1 addition & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ updates:
- 'pr: dependencies'
groups:
jest:
patterns: ['jest', 'jest-runner-vscode', 'ts-jest', '@types/jest']
patterns: ['jest', 'ts-jest', '@types/jest']
eslint:
patterns: ['eslint', 'eslint-config-*', '@typescript-eslint/*']
vscode:
patterns: ['vscode-*', '@vscode/*']
ignore:
- dependency-name: p-wait-for
update-types: [version-update:semver-major]
- dependency-name: '@types/vscode'
update-types: [version-update:semver-minor]
- package-ecosystem: 'github-actions'
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,19 @@ jobs:
run: npm i -D stylelint@^14 stylelint-scss@^4.3.0
if: matrix.stylelint == 14

- name: Cache VS Code binaries
uses: actions/cache@v4
id: vscode-cache
with:
path: .vscode-test
key: ${{ runner.os }}-vscode-${{ hashFiles('test/e2e/jest-runner-vscode.config.js') }}
restore-keys: |
${{ runner.os }}-vscode-

- name: Download VS Code
run: npm run download-vscode

- name: Run unit tests
run: npm run test:unit -- --coverage

- name: Run integration tests
run: npm run test:integration -- --coverage

- name: Cache VS Code binaries
uses: actions/cache@v4
id: vscode-cache
with:
path: .vscode-test
key: ${{ runner.os }}-vscode-${{ hashFiles('package.json') }}

- name: Run end-to-end tests (Linux)
if: runner.os == 'Linux'
run: xvfb-run -a npm run test:e2e -- --silent
Expand Down
20 changes: 20 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const { defineConfig } = require('@vscode/test-cli');

const pkg = require('./package.json');

const minimumVscodeVersion = pkg.engines.vscode.match(/^>=(.+)$/)?.[1];

if (!minimumVscodeVersion) throw new Error(`"engines.vscode" is unexpected: ${pkg.engines.vscode}`);

module.exports = defineConfig({
files: ['test/e2e/__tests__/**/*.ts'],
workspaceFolder: 'test/e2e/workspace/workspace.code-workspace',
version: minimumVscodeVersion,
mocha: {
timeout: 60000,
ui: 'bdd',
require: ['ts-node/register'],
},
});
8 changes: 1 addition & 7 deletions cspell.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config = {
files: ['**/*.js', '**/*.ts', '**/*.json', '**/*.md', '**/*.yml', '**/*.css', '**/*.scss'],
ignorePaths: ['**/node_modules', '**/.yarn', '**/coverage', 'dist'],
words: [
'Autofix',
'browserslist',
'caniuse',
'color',
Expand Down Expand Up @@ -36,13 +37,6 @@ const config = {
'Xerus',
'Supertypes',
],
overrides: [
{
filename: 'package.json',
// cspell:disable-next-line
words: ['Autofix'],
},
],
};

module.exports = config;
6 changes: 1 addition & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
projects: [
'<rootDir>/test/unit/jest.config.js',
'<rootDir>/test/integration/jest.config.js',
'<rootDir>/test/e2e/jest.config.js',
],
projects: ['<rootDir>/test/unit/jest.config.js', '<rootDir>/test/integration/jest.config.js'],
maxWorkers: 2,
};

Expand Down
Loading
Loading