@everyonesoftware/common 10.0.0 → 12.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.
@@ -1,4 +1,4 @@
1
- import { f as JavascriptIterable, S as SyncResult, P as PromiseAsyncResult, k as Type, I as Iterable, A as AsyncResult, C as CharacterWriteStream } from './characterWriteStream-ogvZec-U.cjs';
1
+ import { g as JavascriptIterable, S as SyncResult, P as PromiseAsyncResult, l as Type, I as Iterable, A as AsyncResult, C as CharacterWriteStream, a as Clock, D as DateTime } from './characterWriteStream-CzPcNOCD.cjs';
2
2
 
3
3
  /**
4
4
  * A type that can be used to make assertions during a test.
@@ -348,6 +348,11 @@ interface GetErrorStringOptions {
348
348
  * Remove any stack frames from code that is not part of the current project.
349
349
  */
350
350
  readonly removeNonProjectPaths?: boolean;
351
+ /**
352
+ * A style function to apply to the file path/location of a stack frame.
353
+ * @param stackFrameLocation The file path/location of the stack frame.
354
+ */
355
+ readonly stackFrameLocationStyle?: (stackFrameLocation: string) => string;
351
356
  }
352
357
  declare abstract class TestError {
353
358
  protected constructor();
@@ -521,4 +526,19 @@ declare class ConsoleTestRunner implements TestRunner {
521
526
  printSummary(): AsyncResult<void>;
522
527
  }
523
528
 
524
- export { AssertTest, BasicTestSkip, type ConsoleTestFunction, type ConsoleTestFunctionContainer, ConsoleTestRunner, FailedTest, SkippedTest, Test, TestAction, type TestActionType, TestRunner, TestSkip, test };
529
+ /**
530
+ * A {@link Clock} implementation that returns a configured {@link DateTime}.
531
+ */
532
+ declare class FakeClock extends Clock {
533
+ private currentTime;
534
+ private constructor();
535
+ static create(currentTime?: DateTime): FakeClock;
536
+ /**
537
+ * Set the {@link DateTime} that this {@link FakeClock} will return.
538
+ * @param currentTime The {@link DateTime} that this {@link FakeClock} will return.
539
+ */
540
+ setCurrentTime(currentTime: DateTime): this;
541
+ now(): DateTime;
542
+ }
543
+
544
+ export { AssertTest, BasicTestSkip, type ConsoleTestFunction, type ConsoleTestFunctionContainer, ConsoleTestRunner, FailedTest, FakeClock, SkippedTest, Test, TestAction, type TestActionType, TestRunner, TestSkip, test };
@@ -1,4 +1,4 @@
1
- import { f as JavascriptIterable, S as SyncResult, P as PromiseAsyncResult, k as Type, I as Iterable, A as AsyncResult, C as CharacterWriteStream } from './characterWriteStream-ogvZec-U.js';
1
+ import { g as JavascriptIterable, S as SyncResult, P as PromiseAsyncResult, l as Type, I as Iterable, A as AsyncResult, C as CharacterWriteStream, a as Clock, D as DateTime } from './characterWriteStream-CzPcNOCD.js';
2
2
 
3
3
  /**
4
4
  * A type that can be used to make assertions during a test.
@@ -348,6 +348,11 @@ interface GetErrorStringOptions {
348
348
  * Remove any stack frames from code that is not part of the current project.
349
349
  */
350
350
  readonly removeNonProjectPaths?: boolean;
351
+ /**
352
+ * A style function to apply to the file path/location of a stack frame.
353
+ * @param stackFrameLocation The file path/location of the stack frame.
354
+ */
355
+ readonly stackFrameLocationStyle?: (stackFrameLocation: string) => string;
351
356
  }
