# describe-ast-parser

> Parses jest code to AST and extract nodes with `describe` and `test`

Latest version **0.0.7** (published 2023-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install describe-ast-parser
pnpm add describe-ast-parser
yarn add describe-ast-parser
bun add describe-ast-parser
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2023-07-07 |
| First published | 2023-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | TakaShinoda |
| Maintainers | t.shinoda |
| Keywords | jest, ast, parser |

## Links

- npm: https://www.npmjs.com/package/describe-ast-parser
- Repository: https://github.com/TakaShinoda/describe-ast-parser
- Homepage: https://github.com/TakaShinoda/describe-ast-parser#readme
- Issues: https://github.com/TakaShinoda/describe-ast-parser/issues
- npm.io page: https://npm.io/package/describe-ast-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2023-07-07
- 0.0.6 — 2023-07-05
- 0.0.5 — 2023-07-02
- 0.0.4 — 2023-07-01
- 0.0.3 — 2023-07-01
- 0.0.2 — 2023-07-01
- 0.0.1 — 2023-07-01

## README

# describe-ast-parser

![NPM](https://img.shields.io/npm/l/describe-ast-parser)
![npm](https://img.shields.io/npm/v/describe-ast-parser)


Parses jest code to AST and extract nodes with `describe` and `test`


## Install

```
npm i describe-ast-parser
```


## Usage

```ts
// test.spec.ts

describe('test.spec.ts', () => {
  test('test 1', () => {
    expect('Hello World').toBe('Hello World')
  })

  test('test 2', () => {
    expect(true).toBe(true)
  })
})
```

```ts
// index.ts

import { parse } from 'describe-ast-parser'
import { readFileSync } from 'fs'

console.log(parse(readFileSync('src/test.spec.ts', 'utf8')))
```

```
[
  {
    "type": "StringLiteral",
    "start": 9,
    "end": 23,
    "loc": {
      "start": {
        "line": 1,
        "column": 9,
        "index": 9
      },
      "end": {
        "line": 1,
        "column": 23,
        "index": 23
      }
    },
    "extra": {
      "rawValue": "test.spec.ts",
      "raw": "'test.spec.ts'"
    },
    "value": "test.spec.ts"
  },
  {
    "type": "StringLiteral",
    "start": 40,
    "end": 48,
    "loc": {
      "start": {
        "line": 2,
        "column": 7,
        "index": 40
      },
      "end": {
        "line": 2,
        "column": 15,
        "index": 48
      }
    },
    "extra": {
      "rawValue": "test 1",
      "raw": "'test 1'"
    },
    "value": "test 1"
  },
  {
    "type": "StringLiteral",
    "start": 117,
    "end": 125,
    "loc": {
      "start": {
        "line": 6,
        "column": 7,
        "index": 117
      },
      "end": {
        "line": 6,
        "column": 15,
        "index": 125
      }
    },
    "extra": {
      "rawValue": "test 2",
      "raw": "'test 2'"
    },
    "value": "test 2"
  }
]
```


## License

This project is licensed [MIT license](https://github.com/TakaShinoda/describe-ast-parser/blob/main/LICENSE).

---
_Source: https://npm.io/package/describe-ast-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
