1.0.1 • Published 8 days ago

@andriyorehov/ts-tree-cli v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

ts-tree-cli

This CLI uses ts-tree to get file tree and coverage-tree to show result on web

Motivation

Using global thresholds in a large monolith, which is managed by multiple teams, threshold coverage is not so precise and clear. For instance, while a global threshold may be set at 70 percent, certain pages might not be covered at all. This lack of coverage is not noticeable since we have a lot of lines of code on other pages. Additionally, different pages may have different requirements for coverage depending on criticality.

In Jest, it's possible to specify thresholds by glob pattern, but it's not what we want since page code can be imported from different folders.

So I decided to build a tool that generates a coverage report per entry file based on all files which imported into this page.

Installation

npm i -g @andriyorehov/ts-tree-cli

Usage

Process coverage and save to file

ts-tree -f='pathToComponent.tsx' -c='projectDir/coverage-summary.json' -p -o='tree.json'

Open coverage tree on browser (works only if URL is less then 14 KB URL_TOO_LONG)

ts-tree -f='pathToComponent.tsx' -c='projectDir/coverage-summary.json' -w

Example config

tree-cov.json

[
  {
    "team": "teamName",
    "threshold": {
      "lines": 70.09
    },
    "owns": [
      {
        "label": "Reports page",
        "file": "src/pages/reports/index.page.tsx",
        "threshold": {
          "branches": 50,
          "functions": 50,
          "lines": 50,
          "statements": 50
        }
      },
      {
        "label": "Settings page",
        "file": "src/pages/settings/index.page.tsx",
        "threshold": {
          "branches": 50,
          "functions": 50,
          "lines": 50,
          "statements": 50
        }
      }
    ]
  }
]

TODO

✅ save result to file

✅ handle coverage file

✅ calculate coverage

✅ open result on web app

✅ publish package

✅ output by all files in tree threshold in console

✅ config with file entries

✅ colorized output

✅ auto bump threshold

✅ exit code on when threshold not met

✅ threshold per team

❌ output by accumulated tree threshold in console?

❌ better CLI handling

❌ --help option

Tech Debt

  • update open package to latest version with ESM
1.0.1

8 days ago

1.0.0

9 days ago

0.0.13

20 days ago

0.0.12

25 days ago

0.0.10

1 month ago

0.0.11

1 month ago

0.0.9

1 month ago

0.0.8

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.5

2 months ago

0.0.4

2 months ago

0.0.3

2 months ago

0.0.2

2 months ago

0.0.1

2 months ago