@feasibleone/blong 1.18.3 → 1.19.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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/types.ts +46 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.19.0](https://github.com/feasibleone/blong/compare/blong-v1.18.3...blong-v1.19.0) (2026-05-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* snapshot testing ([ffae636](https://github.com/feasibleone/blong/commit/ffae6360d9f6a04b42e733fc6be291e1cd707bfa))
|
|
9
|
+
|
|
3
10
|
## [1.18.3](https://github.com/feasibleone/blong/compare/blong-v1.18.2...blong-v1.18.3) (2026-05-14)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -675,9 +675,26 @@ export type GatewaySchema = (
|
|
|
675
675
|
export type SchemaObject = OpenAPIV3_1.SchemaObject | OpenAPIV2.SchemaObject;
|
|
676
676
|
export type PathItemObject = OpenAPIV3_1.PathItemObject | OpenAPIV2.PathItemObject;
|
|
677
677
|
export type ThenableProxy = Promise<unknown> & {[key: string]: ThenableProxy};
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Augmented assert passed to every chain step. The `snapshot()` method is
|
|
681
|
+
* injected at runtime by the test executor, so handlers can call it directly
|
|
682
|
+
* without `(assert as any)` casts. Import this type from `@feasibleone/blong`
|
|
683
|
+
* instead of `typeof Assert` from `node:assert` in test handlers.
|
|
684
|
+
*/
|
|
685
|
+
export type IAssert = typeof Assert & {
|
|
686
|
+
/**
|
|
687
|
+
* Deferred (no-args): snapshot the step's return value under the step name.
|
|
688
|
+
* Optional object form: `assert.snapshot({mask: ['id']})` adds a per-call mask.
|
|
689
|
+
* Explicit form: `assert.snapshot(value, 'name', {mask?})` writes immediately.
|
|
690
|
+
*/
|
|
691
|
+
snapshot(valueOrOpts?: unknown, name?: string, opts?: {mask?: string[]}): void;
|
|
692
|
+
matchSnapshot(value: unknown, name?: string): void;
|
|
693
|
+
};
|
|
694
|
+
|
|
678
695
|
export type ChainStep =
|
|
679
696
|
| ((
|
|
680
|
-
assert:
|
|
697
|
+
assert: IAssert,
|
|
681
698
|
context: {
|
|
682
699
|
$meta: IMeta;
|
|
683
700
|
} & Record<string, Promise<unknown[]> & ThenableProxy>,
|
|
@@ -690,8 +707,34 @@ export interface ILib {
|
|
|
690
707
|
type: typeof Type;
|
|
691
708
|
error: <T>(errors: T) => Record<keyof T, (params?: unknown, $meta?: IMeta) => ITypedError>;
|
|
692
709
|
rename: <T extends object>(object: T, name: string) => T & {name: string};
|
|
693
|
-
/**
|
|
694
|
-
|
|
710
|
+
/**
|
|
711
|
+
* Create a named group of chain steps. The group name is used in test reports.
|
|
712
|
+
* Optionally configure the group with `autoSnapshot: true` to automatically snapshot the
|
|
713
|
+
* return the steps and the common mask to apply to all snapshots taken within the group.
|
|
714
|
+
*
|
|
715
|
+
* @param name
|
|
716
|
+
* @param config
|
|
717
|
+
* @returns
|
|
718
|
+
*/
|
|
719
|
+
group: (
|
|
720
|
+
name: string,
|
|
721
|
+
config?: {autoSnapshot?: boolean; mask?: string[]},
|
|
722
|
+
) => (handlers: ChainStep[]) => ChainStep[] & {name: string};
|
|
723
|
+
/**
|
|
724
|
+
* Create a named snapshot checkpoint marker to place inside a `group()` steps array.
|
|
725
|
+
* Without extra arguments the `'*'` wildcard waits for all pending steps.
|
|
726
|
+
* With step names only those steps are awaited before the context snapshot is taken.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* group('my-test')([
|
|
730
|
+
* stepA,
|
|
731
|
+
* stepB,
|
|
732
|
+
* checkpoint('after-b', 'stepA', 'stepB'), // wait for A & B, then snapshot
|
|
733
|
+
* stepC,
|
|
734
|
+
* checkpoint('final'), // wait for all, then snapshot
|
|
735
|
+
* ])
|
|
736
|
+
*/
|
|
737
|
+
checkpoint: (name: string, ...markers: string[]) => string[] & {name: string};
|
|
695
738
|
assert: typeof Assert | undefined;
|
|
696
739
|
yaml: {
|
|
697
740
|
parse: <T>(source: string, options?: unknown) => T;
|