Gathering detailed insights and metrics for create-jest-runner
Gathering detailed insights and metrics for create-jest-runner
Gathering detailed insights and metrics for create-jest-runner
Gathering detailed insights and metrics for create-jest-runner
@tunnckocore/create-jest-runner
Fork of the original create-jest-runner, with support for couple of things, see issues there
jest-circus
[type-definitions]: https://github.com/jestjs/jest/blob/main/packages/jest-types/src/Circus.ts
jest-playwright-preset
Running tests using Jest & Playwright.
jest-runner-eslint
An ESLint runner for Jest
A highly opinionated way for creating Jest Runners
npm install create-jest-runner
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
134 Stars
319 Commits
23 Forks
3 Watching
9 Branches
25 Contributors
Updated on 25 Nov 2024
Minified
Minified + Gzipped
TypeScript (61.61%)
JavaScript (37.47%)
Dockerfile (0.93%)
Cumulative downloads
Total Downloads
Last day
-4.9%
41,622
Compared to previous day
Last week
-0.2%
222,947
Compared to previous week
Last month
14.8%
914,445
Compared to previous month
Last year
-3.4%
10,994,704
Compared to previous year
3
2
22
A highly opinionated way for creating Jest Runners
1yarn add create-jest-runner
create-jest-runner takes care of handling the appropriate parallelization and creating a worker farm for your runner.
You simply need two files:
1// index.js 2const { createJestRunner } = require('create-jest-runner'); 3module.exports = createJestRunner(require.resolve('./run'));
pathToRunFile
: path to your run file. This must be an absolute path or a file://
URL.config
: Optional argument for configuring the runner.
getExtraOptions
: () => object
used for passing extra options to the runner. It needs to be a serializable object because it will be send to a different Node process.1module.exports = options => {};
This file should export a function that receives one parameter with the options
options: { testPath, config, globalConfig }
testPath
: Path of the file that is going to be testsconfig
: Jest Project config used by this fileglobalConfig
: Jest global configextraOptions
: The return value of the { getExtraOptions }
argument of createJestRunner(...)
the entry file.You can return one of the following values:
testResult
: Needs to be an object of type https://github.com/facebook/jest/blob/4d3c1a187bd429fd8611f6b0f19e4aa486fa2a85/packages/jest-test-result/src/types.ts#L103-L135Promise<testResult|Error>
: needs to be of above type.Error
: good for reporting system error, not failed tests.This runner "blade-runner" makes sure that these two emojis ⚔️ 🏃
are present in every file
1// index.js 2const { createJestRunner } = require('create-jest-runner'); 3module.exports = createJestRunner(require.resolve('./run'));
1// run.js 2const fs = require('fs'); 3const { pass, fail } = require('create-jest-runner'); 4 5/** @type {import('create-jest-runner').RunTest} */ 6const runTest = ({ testPath }) => { 7 const start = Date.now(); 8 const contents = fs.readFileSync(testPath, 'utf8'); 9 const end = Date.now(); 10 11 if (contents.includes('⚔️🏃')) { 12 return pass({ start, end, test: { path: testPath } }); 13 } 14 const errorMessage = 'Company policies require ⚔️ 🏃 in every file'; 15 return fail({ 16 start, 17 end, 18 test: { path: testPath, errorMessage, title: 'Check for ⚔️ 🏃' }, 19 }); 20}; 21 22module.exports = runTest;
1yarn create jest-runner my-runner 2 3# Or with npm 4npm init jest-runner my-runner
Note: You will have to update the package name in package.json
of the generated runner.
Once you have your Jest runner you can add it to your Jest config.
In your package.json
1{ 2 "jest": { 3 "runner": "/path/to/my-runner" 4 } 5}
Or in jest.config.js
1module.exports = { 2 runner: '/path/to/my-runner', 3};
1yarn jest
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
14 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More