jest-runner-vscode
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

jest-runner-vscode

Build Status npm Version Change Log

Runs extension tests in VS Code using Jest. Used by the official Stylelint VS Code extension!

Note: This runner is in its early stages of development and is subject to change. Contributions and suggestions are welcome!

Note: Versions 1.x and earlier of this package on npm are an entirely different package, a library for running jest within a VS Code process, that was moved to vscode-jest-test-runner. The library under the old name was kept on npm so that existing projects don't break their test runs, but it is no longer maintained.

If you are using the old version of the npm package, either migrate to this Jest runner or switch your dependencies to the vscode-jest-test-runner package.

Installation

Requires Node.js 16.14 or later. Project is tested on VS Code 1.71.1.

$ yarn add -D jest-runner-vscode

or

$ npm i -D jest-runner-vscode

Configuration

See the public types for details on all available configuration options.

// jest.config.js (or similar)

module.exports = {
  runner: 'vscode',
}
// jest-runner-vscode.config.js

/** @type {import('jest-runner-vscode').RunnerOptions} */
module.exports = {
  version: '1.71.1',
  extensionTestsEnv: {
    FOO_BAR: 'baz',
  },
  launchArgs: ['--new-window', '--disable-extensions'],
  workspaceDir: 'path/to/workspace',
  openInFolder: true,
}

Configuration files in nested folders inherit the parent folder's configuration.

Behaviour

  • Tests are run sequentially.

  • A single instance of VS Code is launched for each unique directory containing tests. This allows you to save time for test suites that do not require relaunching the editor. Example:

    /path/to/project/lib/__tests__/foo.test.js
    /path/to/project/lib/__tests__/bar.test.js
      --> run in the same instance
    
    /path/to/project/src/__tests__/foo.test.js
    /path/to/project/3rd-party/__tests__/bar.test.js
      --> run in separate instances
    

Things not yet supported

  • Collecting coverage
  • Colourized output
  • more stuff I haven't encountered yet — if you run into anything that doesn't work, open an issue!

Licence

ISC

Readme

Keywords

none

Package Sidebar

Install

npm i jest-runner-vscode

Weekly Downloads

384

Version

3.0.1

License

ISC

Unpacked Size

50.4 kB

Total Files

32

Last publish

Collaborators

  • bmealhouse
  • adalinesimonian