352
357
  declare abstract class TestError {
353
358
  protected constructor();
@@ -521,4 +526,19 @@ declare class ConsoleTestRunner implements TestRunner {
521
526
  printSummary(): AsyncResult<void>;
522
527
  }
523
528
 
524
- export { AssertTest, BasicTestSkip, type ConsoleTestFunction, type ConsoleTestFunctionContainer, ConsoleTestRunner, FailedTest, SkippedTest, Test, TestAction, type TestActionType, TestRunner, TestSkip, test };
529
+ /**
530
+ * A {@link Clock} implementation that returns a configured {@link DateTime}.
531
+ */
532
+ declare class FakeClock extends Clock {
533
+ private currentTime;
534
+ private constructor();
535
+ static create(currentTime?: DateTime): FakeClock;
536
+ /**
537
+ * Set the {@link DateTime} that this {@link FakeClock} will return.
538
+ * @param currentTime The {@link DateTime} that this {@link FakeClock} will return.
539
+ */
540
+ setCurrentTime(currentTime: DateTime): this;
541
+ now(): DateTime;
542
+ }
543
+
544
+ export { AssertTest, BasicTestSkip, type ConsoleTestFunction, type ConsoleTestFunctionContainer, ConsoleTestRunner, FailedTest, FakeClock, SkippedTest, Test, TestAction, type TestActionType, TestRunner, TestSkip, test };
@@ -9,13 +9,42 @@ import {
9
9
  TestRunner,
10
10
  TestSkip,
11
11
  test
12
- } from "./chunk-TPV4JEMM.js";
13
- import "./chunk-OYMWB5SX.js";
12
+ } from "./chunk-FZ3WRQ7B.js";
13
+ import {
14
+ Clock,
15
+ DateTime,
16
+ PreCondition
17
+ } from "./chunk-MHMLVX2O.js";
18
+
19
+ // tests/FakeClock.ts
20
+ var FakeClock = class _FakeClock extends Clock {
21
+ currentTime;
22
+ constructor(currentTime) {
23
+ PreCondition.assertNotUndefinedAndNotNull(currentTime, "currentTime");
24
+ super();
25
+ this.currentTime = currentTime;
26
+ }
27
+ static create(currentTime) {
28
+ return new _FakeClock(currentTime ?? DateTime.now());
29
+ }
30
+ /**
31
+ * Set the {@link DateTime} that this {@link FakeClock} will return.
32
+ * @param currentTime The {@link DateTime} that this {@link FakeClock} will return.
33
+ */
34
+ setCurrentTime(currentTime) {
35
+ this.currentTime = currentTime;
36
+ return this;
37
+ }
38
+ now() {
39
+ return this.currentTime;
40
+ }
41
+ };
14
42
  export {
15
43
  AssertTest,
16
44
  BasicTestSkip,
17
45
  ConsoleTestRunner,
18
46
  FailedTest,
47
+ FakeClock,
19
48
  SkippedTest,
20
49
  Test,
21
50
  TestAction,
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../tests/FakeClock.ts"],"sourcesContent":["import { Clock, DateTime, PreCondition } from \"../sources\";\n\n/**\n * A {@link Clock} implementation that returns a configured {@link DateTime}.\n */\nexport class FakeClock extends Clock\n{\n private currentTime: DateTime;\n\n private constructor(currentTime: DateTime)\n {\n PreCondition.assertNotUndefinedAndNotNull(currentTime, \"currentTime\");\n\n super();\n\n this.currentTime = currentTime;\n }\n\n public static create(currentTime?: DateTime): FakeClock\n {\n return new FakeClock(currentTime ?? DateTime.now());\n }\n\n /**\n * Set the {@link DateTime} that this {@link FakeClock} will return.\n * @param currentTime The {@link DateTime} that this {@link FakeClock} will return.\n */\n public setCurrentTime(currentTime: DateTime): this\n {\n this.currentTime = currentTime;\n\n return this;\n }\n\n public now(): DateTime\n {\n return this.currentTime;\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAKO,IAAM,YAAN,MAAM,mBAAkB,MAC/B;AAAA,EACY;AAAA,EAEA,YAAY,aACpB;AACI,iBAAa,6BAA6B,aAAa,aAAa;AAEpE,UAAM;AAEN,SAAK,cAAc;AAAA,EACvB;AAAA,EAEA,OAAc,OAAO,aACrB;AACI,WAAO,IAAI,WAAU,eAAe,SAAS,IAAI,CAAC;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,eAAe,aACtB;AACI,SAAK,cAAc;AAEnB,WAAO;AAAA,EACX;AAAA,EAEO,MACP;AACI,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}