@everyonesoftware/common 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/outputs/{chunk-VF6FBNAU.js → chunk-FEQPKLDH.js} +186 -44
- package/outputs/chunk-FEQPKLDH.js.map +1 -0
- package/outputs/{chunk-MMAX3IZF.js → chunk-OYMWB5SX.js} +106 -14
- package/outputs/chunk-OYMWB5SX.js.map +1 -0
- package/outputs/sourceIndex.cjs +106 -13
- package/outputs/sourceIndex.cjs.map +1 -1
- package/outputs/sourceIndex.d.cts +45 -2
- package/outputs/sourceIndex.d.ts +45 -2
- package/outputs/sourceIndex.js +3 -1
- package/outputs/testIndex.cjs +284 -55
- package/outputs/testIndex.cjs.map +1 -1
- package/outputs/testIndex.d.cts +58 -10
- package/outputs/testIndex.d.ts +58 -10
- package/outputs/testIndex.js +2 -2
- package/outputs/tests.cjs +3526 -3003
- package/outputs/tests.cjs.map +1 -1
- package/outputs/tests.js +2688 -2389
- package/outputs/tests.js.map +1 -1
- package/package.json +1 -1
- package/outputs/chunk-MMAX3IZF.js.map +0 -1
- package/outputs/chunk-VF6FBNAU.js.map +0 -1
package/outputs/testIndex.d.cts
CHANGED
|
@@ -144,12 +144,11 @@ declare abstract class Test {
|
|
|
144
144
|
* A {@link Test} type that uses the standard "assert" module to make assertions.
|
|
145
145
|
*/
|
|
146
146
|
declare class AssertTest implements Test {
|
|
147
|
-
private
|
|
148
|
-
protected constructor(name: string);
|
|
147
|
+
private constructor();
|
|
149
148
|
/**
|
|
150
149
|
* Create a new {@link AssertTest} object.
|
|
151
150
|
*/
|
|
152
|
-
static create(
|
|
151
|
+
static create(): AssertTest;
|
|
153
152
|
fail(message: string): never;
|
|
154
153
|
assertUndefined(value: unknown): asserts value is undefined;
|
|
155
154
|
assertNotUndefined<T>(value: T): asserts value is NonNullable<T>;
|
|
@@ -336,14 +335,39 @@ declare class TestAction {
|
|
|
336
335
|
runAsync(): void | Promise<void>;
|
|
337
336
|
}
|
|
338
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Options that can be passed to {@link TestError.getErrorString()}.
|
|
340
|
+
*/
|
|
341
|
+
interface GetErrorStringOptions {
|
|
342
|
+
/**
|
|
343
|
+
* Whether all of the file paths in the stack trace should be shortened to be relative to the
|
|
344
|
+
* current directory.
|
|
345
|
+
*/
|
|
346
|
+
readonly relativeFilePaths?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Remove any stack frames from code that is not part of the current project.
|
|
349
|
+
*/
|
|
350
|
+
readonly removeNonProjectPaths?: boolean;
|
|
351
|
+
}
|
|
352
|
+
declare abstract class TestError {
|
|
353
|
+
protected constructor();
|
|
354
|
+
/**
|
|
355
|
+
* Get the error that caused the test or test group to fail.
|
|
356
|
+
*/
|
|
357
|
+
abstract getError(): unknown;
|
|
358
|
+
/**
|
|
359
|
+
* Get the string representation of the error.
|
|
360
|
+
*/
|
|
361
|
+
abstract getErrorString(options?: GetErrorStringOptions): string;
|
|
362
|
+
}
|
|
363
|
+
|
|
339
364
|
declare class FailedTest {
|
|
340
365
|
private readonly testAction;
|
|
341
366
|
private readonly error;
|
|
342
367
|
private constructor();
|
|
343
|
-
static create(testAction: TestAction, error:
|
|
368
|
+
static create(testAction: TestAction, error: TestError): FailedTest;
|
|
344
369
|
getTestAction(): TestAction;
|
|
345
|
-
|
|
346
|
-
getErrorMessage(): string;
|
|
370
|
+
getTestError(): TestError;
|
|
347
371
|
}
|
|
348
372
|
|
|
349
373
|
declare class SkippedTest {
|
|
@@ -359,6 +383,7 @@ type ConsoleTestRunnerStyle = TestActionType | "passed" | "skipped" | "failed";
|
|
|
359
383
|
declare abstract class ConsoleTestRunnerUI {
|
|
360
384
|
private writeStream?;
|
|
361
385
|
private readonly styles;
|
|
386
|
+
private getErrorStringOptions?;
|
|
362
387
|
protected constructor();
|
|
363
388
|
static flat(): FlatConsoleTestRunnerUI;
|
|
364
389
|
static tree(): TreeConsoleTestRunnerUI;
|
|
@@ -373,12 +398,13 @@ declare abstract class ConsoleTestRunnerUI {
|
|
|
373
398
|
protected writeLine(text?: string): AsyncResult<number>;
|
|
374
399
|
protected writeTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
375
400
|
protected writeFullTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
401
|
+
setGetErrorStringOptions(options: GetErrorStringOptions | undefined): this;
|
|
376
402
|
beforeTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
377
403
|
afterTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
378
404
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
379
405
|
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
380
406
|
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
381
|
-
afterFailedTest(currentTestAction: TestAction, error:
|
|
407
|
+
afterFailedTest(currentTestAction: TestAction, error: TestError): AsyncResult<void>;
|
|
382
408
|
writeSummary(passedTestCount: number, skippedTests: Iterable<SkippedTest>, failedTests: Iterable<FailedTest>): AsyncResult<void>;
|
|
383
409
|
}
|
|
384
410
|
declare class FlatConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
@@ -396,6 +422,25 @@ declare class TreeConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
|
396
422
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
397
423
|
}
|
|
398
424
|
|
|
425
|
+
/**
|
|
426
|
+
* A type that can create new {@link Test} objects.
|
|
427
|
+
*/
|
|
428
|
+
declare abstract class TestCreator {
|
|
429
|
+
/**
|
|
430
|
+
* Create the default {@link TestCreator}.
|
|
431
|
+
*/
|
|
432
|
+
static create(): TestCreator;
|
|
433
|
+
/**
|
|
434
|
+
* Create a new {@link Test} object.
|
|
435
|
+
*/
|
|
436
|
+
abstract createTest(): Test;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare abstract class TestErrorCreator {
|
|
440
|
+
static create(): TestErrorCreator;
|
|
441
|
+
abstract createTestError(error: unknown): TestError;
|
|
442
|
+
}
|
|
443
|
+
|
|
399
444
|
type ConsoleTestFunction = (runner: ConsoleTestRunner) => (void | Promise<void>);
|
|
400
445
|
type ConsoleTestFunctionContainer = {
|
|
401
446
|
test: ConsoleTestFunction;
|
|
@@ -409,14 +454,17 @@ declare class ConsoleTestRunner implements TestRunner {
|
|
|
409
454
|
private passedTestCount;
|
|
410
455
|
private readonly skippedTests;
|
|
411
456
|
private readonly testFailures;
|
|
457
|
+
private readonly testCreator;
|
|
458
|
+
private readonly testErrorCreator;
|
|
412
459
|
private readonly ui;
|
|
413
|
-
constructor(ui?: ConsoleTestRunnerUI);
|
|
414
|
-
static create(ui?: ConsoleTestRunnerUI): ConsoleTestRunner;
|
|
460
|
+
constructor(testCreator?: TestCreator, testErrorCreator?: TestErrorCreator, ui?: ConsoleTestRunnerUI);
|
|
461
|
+
static create(testCreator?: TestCreator, testErrorCreator?: TestErrorCreator, ui?: ConsoleTestRunnerUI): ConsoleTestRunner;
|
|
415
462
|
static run(testFunction: ConsoleTestFunction | ConsoleTestFunctionContainer): Promise<void>;
|
|
416
463
|
static run(testFunctions: JavascriptIterable<ConsoleTestFunction | ConsoleTestFunctionContainer>): Promise<void>;
|
|
417
464
|
setWriteStream(writeStream: CharacterWriteStream): this;
|
|
418
465
|
setStyle(style: ConsoleTestRunnerStyle, styleFunction: (text: string) => string): this;
|
|
419
466
|
setStyles(styles: Partial<Record<ConsoleTestRunnerStyle, (text: string) => string>>): this;
|
|
467
|
+
setGetErrorStringOptions(options: GetErrorStringOptions): this;
|
|
420
468
|
/**
|
|
421
469
|
* Get the number of {@link TestAction}s that have yet to be executed.
|
|
422
470
|
*/
|
|
@@ -451,7 +499,7 @@ declare class ConsoleTestRunner implements TestRunner {
|
|
|
451
499
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
452
500
|
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
453
501
|
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
454
|
-
afterFailedTest(testAction: TestAction, error:
|
|
502
|
+
afterFailedTest(testAction: TestAction, error: TestError): AsyncResult<void>;
|
|
455
503
|
andList(values: unknown[] | Iterable<unknown>): string;
|
|
456
504
|
toString(value: unknown): string;
|
|
457
505
|
skip(message?: string): TestSkip;
|
package/outputs/testIndex.d.ts
CHANGED
|
@@ -144,12 +144,11 @@ declare abstract class Test {
|
|
|
144
144
|
* A {@link Test} type that uses the standard "assert" module to make assertions.
|
|
145
145
|
*/
|
|
146
146
|
declare class AssertTest implements Test {
|
|
147
|
-
private
|
|
148
|
-
protected constructor(name: string);
|
|
147
|
+
private constructor();
|
|
149
148
|
/**
|
|
150
149
|
* Create a new {@link AssertTest} object.
|
|
151
150
|
*/
|
|
152
|
-
static create(
|
|
151
|
+
static create(): AssertTest;
|
|
153
152
|
fail(message: string): never;
|
|
154
153
|
assertUndefined(value: unknown): asserts value is undefined;
|
|
155
154
|
assertNotUndefined<T>(value: T): asserts value is NonNullable<T>;
|
|
@@ -336,14 +335,39 @@ declare class TestAction {
|
|
|
336
335
|
runAsync(): void | Promise<void>;
|
|
337
336
|
}
|
|
338
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Options that can be passed to {@link TestError.getErrorString()}.
|
|
340
|
+
*/
|
|
341
|
+
interface GetErrorStringOptions {
|
|
342
|
+
/**
|
|
343
|
+
* Whether all of the file paths in the stack trace should be shortened to be relative to the
|
|
344
|
+
* current directory.
|
|
345
|
+
*/
|
|
346
|
+
readonly relativeFilePaths?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Remove any stack frames from code that is not part of the current project.
|
|
349
|
+
*/
|
|
350
|
+
readonly removeNonProjectPaths?: boolean;
|
|
351
|
+
}
|
|
352
|
+
declare abstract class TestError {
|
|
353
|
+
protected constructor();
|
|
354
|
+
/**
|
|
355
|
+
* Get the error that caused the test or test group to fail.
|
|
356
|
+
*/
|
|
357
|
+
abstract getError(): unknown;
|
|
358
|
+
/**
|
|
359
|
+
* Get the string representation of the error.
|
|
360
|
+
*/
|
|
361
|
+
abstract getErrorString(options?: GetErrorStringOptions): string;
|
|
362
|
+
}
|
|
363
|
+
|
|
339
364
|
declare class FailedTest {
|
|
340
365
|
private readonly testAction;
|
|
341
366
|
private readonly error;
|
|
342
367
|
private constructor();
|
|
343
|
-
static create(testAction: TestAction, error:
|
|
368
|
+
static create(testAction: TestAction, error: TestError): FailedTest;
|
|
344
369
|
getTestAction(): TestAction;
|
|
345
|
-
|
|
346
|
-
getErrorMessage(): string;
|
|
370
|
+
getTestError(): TestError;
|
|
347
371
|
}
|
|
348
372
|
|
|
349
373
|
declare class SkippedTest {
|
|
@@ -359,6 +383,7 @@ type ConsoleTestRunnerStyle = TestActionType | "passed" | "skipped" | "failed";
|
|
|
359
383
|
declare abstract class ConsoleTestRunnerUI {
|
|
360
384
|
private writeStream?;
|
|
361
385
|
private readonly styles;
|
|
386
|
+
private getErrorStringOptions?;
|
|
362
387
|
protected constructor();
|
|
363
388
|
static flat(): FlatConsoleTestRunnerUI;
|
|
364
389
|
static tree(): TreeConsoleTestRunnerUI;
|
|
@@ -373,12 +398,13 @@ declare abstract class ConsoleTestRunnerUI {
|
|
|
373
398
|
protected writeLine(text?: string): AsyncResult<number>;
|
|
374
399
|
protected writeTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
375
400
|
protected writeFullTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
401
|
+
setGetErrorStringOptions(options: GetErrorStringOptions | undefined): this;
|
|
376
402
|
beforeTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
377
403
|
afterTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
378
404
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
379
405
|
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
380
406
|
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
381
|
-
afterFailedTest(currentTestAction: TestAction, error:
|
|
407
|
+
afterFailedTest(currentTestAction: TestAction, error: TestError): AsyncResult<void>;
|
|
382
408
|
writeSummary(passedTestCount: number, skippedTests: Iterable<SkippedTest>, failedTests: Iterable<FailedTest>): AsyncResult<void>;
|
|
383
409
|
}
|
|
384
410
|
declare class FlatConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
@@ -396,6 +422,25 @@ declare class TreeConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
|
396
422
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
397
423
|
}
|
|
398
424
|
|
|
425
|
+
/**
|
|
426
|
+
* A type that can create new {@link Test} objects.
|
|
427
|
+
*/
|
|
428
|
+
declare abstract class TestCreator {
|
|
429
|
+
/**
|
|
430
|
+
* Create the default {@link TestCreator}.
|
|
431
|
+
*/
|
|
432
|
+
static create(): TestCreator;
|
|
433
|
+
/**
|
|
434
|
+
* Create a new {@link Test} object.
|
|
435
|
+
*/
|
|
436
|
+
abstract createTest(): Test;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare abstract class TestErrorCreator {
|
|
440
|
+
static create(): TestErrorCreator;
|
|
441
|
+
abstract createTestError(error: unknown): TestError;
|
|
442
|
+
}
|
|
443
|
+
|
|
399
444
|
type ConsoleTestFunction = (runner: ConsoleTestRunner) => (void | Promise<void>);
|
|
400
445
|
type ConsoleTestFunctionContainer = {
|
|
401
446
|
test: ConsoleTestFunction;
|
|
@@ -409,14 +454,17 @@ declare class ConsoleTestRunner implements TestRunner {
|
|
|
409
454
|
private passedTestCount;
|
|
410
455
|
private readonly skippedTests;
|
|
411
456
|
private readonly testFailures;
|
|
457
|
+
private readonly testCreator;
|
|
458
|
+
private readonly testErrorCreator;
|
|
412
459
|
private readonly ui;
|
|
413
|
-
constructor(ui?: ConsoleTestRunnerUI);
|
|
414
|
-
static create(ui?: ConsoleTestRunnerUI): ConsoleTestRunner;
|
|
460
|
+
constructor(testCreator?: TestCreator, testErrorCreator?: TestErrorCreator, ui?: ConsoleTestRunnerUI);
|
|
461
|
+
static create(testCreator?: TestCreator, testErrorCreator?: TestErrorCreator, ui?: ConsoleTestRunnerUI): ConsoleTestRunner;
|
|
415
462
|
static run(testFunction: ConsoleTestFunction | ConsoleTestFunctionContainer): Promise<void>;
|
|
416
463
|
static run(testFunctions: JavascriptIterable<ConsoleTestFunction | ConsoleTestFunctionContainer>): Promise<void>;
|
|
417
464
|
setWriteStream(writeStream: CharacterWriteStream): this;
|
|
418
465
|
setStyle(style: ConsoleTestRunnerStyle, styleFunction: (text: string) => string): this;
|
|
419
466
|
setStyles(styles: Partial<Record<ConsoleTestRunnerStyle, (text: string) => string>>): this;
|
|
467
|
+
setGetErrorStringOptions(options: GetErrorStringOptions): this;
|
|
420
468
|
/**
|
|
421
469
|
* Get the number of {@link TestAction}s that have yet to be executed.
|
|
422
470
|
*/
|
|
@@ -451,7 +499,7 @@ declare class ConsoleTestRunner implements TestRunner {
|
|
|
451
499
|
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
452
500
|
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
453
501
|
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
454
|
-
afterFailedTest(testAction: TestAction, error:
|
|
502
|
+
afterFailedTest(testAction: TestAction, error: TestError): AsyncResult<void>;
|
|
455
503
|
andList(values: unknown[] | Iterable<unknown>): string;
|
|
456
504
|
toString(value: unknown): string;
|
|
457
505
|
skip(message?: string): TestSkip;
|