Package Exports
- suite-metrics
- suite-metrics/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (suite-metrics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
suite-metrics
Easily keep track of metrics for many nested test suites
Features:
- Track execution time to microseconds for tests
- Use any amount of nested suites in any structure with tests anywhere
- Metrics for suites, sub-suites and tests
- Simple interface
- [In development] Concurrent test running
📦 Installation
npm i suite-metrics -D
# or
pnpm i suite-metrics -D
# or
yarn add suite-metrics -D
🚀 Usage
import SuiteMetrics from 'suite-metrics';
// Singleton (easy for many files)
const metrics = SuiteMetrics.getInstance();
// Or new instance (if ou need separate metrics)
const metrics = new SuiteMetrics();
metrics.startTest(["Suite Name", "Sub-suite name", "Test Name"]);
// Run test...
metrics.endTest();
// Get metrics - speed, stats, etc
console.log(metrics.printAllSuiteMetrics()); // Simple summary of all tests
metrics.getSuiteMetrics(["Suite Name"]); // Detailed metrics for suite
metrics.getSuiteMetricsRecursive(["Suite Name"]); // Include sub-suites
// Helpers
metrics.suiteExists(["Suite Name"]);
metrics.testExists(["Suite Name", "Test Name"]);