Skip to main content

betterer

API > @betterer/betterer

JavaScript API for running betterer.

Classes

ClassDescription
BettererFileTestA very common usecase for Betterer is to track issues across all the files in a project. BettererFileTest provides a wrapper around BettererTest that makes it easier to implement such a test.
BettererTestThe main interface to the Betterer test system.

Functions

FunctionDescription
betterer(options)Run Betterer with the given options.
merge(options)Resolve any merge conflicts in the specified results file.
results(options)Get a summary of the results of the defined BettererTests.Betterer will read the test definition file and the results file and return a summary of the results.
runner(options)Create a BettererRunner with the given options.
watch(options)Create a BettererRunner with the given options. Also starts up a file watcher for tracked files in the current working directory.

Interfaces

InterfaceDescription
BettererConfigFull validated config object for Betterer.
BettererContextThe context of a set of test suite runs.
BettererContextSummaryThe summary of a set of test suite runs.
BettererDiffThe result of computing the difference between two results.
BettererFileBasic information about a file and its issues.
BettererFileBaseBasic information about a file and its issues.
BettererFileDiffA diff object for a single file.
BettererFileIssueAn issue in a file
BettererFileResolverA helper for resolving file paths in a BettererFileTest.
BettererFileTestResultA set of BettererFiles which each have their own set of BettererFileIssues.
BettererFileTestResultSummaryThe summary of the result of a BettererFileTest.
BettererOptionsMergeOptions for when merging conflicts in the results file via the betterer.merge() API.
BettererOptionsOverrideOptions for when you override the config via the BettererContext.options() API.
BettererOptionsResultsOptions for when you create a BettererResultsSummary via the betterer.results() API.
BettererOptionsWatchOptions for when you create a BettererRunner via the betterer.watch() JS API.
BettererReporterThe interface for hooking into Betterer's reporter system.
BettererResultThe deserialised result object for a single run of a single BettererTest.
BettererResultsSummaryA summary of the results of the defined BettererTests.
BettererRunA single BettererTest run. Will become a BettererRunSummary when the test run is completed.
BettererRunnerThe JS API for controlling Betterer runs.
BettererRunSummaryThe summary of a BettererTest run. Includes everything from BettererRun.
BettererSerialiserThe functions that convert between SerialisedType and DeserialisedType.
BettererSuiteA set of BettererTest runs. Will become a BettererSuiteSummary when the test suite is completed.
BettererSuiteSummaryThe summary of a BettererSuite suite. Includes everything from BettererSuite.
BettererTestConfigThe validated configuration for a BettererTest.
BettererTestOptionsBasicThe least complex version of a BettererTest operates on simple numbers and can be defined with just a few properties.
BettererTestOptionsComplexFor a more complex version of a BettererTest that operates on more complex objects, you need to define more complex behaviour.
BettererTestResultSummaryThe summary of the result of a BettererTest.

Type Aliases

Type AliasDescription
BettererConfigExcludesAn array of Regular Expressions that match file paths that will be excluded from an operation.
BettererConfigFiltersAn array of Regular Expressions that match names of relevant tests.
BettererConfigIgnoresAn array of absolute glob patterns that match file paths that will be ignored by the file watcher in watch mode.
BettererConfigIncludesAn array of absolute glob patterns that match file paths that will be included in an operation.
BettererConfigPathsAn array of absolute test definition file paths containing Betterer tests.
BettererDeltaThe change between a test runs and its baseline. A BettererRun has a delta property if the test has a progress() handler.
BettererDeserialiseThe function that converts from a SerialisedType to a DeserialisedType.
BettererDifferA function that compares two test results.
BettererFileGlobsAn array of glob patterns that match file paths that will be included in an operation. All globs should be relative to the current .
BettererFileIssuesAn array of BettererFileIssues.
BettererFileIssueSerialisedA serialised BettererFileIssue.
BettererFileIssuesSerialisedAn array of BettererFileIssueSerialiseds.
BettererFilePathThe path to a file on disk.
BettererFilePathsAn array of paths to files on disk.
BettererFilePatternsAn array of Regular Expressions that match file paths that will be excluded from an operation.
BettererFilesDiffA map from file path to BettererFileDiff.
BettererFileTestDiffA diff object for a complete BettererFileTest run.
BettererFileTestFunctionA function that runs an actual file test.
BettererFileTestResultSerialisedA map from file path to BettererFileIssuesSerialised.
BettererFileTestResultSummaryDetailsThe summarised result of a BettererFileTest. A mapping from the path to a file to an array of BettererFileIssues.
BettererOptionsExcludesA string or Regular Expression to match file paths that should be excluded from an operation, or an array of them.
BettererOptionsFiltersA string or Regular Expression to match the names of relevant tests, or an array of them.
BettererOptionsIgnoresA glob pattern to match file paths that should be ignored by the file watcher in watch mode, or an array of them.
BettererOptionsIncludesA glob pattern to match file paths that should be included in an operation, or an array of them.
BettererOptionsPathsA path to a test definition file containing Betterer tests, or an array of them.
BettererOptionsReportersAn array of names of npm packages that export a BettererReporter, or objects that implement BettererReporter.
BettererOptionsRunnerOptions for when you create a BettererRunner via the betterer.runner() API.
BettererOptionsStartOptions for when you run Betterer via the JS API.
BettererPrinterA function that converts a serialised test result into the string that will be saved in the results file.
BettererProgressA function that converts a test result to a numeric value that represents the progress towards the goal.
BettererResultSummariesAn array of BettererResultSummary.
BettererResultSummaryThe summary of the result of a BettererTest or BettererFileTest.
BettererRunsAn array of BettererRuns.
BettererRunSummariesAn array of BettererRunSummaries.
BettererSerialiseThe function that converts from a DeserialisedType to a SerialisedType.
BettererSuiteSummariesAn array of BettererSuiteSummaries.
BettererTestConstraintA function that checks if a test result is better, worse, or the same than the expected result.
BettererTestDeadlineThe date when the test should be completed by. The test will be marked as expired if it runs after the specified date.
BettererTestFunctionA function that runs the actual test.
BettererTestGoalA function that returns whether the test has met its goal.
BettererTestNamesAn array of test names.
BettererTestOptionsOptions for creating a BettererTest.
BettererTestResultSummaryDetailsThe summarised result of a BettererTest.