cdk-common 1.0.929 → 1.0.931

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.
@@ -461,6 +461,12 @@ declare module "node:test" {
461
461
  * @since v18.0.0, v16.17.0
462
462
  */
463
463
  class TestContext {
464
+ /**
465
+ * An object containing assertion methods bound to the test context.
466
+ * The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
467
+ * @since v22.2.0
468
+ */
469
+ readonly assert: TestContextAssert;
464
470
  /**
465
471
  * This function is used to create a hook running before subtest of the current test.
466
472
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
@@ -508,6 +514,42 @@ declare module "node:test" {
508
514
  * @since v18.8.0, v16.18.0
509
515
  */
510
516
  readonly name: string;
517
+ /**
518
+ * Used to set the number of assertions and subtests that are expected to run within the test.
519
+ * If the number of assertions and subtests that run does not match the expected count, the test will fail.
520
+ *
521
+ * To make sure assertions are tracked, the assert functions on `context.assert` must be used,
522
+ * instead of importing from the `node:assert` module.
523
+ * ```js
524
+ * test('top level test', (t) => {
525
+ * t.plan(2);
526
+ * t.assert.ok('some relevant assertion here');
527
+ * t.test('subtest', () => {});
528
+ * });
529
+ * ```
530
+ *
531
+ * When working with asynchronous code, the `plan` function can be used to ensure that the correct number of assertions are run:
532
+ * ```js
533
+ * test('planning with streams', (t, done) => {
534
+ * function* generate() {
535
+ * yield 'a';
536
+ * yield 'b';
537
+ * yield 'c';
538
+ * }
539
+ * const expected = ['a', 'b', 'c'];
540
+ * t.plan(expected.length);
541
+ * const stream = Readable.from(generate());
542
+ * stream.on('data', (chunk) => {
543
+ * t.assert.strictEqual(chunk, expected.shift());
544
+ * });
545
+ * stream.on('end', () => {
546
+ * done();
547
+ * });
548
+ * });
549
+ * ```
550
+ * @since v22.2.0
551
+ */
552
+ plan(count: number): void;
511
553
  /**
512
554
  * If `shouldRunOnlyTests` is truthy, the test context will only run tests that
513
555
  * have the `only` option set. Otherwise, all tests are run. If Node.js was not
@@ -584,6 +626,76 @@ declare module "node:test" {
584
626
  */
585
627
  readonly mock: MockTracker;
586
628
  }
629
+ interface TestContextAssert {
630
+ /**
631
+ * Identical to the `deepEqual` function from the `node:assert` module, but bound to the test context.
632
+ */
633
+ deepEqual: typeof import("node:assert").deepEqual;
634
+ /**
635
+ * Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context.
636
+ */
637
+ deepStrictEqual: typeof import("node:assert").deepStrictEqual;
638
+ /**
639
+ * Identical to the `doesNotMatch` function from the `node:assert` module, but bound to the test context.
640
+ */
641
+ doesNotMatch: typeof import("node:assert").doesNotMatch;
642
+ /**
643
+ * Identical to the `doesNotReject` function from the `node:assert` module, but bound to the test context.
644
+ */
645
+ doesNotReject: typeof import("node:assert").doesNotReject;
646
+ /**
647
+ * Identical to the `doesNotThrow` function from the `node:assert` module, but bound to the test context.
648
+ */
649
+ doesNotThrow: typeof import("node:assert").doesNotThrow;
650
+ /**
651
+ * Identical to the `equal` function from the `node:assert` module, but bound to the test context.
652
+ */
653
+ equal: typeof import("node:assert").equal;
654
+ /**
655
+ * Identical to the `fail` function from the `node:assert` module, but bound to the test context.
656
+ */
657
+ fail: typeof import("node:assert").fail;
658
+ /**
659
+ * Identical to the `ifError` function from the `node:assert` module, but bound to the test context.
660
+ */
661
+ ifError: typeof import("node:assert").ifError;
662
+ /**
663
+ * Identical to the `match` function from the `node:assert` module, but bound to the test context.
664
+ */
665
+ match: typeof import("node:assert").match;
666
+ /**
667
+ * Identical to the `notDeepEqual` function from the `node:assert` module, but bound to the test context.
668
+ */
669
+ notDeepEqual: typeof import("node:assert").notDeepEqual;
670
+ /**
671
+ * Identical to the `notDeepStrictEqual` function from the `node:assert` module, but bound to the test context.
672
+ */
673
+ notDeepStrictEqual: typeof import("node:assert").notDeepStrictEqual;
674
+ /**
675
+ * Identical to the `notEqual` function from the `node:assert` module, but bound to the test context.
676
+ */
677
+ notEqual: typeof import("node:assert").notEqual;
678
+ /**
679
+ * Identical to the `notStrictEqual` function from the `node:assert` module, but bound to the test context.
680
+ */
681
+ notStrictEqual: typeof import("node:assert").notStrictEqual;
682
+ /**
683
+ * Identical to the `ok` function from the `node:assert` module, but bound to the test context.
684
+ */
685
+ ok: typeof import("node:assert").ok;
686
+ /**
687
+ * Identical to the `rejects` function from the `node:assert` module, but bound to the test context.
688
+ */
689
+ rejects: typeof import("node:assert").rejects;
690
+ /**
691
+ * Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context.
692
+ */
693
+ strictEqual: typeof import("node:assert").strictEqual;
694
+ /**
695
+ * Identical to the `throws` function from the `node:assert` module, but bound to the test context.
696
+ */
697
+ throws: typeof import("node:assert").throws;
698
+ }
587
699
 
588
700
  /**
589
701
  * An instance of `SuiteContext` is passed to each suite function in order to
@@ -643,6 +755,14 @@ declare module "node:test" {
643
755
  * @default false
644
756
  */
645
757
  todo?: boolean | string | undefined;
758
+ /**
759
+ * The number of assertions and subtests expected to be run in the test.
760
+ * If the number of assertions run in the test does not match the number
761
+ * specified in the plan, the test will fail.
762
+ * @default undefined
763
+ * @since v22.2.0
764
+ */
765
+ plan?: number | undefined;
646
766
  }
647
767
  /**
648
768
  * This function creates a hook that runs before executing a suite.
@@ -172,6 +172,15 @@ declare module "zlib" {
172
172
  interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
173
173
  interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
174
174
  interface Unzip extends stream.Transform, Zlib {}
175
+ /**
176
+ * Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
177
+ * If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
178
+ * @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
179
+ * @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
180
+ * @returns A 32-bit unsigned integer containing the checksum.
181
+ * @since v22.2.0
182
+ */
183
+ function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
175
184
  /**
176
185
  * Creates and returns a new `BrotliCompress` object.
177
186
  * @since v11.7.0, v10.16.0
package/package.json CHANGED
@@ -90,7 +90,7 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "version": "1.0.929",
93
+ "version": "1.0.931",
94
94
  "jest": {
95
95
  "coverageProvider": "v8",
96
96
  "testMatch": [