# @component-controls/jest-extract

> Given a test file, extracts the tests, test results and coverage data

Latest version **4.0.3** (published 2022-01-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @component-controls/jest-extract
pnpm add @component-controls/jest-extract
yarn add @component-controls/jest-extract
bun add @component-controls/jest-extract
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2022-01-14 |
| First published | 2021-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 26.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 82 |
| Maintainers | atanasster |
| Keywords | jest, testing |

## Links

- npm: https://www.npmjs.com/package/@component-controls/jest-extract
- Repository: https://github.com/ccontrols/component-controls
- Issues: https://github.com/ccontrols/component-controls/issues
- npm.io page: https://npm.io/package/@component-controls/jest-extract

## Dependencies (7)

- [jest](https://npm.io/package/jest.md) ^26.4.2
- [path](https://npm.io/package/path.md) ^0.12.7
- [fastq](https://npm.io/package/fastq.md) ^1.11.0
- [ts-jest](https://npm.io/package/ts-jest.md) ^26.5.5
- [babel-jest](https://npm.io/package/babel-jest.md) ^26.6.3
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.14.3
- [@component-controls/core](https://npm.io/package/@component-controls/core.md) ^4.0.3

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 4.0.3 (latest) — 2022-01-14
- 3.14.6 — 2021-05-20
- 3.14.5 — 2021-05-19
- 3.14.3 — 2021-05-18
- 3.14.2 — 2021-05-18
- 3.14.0 — 2021-05-17
- 3.13.0 — 2021-05-17
- 3.12.0 — 2021-05-13
- 3.11.4 — 2021-05-11
- 3.11.3 — 2021-05-10
- 3.11.0 — 2021-05-10
- 3.10.3 — 2021-05-09
- 3.10.2 — 2021-05-09
- 3.10.0 — 2021-05-08
- 3.9.0 — 2021-04-30
- … 7 more at https://npm.io/package/@component-controls/jest-extract/versions

## README

# Table of contents

-   [Overview](#overview)
-   [Installation](#installation)
-   [API](#api)
    -   [<ins>getRelatedTests</ins>](#insgetrelatedtestsins)
    -   [<ins>runRelatedTests</ins>](#insrunrelatedtestsins)
    -   [<ins>findJestConfig</ins>](#insfindjestconfigins)
    -   [<ins>runTests</ins>](#insruntestsins)
    -   [<ins>runProjectTests</ins>](#insrunprojecttestsins)
        -   [properties](#properties)

# Overview

Given a file name, retrives the jest tests and associated results.

# Installation

This package is usually installed as part of the @component-controls package, but you can also install it standalone:

```bash
$ npm install @component-controls/jest-extract --save-dev
```

# API

<react-docgen-typescript path="./src" />

<!-- START-REACT-DOCGEN-TYPESCRIPT -->

## <ins>getRelatedTests</ins>

find all test files related to a component file

_getRelatedTests [source code](https://github.com/ccontrols/component-controls/tree/master/core/jest-extract/src/related-tests.ts)_

## <ins>runRelatedTests</ins>

retrieves all the tests related to a componnet file

_runRelatedTests [source code](https://github.com/ccontrols/component-controls/tree/master/core/jest-extract/src/related-tests.ts)_

## <ins>findJestConfig</ins>

_findJestConfig [source code](https://github.com/ccontrols/component-controls/tree/master/core/jest-extract/src/run-tests.ts)_

## <ins>runTests</ins>

single test file execution

_runTests [source code](https://github.com/ccontrols/component-controls/tree/master/core/jest-extract/src/run-tests.ts)_

## <ins>runProjectTests</ins>

run tests within the same project (jest config file)

_runProjectTests [source code](https://github.com/ccontrols/component-controls/tree/master/core/jest-extract/src/run-tests.ts)_

### properties

| Name             | Type                                                                                                                                                                                                                                                                                          | Description                                                                                                                                             |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `testFiles*`     | _string\[]_                                                                                                                                                                                                                                                                                   | related test files to execute                                                                                                                           |
| `projectFolder*` | _string_                                                                                                                                                                                                                                                                                      | the folder with jest configuration or package.json                                                                                                      |
| `relativeFolder` | _string_                                                                                                                                                                                                                                                                                      | if supplied, this is the folder from which to report the file names relative to for example this could be the folder where the tested component resides |
| `options*`       | _Partial&lt;Arguments&lt;Partial&lt;{ all: boolean; automock: boolean; bail: number \| boolean; cache: boolean; cacheDirectory: string; changedFilesWithAncestor: boolean; changedSince: string; ci: boolean; clearCache: boolean; ... 77 more ...; watchPathIgnorePatterns: string\[]; }>>>_ | jest options. Can provide collectCoverageOnlyFrom to limit the files coverage is collected from                                                         |

<!-- END-REACT-DOCGEN-TYPESCRIPT -->

---
_Source: https://npm.io/package/@component-controls/jest-extract · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
