Socket
Book a DemoInstallSign in
Socket

jest-runner-vscode

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-runner-vscode

Jest runner for testing VS Code extensions

latest
Source
npmnpm
Version
3.0.1
Version published
Maintainers
2
Created
Source

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

FAQs

Package last updated on 22 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts