Skip to content

Commit

Permalink
test: migrate jest-runner-vscode to @vscode/test-cli (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored Aug 27, 2024
1 parent d37eb22 commit 31162d1
Show file tree
Hide file tree
Showing 46 changed files with 2,609 additions and 1,875 deletions.
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

0 comments on commit 31162d1

Please sign in to comment.