New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ctrf

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ctrf

Various CTRF utilities available programatically and by command line

  • 0.0.12
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
28K
decreased by-19.31%
Maintainers
0
Weekly downloads
 
Created
Source

CTRF CLI

Various CTRF utilities available programatically and by command line

Help us grow CTRF

If you find this project useful, please consider following the CTRF organisation and giving this repository a star

It means a lot to us and helps us grow this open source library.

Command Line Utilities

NameDetails
mergeMerge multiple CTRF reports into a single report.
flakyOutput flaky test name and retries.

Merge

This might be useful if you need a single report, but your chosen reporter generates multiple reports through design, parallelisation or otherwise.

To merge CTRF reports in a specified directory, use the following command:

npx ctrf merge <directory>

Replace directory with the path to the directory containing the CTRF reports you want to merge.

Options

-o, --output filename: Output file name for the merged report. Default is ctrf-report.json.

npx ctrf merge <directory> --output my-merged-report.json

-d, --output-dir directory: Output directory for the merged report. Default is the same directory as the input reports.

npx ctrf merge <directory> --output-dir /path/to/output

-k, --keep-reports: Keep existing reports after merging. By default, the original reports will be deleted after merging.

npx ctrf merge <directory> --keep-reports

Flaky

The flaky command is useful for identifying tests marked as flaky in your CTRF report. Flaky tests are tests that pass or fail inconsistently and may require special attention or retries to determine their reliability.

Usage To output flaky tests, use the following command:

npx ctrf flaky <file-path>

Replace with the path to the CTRF report file you want to analyze.

Output

The command will output the names of the flaky tests and the number of retries each test has undergone. For example:

Processing report: reports/sample-report.json
Found 1 flaky test(s) in reports/sample-report.json:
- Test Name: Test 1, Retries: 2

Programmatic Methods

npm install ctrf

The following programmatic methods are available:

mergeReports - This method merges multiple CTRF reports into a single report.

readSingleReport - Reads and parses a single CTRF report file from a specified file path.

readReportsFromDirectory - Reads all CTRF report files from a given directory.

readReportsFromGlobPattern - Reads all CTRF report files from a given glob pattern.

What is CTRF?

CTRF is a universal JSON test report schema that addresses the lack of a standardized format for JSON test reports.

Consistency Across Tools: Different testing tools and frameworks often produce reports in varied formats. CTRF ensures a uniform structure, making it easier to understand and compare reports, regardless of the testing tool used.

Language and Framework Agnostic: It provides a universal reporting schema that works seamlessly with any programming language and testing framework.

Facilitates Better Analysis: With a standardized format, programatically analyzing test outcomes across multiple platforms becomes more straightforward.

Support Us

If you find this project useful, consider giving it a GitHub star ⭐ It means a lot to us.

FAQs

Package last updated on 11 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc