Open smartclash opened 4 years ago
rebase this now that #74 has landed?
Still very interested in seeing this land 😀
Instead of making a breaking change, maybe tsd
can just have verbose: boolean
option?
const diagnostics = await tsd();
//=> Diagnostic[]
console.log(diagnostics.length);
//=> '0'
const verboseResults = await tsd({verbose: true});
//=> {testCount: number, diagnostics: Diagnostic[]}
console.log(verboseResults.testCount);
//=> '1024'
console.log(verboseResults.diagnostics.length);
//=> '0'
I'm fine with this change. Having an object also gives us the opportunity to add additional properties in the future.
Instead of making a breaking change, maybe tsd can just have verbose: boolean option?
I don't like options that change the return value type.
I think a breaking change is ok here. Programmatic use is not that common.
TSD either returns a null array if there is no test failures or an array of
Diagnostic
objects. This PR aims to make TSD return withExtendedDiagnostic
object no matter if the tests fail or not.Merging this PR allows custom test runners like Jest to report the number of assertions it evaluated in each file.
It also means that it introduces a breaking change because TSD now returns...
An object with
numTests
and nulldiagnostics
array if all tests passed.An object with
numTests
and andiagnostics
array populated with test fail reports if a test is failed.Unit tests have been added
A more detailed explanation can be found here - Reporting Test Count
This PR is Co-Authored By: