Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
jest-runner
Advanced tools
The jest-runner npm package is a custom runner for Jest that allows you to run tests with a specified test runner. It is part of the Jest ecosystem and is used to execute tests written for Jest in a customizable environment. It can be used to run tests in parallel, to specify custom test environments, and to integrate with other testing tools and frameworks.
Running tests in parallel
By default, Jest runs all tests in parallel, which can speed up the test execution time. However, if you need to run tests serially (one after another), you can use the `--runInBand` or `-i` option. This is useful when tests are not isolated and may interfere with each other when run in parallel.
jest --runInBand
Custom test environments
Jest allows you to specify a custom test environment for your tests. By setting the `testEnvironment` option in your Jest configuration, you can choose the environment in which your tests will run, such as `node` for a Node.js environment or `jsdom` for a browser-like environment. The `runner` option can be set to `jest-runner` to use it as the test runner.
module.exports = {
testEnvironment: 'node',
runner: 'jest-runner'
};
Integrating with other testing tools
Jest-runner can be extended to integrate with other testing tools and frameworks. For example, `jest-runner-eslint` allows you to run ESLint as a Jest test, providing a unified testing and linting workflow. You can configure Jest to use different runners for different types of tests or files, and you can also add watch plugins to enhance the developer experience during watch mode.
module.exports = {
runner: 'jest-runner-eslint',
displayName: 'lint',
testMatch: ['<rootDir>/src/**/*.js'],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
]
};
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple. It is similar to Jest in that it provides a test running environment, but it has a different API and requires manual configuration of assertion libraries, mocking, and spying tools.
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not require a DOM and has a clean, obvious syntax so that you can easily write tests. It is similar to Jest but is considered less opinionated in terms of how tests are structured and executed.
AVA is a test runner for Node.js with a concise API, detailed error output, and process isolation that lets you develop with confidence. AVA is similar to Jest-runner in that it can run tests in parallel, but it emphasizes minimalism and speed, and it does not provide a built-in mocking library.
Karma is a test runner that works with any framework (such as Mocha, Jasmine, QUnit, and more), which makes it highly adaptable. It is designed to work with continuous integration tools and offers a plugin system. Unlike Jest, Karma is primarily used for running tests in actual browsers, which is useful for testing browser-specific issues.
23.6.0
[jest-cli]
Add changedSince
to allowed watch mode configs (#6955)[babel-jest]
Add support for babel.config.js
added in Babel 7.0.0 (#6911)[jest-resolve]
Add support for an experimental mapper
option (Watchman crawler only) that adds virtual files to the Haste map (#6940)[jest-resolve]
Only resolve realpath once in try-catch (#6925)[expect]
Fix TypeError in toBeInstanceOf
on null
or undefined
(#6912)[jest-jasmine2]
Throw a descriptive error if the first argument supplied to a hook was not a function (#6917) and (#6931)[jest-circus]
Throw a descriptive error if the first argument supplied to a hook was not a function (#6917) and (#6931)[expect]
Fix variadic custom asymmetric matchers (#6898)[jest-cli]
Fix incorrect testEnvironmentOptions
warning (#6852)[jest-each]
Prevent done callback being supplied to describe (#6843)[jest-config]
Better error message for a case when a preset module was found, but no jest-preset.js
or jest-preset.json
at the root (#6863)[jest-haste-map]
Catch crawler error when unsuccessfully reading directories (#6761)[docs]
Add custom toMatchSnapshot matcher docs (#6837)[docs]
Improve the documentation regarding preset configuration (#6864)[docs]
Clarify usage of --projects
CLI option (#6872)[docs]
Correct failure-change
notification mode (#6878)[scripts]
Don’t remove node_modules from subdirectories of presets in e2e tests (#6948)[diff-sequences]
Double-check number of differences in tests (#6953)FAQs
Unknown package
The npm package jest-runner receives a total of 21,148,026 weekly downloads. As such, jest-runner popularity was classified as popular.
We found that jest-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.