jest-serial-runner
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,2 +0,5 @@ | ||
const TestRunner = require('jest-runner') | ||
let TestRunner = require('jest-runner') | ||
if (TestRunner.default) { | ||
TestRunner = TestRunner.default | ||
} | ||
@@ -3,0 +6,0 @@ class SerialRunner extends TestRunner { |
{ | ||
"name": "jest-serial-runner", | ||
"version": "1.2.0", | ||
"description": "Extending the Jest default runner to run tests serially - useful for integration tests", | ||
"version": "1.2.1", | ||
"description": "Extending the Jest default runner to run tests serially by default", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"repository": { | ||
@@ -17,5 +17,12 @@ "type": "git", | ||
"serial", | ||
"runinband" | ||
"runinband", | ||
"run-in-band" | ||
], | ||
"author": "gabrieli", | ||
"author": "gabrieli <gabriel.ionescu.08@gmail.com>", | ||
"contributors": [ | ||
"Evan Dwight <effdem3@gmail.com>", | ||
"codejedi365 <codejedi365@gmail.com>", | ||
"yuanfang-dev <dzcpy@users.noreply.github.com>", | ||
"Adam Uhlíř <adam@uhlir.dev>" | ||
], | ||
"license": "MIT", | ||
@@ -27,4 +34,24 @@ "bugs": { | ||
"peerDependencies": { | ||
"jest-runner": ">= 24.8.0" | ||
"jest-runner": "24.x - 29.x" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.1.2", | ||
"@commitlint/config-conventional": "^17.1.0", | ||
"@commitlint/cz-commitlint": "^17.1.2", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"commitizen": "^4.2.5", | ||
"husky": "^8.0.1", | ||
"is-ci": "^3.0.1", | ||
"semantic-release": "^19.0.5", | ||
"semantic-release-npm-deprecate-old-versions": "^1.3.4" | ||
}, | ||
"scripts": { | ||
"commit": "git commit", | ||
"commit-retry": "CZ_RETRY=true git commit", | ||
"prepare": "is-ci || husky install", | ||
"prepublishOnly": "is-ci || exit 1" | ||
} | ||
} |
@@ -1,12 +0,95 @@ | ||
# jest-serial-runner | ||
# `jest-serial-runner` | ||
Simple extension of the default Jest runner that makes it run serially (as of running with --runInBand flag) | ||
The non-cli functionality is slightly hidden in the Jest docs. | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/jest-serial-runner"> | ||
<img src="https://img.shields.io/npm/v/jest-serial-runner" /> | ||
</a> | ||
<a href="https://github.com/gabrieli/jest-serial-runner/LICENSE.md"> | ||
<img src="https://img.shields.io/npm/l/jest-serial-runner?color=lightgrey"> | ||
</a> | ||
<a href="https://github.com/gabrieli/jest-serial-runner/releases"> | ||
<img src="https://img.shields.io/badge/☍-changelog-lightgrey"> | ||
</a> | ||
<a href="https://github.com/gabrieli/jest-serial-runner/actions/workflows/push.yml"> | ||
<img src="https://github.com/gabrieli/jest-serial-runner/actions/workflows/push.yml/badge.svg?branch=master" > | ||
</a> | ||
<a href="https://github.com/gabrieli/jest-serial-runner/issues"> | ||
<img src="https://img.shields.io/github/issues/gabrieli/jest-serial-runner"> | ||
</a> | ||
<a href="https://github.com/gabrieli/jest-serial-runner/pulls"> | ||
<img src="https://img.shields.io/github/issues-pr/gabrieli/jest-serial-runner?label=PRs"> | ||
</a> | ||
<a href="https://snyk.io/advisor/npm-package/jest-serial-runner"> | ||
<img src="https://img.shields.io/snyk/vulnerabilities/npm/jest-serial-runner"> | ||
</a> | ||
</p> | ||
<p align="center"> | ||
<img src="https://img.shields.io/npm/dependency-version/jest-serial-runner/peer/jest-runner"> | ||
<img src="https://img.shields.io/static/v1?logo=javascript&label=JavaScript&message=CommonJs"> | ||
<img src="https://img.shields.io/github/last-commit/gabrieli/jest-serial-runner"> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/semantic-release/semantic-release"> | ||
<img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" > | ||
</a> | ||
<img src="https://img.shields.io/badge/Contributors-PR's_welcome-pink"> | ||
</p> | ||
<p align="center"> | ||
Extending the <a href="https://jestjs.io/">Jest</a> | ||
default runner to run tests serially by default | ||
</p> | ||
Useful for integration tests. | ||
--- | ||
# Usage | ||
Simple wrapper over the default Jest runner that forces serial execution of test files. This is equivalent to running with `--runInBand` flag by default. | ||
``` npm install jest-serial-runner --save-dev``` | ||
**Why?** Sometimes you have limited/restricted resources on the test machine (like in a docker container) and running the default `jest-runner` always runs in parallel unless specified otherwise. Integration tests are another scenario where running concurrent instances causes issues so using this runner ensures only 1 test runs at a time. | ||
Add ``` "runner": "jest-serial-runner" ``` in your jest config | ||
## Installation | ||
```sh | ||
npm install jest-serial-runner --save-dev | ||
``` | ||
## Usage | ||
**Option 1:** Specify the runner in your `Jest` config | ||
```jsonc | ||
/* jest.config.json */ | ||
{ | ||
// ... | ||
"runner": "jest-serial-runner" | ||
// ... | ||
} | ||
``` | ||
**Option 2:** To specify the runner for a subset of files such as for integration tests. | ||
```js | ||
/* jest.config.js */ | ||
module.exports = { | ||
// ... | ||
projects: [ | ||
{ | ||
// Uses the jest default runner for specification testing | ||
displayName: "UNIT", | ||
testMatch: ["<rootDir>/src/**/__tests__/*.spec.ts"] | ||
}, | ||
{ | ||
// Uses the serial runner instead for integration test files | ||
displayName: "INTEGRATION", | ||
runner: "jest-serial-runner", | ||
testMatch: ["<rootDir>/tests/**/*.integration-test.ts"] | ||
} | ||
] | ||
} | ||
``` | ||
## Contributors | ||
**Thank you to all of our [contributors](./package.json)!** | ||
PR's & Issue contributions welcome! Please adhere to | ||
[contributing guidelines](./CONTRIBUTING.md) | ||
or your submission will be closed or delayed. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6272
4
11
0
96
9