@dereekb/util 13.11.17 → 13.12.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/eslint/index.cjs.js +250 -754
- package/eslint/index.esm.js +243 -754
- package/eslint/package.json +1 -1
- package/eslint/src/lib/dbx-tag-families.d.ts +1 -1
- package/eslint/src/lib/index.d.ts +3 -1
- package/eslint/src/lib/plugin.d.ts +0 -2
- package/eslint/src/lib/require-constant-naming.rule.d.ts +17 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +1 -1
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +1 -1
- package/fetch/package.json +2 -2
- package/package.json +1 -1
- package/test/index.cjs.js +64 -0
- package/test/index.esm.js +64 -1
- package/test/package.json +2 -2
- package/test/src/lib/shared/shared.fail.d.ts +20 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +0 -46
package/eslint/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
|
|
3
|
-
* scanner schemas in `packages/dbx-
|
|
3
|
+
* scanner schemas in `packages/dbx-cli/src/lib/mcp-scan/scan/*-extract.ts` so
|
|
4
4
|
* violations surface at lint time instead of at manifest-regeneration time.
|
|
5
5
|
*
|
|
6
6
|
* Each per-family rule supplies a {@link DbxTagFamilySpec} describing which
|
|
@@ -16,10 +16,12 @@ export { UTIL_REQUIRE_DBX_DOCS_UI_EXAMPLE_COMPANION_TAGS_RULE, type UtilRequireD
|
|
|
16
16
|
export { UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE, type UtilRequireDbxModelSnapshotFieldCompanionTagsRuleOptions, type UtilRequireDbxModelSnapshotFieldCompanionTagsRuleDefinition } from './require-dbx-model-snapshot-field-companion-tags.rule';
|
|
17
17
|
export { UTIL_REQUIRE_DBX_ACTION_COMPANION_TAGS_RULE, type UtilRequireDbxActionCompanionTagsRuleOptions, type UtilRequireDbxActionCompanionTagsRuleDefinition } from './require-dbx-action-companion-tags.rule';
|
|
18
18
|
export { UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE, type UtilRequireDbxFormFieldCompanionTagsRuleOptions, type UtilRequireDbxFormFieldCompanionTagsRuleDefinition } from './require-dbx-form-field-companion-tags.rule';
|
|
19
|
-
export { UTIL_REQUIRE_DBX_MODEL_COMPANION_TAGS_RULE, type UtilRequireDbxModelCompanionTagsRuleOptions, type UtilRequireDbxModelCompanionTagsRuleDefinition } from './require-dbx-model-companion-tags.rule';
|
|
20
19
|
export { UTIL_REQUIRE_DBX_AUTH_COMPANION_TAGS_RULE, type UtilRequireDbxAuthCompanionTagsRuleOptions, type UtilRequireDbxAuthCompanionTagsRuleDefinition } from './require-dbx-auth-companion-tags.rule';
|
|
21
20
|
export { UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE, type UtilRequireDbxRuleCompanionTagsRuleOptions, type UtilRequireDbxRuleCompanionTagsRuleDefinition } from './require-dbx-rule-companion-tags.rule';
|
|
22
21
|
export { UTIL_REQUIRE_CONSTANT_NAMING_RULE, type UtilRequireConstantNamingRuleOptions, type UtilRequireConstantNamingRuleDefinition } from './require-constant-naming.rule';
|
|
23
22
|
export { UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE, type UtilRequireDefaultPrefixNamingRuleOptions, type UtilRequireDefaultPrefixNamingRuleDefinition } from './require-default-prefix-naming.rule';
|
|
24
23
|
export { UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE, type UtilRequireExportedJsdocExampleRuleOptions, type UtilRequireExportedJsdocExampleRuleDefinition } from './require-exported-jsdoc-example.rule';
|
|
25
24
|
export { UTIL_ESLINT_PLUGIN, utilESLintPlugin, type UtilEslintPlugin } from './plugin';
|
|
25
|
+
export { getStatementAnchor, leadingJsdocFor } from './comments';
|
|
26
|
+
export { parseJsdocComment, type ParsedJsdoc, type ParsedJsdocTag, type ParsedJsdocLine } from './jsdoc-parser';
|
|
27
|
+
export { buildLowercaseTagsFix, checkDbxTagFamily, findFamilyTags, parseBooleanTagValue, reportOnJsdocLine, type DbxCompanionTagSpec, type DbxTagFamilySpec } from './dbx-tag-families';
|
|
@@ -16,7 +16,6 @@ import { type UtilRequireDbxDocsUiExampleCompanionTagsRuleDefinition } from './r
|
|
|
16
16
|
import { type UtilRequireDbxModelSnapshotFieldCompanionTagsRuleDefinition } from './require-dbx-model-snapshot-field-companion-tags.rule';
|
|
17
17
|
import { type UtilRequireDbxActionCompanionTagsRuleDefinition } from './require-dbx-action-companion-tags.rule';
|
|
18
18
|
import { type UtilRequireDbxFormFieldCompanionTagsRuleDefinition } from './require-dbx-form-field-companion-tags.rule';
|
|
19
|
-
import { type UtilRequireDbxModelCompanionTagsRuleDefinition } from './require-dbx-model-companion-tags.rule';
|
|
20
19
|
import { type UtilRequireDbxAuthCompanionTagsRuleDefinition } from './require-dbx-auth-companion-tags.rule';
|
|
21
20
|
import { type UtilRequireDbxRuleCompanionTagsRuleDefinition } from './require-dbx-rule-companion-tags.rule';
|
|
22
21
|
import { type UtilRequireConstantNamingRuleDefinition } from './require-constant-naming.rule';
|
|
@@ -48,7 +47,6 @@ export interface UtilEslintPlugin {
|
|
|
48
47
|
readonly 'require-dbx-model-snapshot-field-companion-tags': UtilRequireDbxModelSnapshotFieldCompanionTagsRuleDefinition;
|
|
49
48
|
readonly 'require-dbx-action-companion-tags': UtilRequireDbxActionCompanionTagsRuleDefinition;
|
|
50
49
|
readonly 'require-dbx-form-field-companion-tags': UtilRequireDbxFormFieldCompanionTagsRuleDefinition;
|
|
51
|
-
readonly 'require-dbx-model-companion-tags': UtilRequireDbxModelCompanionTagsRuleDefinition;
|
|
52
50
|
readonly 'require-dbx-auth-companion-tags': UtilRequireDbxAuthCompanionTagsRuleDefinition;
|
|
53
51
|
readonly 'require-dbx-rule-companion-tags': UtilRequireDbxRuleCompanionTagsRuleDefinition;
|
|
54
52
|
readonly 'require-constant-naming': UtilRequireConstantNamingRuleDefinition;
|
|
@@ -11,6 +11,17 @@ export interface UtilRequireConstantNamingRuleOptions {
|
|
|
11
11
|
* Defaults to `@dbxAllowConstantName`.
|
|
12
12
|
*/
|
|
13
13
|
readonly exemptJsdocTag?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Type annotation identifier names whose `export const X: T = {...}` declarations are exempt
|
|
16
|
+
* from the rule.
|
|
17
|
+
*
|
|
18
|
+
* When the declarator's type annotation is a `TSTypeReference` whose identifier (or leftmost
|
|
19
|
+
* segment of a `TSQualifiedName`) is in this list, the constant is skipped regardless of casing.
|
|
20
|
+
*
|
|
21
|
+
* Defaults to {@link DEFAULT_EXEMPT_TYPE_ANNOTATIONS}. Pass an empty array to opt out of the
|
|
22
|
+
* defaults entirely (strict mode); pass a non-empty array to replace the defaults.
|
|
23
|
+
*/
|
|
24
|
+
readonly exemptTypeAnnotations?: readonly string[];
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
27
|
* ESLint rule definition for require-constant-naming.
|
|
@@ -54,6 +65,12 @@ export interface UtilRequireConstantNamingRuleDefinition {
|
|
|
54
65
|
* Use the exempt JSDoc tag (default `@dbxAllowConstantName`) to silence the rule on a specific
|
|
55
66
|
* declaration when the heuristics get it wrong.
|
|
56
67
|
*
|
|
68
|
+
* Framework-prescribed singleton types (UIRouter's `Ng2StateDeclaration`, Angular's
|
|
69
|
+
* `ApplicationConfig`, `Routes`, etc.) are exempt by default via the `exemptTypeAnnotations` option:
|
|
70
|
+
* any `export const X: T = {...}` whose type annotation is a `TSTypeReference` to one of those
|
|
71
|
+
* names is skipped regardless of casing. Pass `exemptTypeAnnotations: []` to opt out of the
|
|
72
|
+
* defaults, or pass a non-empty array to replace the default allowlist with a project-specific set.
|
|
73
|
+
*
|
|
57
74
|
* Not auto-fixable: renaming an exported binding has cross-file impact that an autofix can't safely
|
|
58
75
|
* propagate.
|
|
59
76
|
*
|
|
@@ -37,7 +37,7 @@ export interface UtilRequireDbxActionCompanionTagsRuleDefinition {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* ESLint rule enforcing `@dbxAction` companion tags. Mirrors the scanner
|
|
40
|
-
* schema at `packages/dbx-
|
|
40
|
+
* schema at `packages/dbx-cli/src/lib/mcp-scan/scan/actions-extract.ts`. Class
|
|
41
41
|
* declarations carry the `@dbxAction` marker; enum declarations carry the
|
|
42
42
|
* `@dbxActionStateEnum` marker, and `@dbxActionStateTransitionsFrom/To` are
|
|
43
43
|
* valid on enum-member JSDocs.
|
|
@@ -35,7 +35,7 @@ export interface UtilRequireDbxAuthCompanionTagsRuleDefinition {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* ESLint rule enforcing the three `@dbxAuth*` marker families. Mirrors the
|
|
38
|
-
* scanner schema at `packages/dbx-
|
|
38
|
+
* scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/auth-extract.ts`.
|
|
39
39
|
*
|
|
40
40
|
* - `@dbxAuthClaimsApp <slug>` on an interface / type alias.
|
|
41
41
|
* - `@dbxAuthClaim` (bare) on a `PropertySignature` inside an interface.
|
|
@@ -36,7 +36,7 @@ export interface UtilRequireDbxDocsUiExampleCompanionTagsRuleDefinition {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* ESLint rule enforcing `@dbxDocsUiExample` companion tags. Mirrors the
|
|
39
|
-
* scanner schema at `packages/dbx-
|
|
39
|
+
* scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.ts`.
|
|
40
40
|
*/
|
|
41
41
|
export declare const UTIL_REQUIRE_DBX_DOCS_UI_EXAMPLE_COMPANION_TAGS_RULE: UtilRequireDbxDocsUiExampleCompanionTagsRuleDefinition;
|
|
42
42
|
export {};
|
|
@@ -35,7 +35,7 @@ export interface UtilRequireDbxFilterCompanionTagsRuleDefinition {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* ESLint rule enforcing `@dbxFilter` companion tags. Mirrors the scanner
|
|
38
|
-
* schema at `packages/dbx-
|
|
38
|
+
* schema at `packages/dbx-cli/src/lib/mcp-scan/scan/filters-extract.ts`.
|
|
39
39
|
* Applies to classes (filter directives) and exported interfaces (filter
|
|
40
40
|
* patterns); the scanner reads both as filter entries.
|
|
41
41
|
*/
|
|
@@ -39,7 +39,7 @@ export interface UtilRequireDbxFormFieldCompanionTagsRuleDefinition {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* ESLint rule enforcing `@dbxFormField` companion tags. Mirrors the scanner
|
|
42
|
-
* schema at `packages/dbx-
|
|
42
|
+
* schema at `packages/dbx-cli/src/lib/mcp-scan/scan/forge-fields-extract.ts`,
|
|
43
43
|
* including the tier-conditional required-tag matrix.
|
|
44
44
|
*/
|
|
45
45
|
export declare const UTIL_REQUIRE_DBX_FORM_FIELD_COMPANION_TAGS_RULE: UtilRequireDbxFormFieldCompanionTagsRuleDefinition;
|
|
@@ -38,7 +38,7 @@ export interface UtilRequireDbxModelSnapshotFieldCompanionTagsRuleDefinition {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* ESLint rule enforcing `@dbxModelSnapshotField` companion tags. Mirrors the
|
|
41
|
-
* scanner schema at `packages/dbx-
|
|
41
|
+
* scanner schema at `packages/dbx-cli/src/lib/mcp-scan/scan/model-snapshot-fields-extract.ts`.
|
|
42
42
|
*/
|
|
43
43
|
export declare const UTIL_REQUIRE_DBX_MODEL_SNAPSHOT_FIELD_COMPANION_TAGS_RULE: UtilRequireDbxModelSnapshotFieldCompanionTagsRuleDefinition;
|
|
44
44
|
export {};
|
|
@@ -36,7 +36,7 @@ export interface UtilRequireDbxPipeCompanionTagsRuleDefinition {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* ESLint rule enforcing `@dbxPipe` companion tags. Mirrors the scanner schema
|
|
39
|
-
* at `packages/dbx-
|
|
39
|
+
* at `packages/dbx-cli/src/lib/mcp-scan/scan/pipes-extract.ts` so violations
|
|
40
40
|
* surface at lint time instead of at manifest-regeneration time.
|
|
41
41
|
*/
|
|
42
42
|
export declare const UTIL_REQUIRE_DBX_PIPE_COMPANION_TAGS_RULE: UtilRequireDbxPipeCompanionTagsRuleDefinition;
|
|
@@ -55,7 +55,7 @@ export interface UtilRequireDbxUtilCompanionTagsRuleDefinition {
|
|
|
55
55
|
/**
|
|
56
56
|
* ESLint rule enforcing that exports tagged `@dbxUtil` carry the registry-required companion tags
|
|
57
57
|
* with valid value formats. Mirrors the scanner schema at
|
|
58
|
-
* `packages/dbx-
|
|
58
|
+
* `packages/dbx-cli/src/lib/mcp-scan/scan/utils-extract.ts` so violations surface at lint time
|
|
59
59
|
* instead of at manifest-regeneration time.
|
|
60
60
|
*
|
|
61
61
|
* Checks:
|
|
@@ -37,7 +37,7 @@ export interface UtilRequireDbxWebCompanionTagsRuleDefinition {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* ESLint rule enforcing `@dbxWebComponent` companion tags. Mirrors the scanner
|
|
40
|
-
* schema at `packages/dbx-
|
|
40
|
+
* schema at `packages/dbx-cli/src/lib/mcp-scan/scan/ui-components-extract.ts`.
|
|
41
41
|
*/
|
|
42
42
|
export declare const UTIL_REQUIRE_DBX_WEB_COMPANION_TAGS_RULE: UtilRequireDbxWebCompanionTagsRuleDefinition;
|
|
43
43
|
export {};
|
package/fetch/package.json
CHANGED
package/package.json
CHANGED
package/test/index.cjs.js
CHANGED
|
@@ -1220,6 +1220,69 @@ function _ts_generator(thisArg, body) {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
return promiseResult;
|
|
1222
1222
|
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Invokes `fn` and returns the value it rejects with. Throws {@link UnexpectedSuccessFailureError}
|
|
1225
|
+
* when `fn` resolves successfully.
|
|
1226
|
+
*
|
|
1227
|
+
* Use this when a test needs the thrown value in hand to assert on multiple of its properties
|
|
1228
|
+
* (e.g. inspect a structured `details.code`). For "did it throw at all" checks, prefer
|
|
1229
|
+
* {@link expectFail} or vitest's `await expect(fn()).rejects.toThrow(...)`.
|
|
1230
|
+
*
|
|
1231
|
+
* @param fn - Async function expected to reject.
|
|
1232
|
+
* @returns The thrown value as `unknown`.
|
|
1233
|
+
* @throws {UnexpectedSuccessFailureError} When `fn` resolves successfully.
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* ```ts
|
|
1237
|
+
* const error = await captureRejection(() => callResetPassword({ resetPassword: '000000' }));
|
|
1238
|
+
* expect(error).toBeInstanceOf(HttpsError);
|
|
1239
|
+
* expect((error as HttpsError).code).toBe('invalid-argument');
|
|
1240
|
+
* ```
|
|
1241
|
+
*/ function captureRejection(fn) {
|
|
1242
|
+
return _async_to_generator(function() {
|
|
1243
|
+
var thrown, didThrow, e;
|
|
1244
|
+
return _ts_generator(this, function(_state) {
|
|
1245
|
+
switch(_state.label){
|
|
1246
|
+
case 0:
|
|
1247
|
+
didThrow = false;
|
|
1248
|
+
_state.label = 1;
|
|
1249
|
+
case 1:
|
|
1250
|
+
_state.trys.push([
|
|
1251
|
+
1,
|
|
1252
|
+
3,
|
|
1253
|
+
,
|
|
1254
|
+
4
|
|
1255
|
+
]);
|
|
1256
|
+
return [
|
|
1257
|
+
4,
|
|
1258
|
+
fn()
|
|
1259
|
+
];
|
|
1260
|
+
case 2:
|
|
1261
|
+
_state.sent();
|
|
1262
|
+
return [
|
|
1263
|
+
3,
|
|
1264
|
+
4
|
|
1265
|
+
];
|
|
1266
|
+
case 3:
|
|
1267
|
+
e = _state.sent();
|
|
1268
|
+
thrown = e;
|
|
1269
|
+
didThrow = true;
|
|
1270
|
+
return [
|
|
1271
|
+
3,
|
|
1272
|
+
4
|
|
1273
|
+
];
|
|
1274
|
+
case 4:
|
|
1275
|
+
if (!didThrow) {
|
|
1276
|
+
failDueToSuccess();
|
|
1277
|
+
}
|
|
1278
|
+
return [
|
|
1279
|
+
2,
|
|
1280
|
+
thrown
|
|
1281
|
+
];
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
})();
|
|
1285
|
+
}
|
|
1223
1286
|
function expectSuccessfulFail(errorFn) {
|
|
1224
1287
|
var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
|
|
1225
1288
|
var result;
|
|
@@ -1559,6 +1622,7 @@ exports.JestExpectedFailError = JestExpectedFailError;
|
|
|
1559
1622
|
exports.JestUnexpectedSuccessFailureError = JestUnexpectedSuccessFailureError;
|
|
1560
1623
|
exports.UnexpectedSuccessFailureError = UnexpectedSuccessFailureError;
|
|
1561
1624
|
exports.callbackTest = callbackTest;
|
|
1625
|
+
exports.captureRejection = captureRejection;
|
|
1562
1626
|
exports.expectFail = expectFail;
|
|
1563
1627
|
exports.expectFailAssertErrorType = expectFailAssertErrorType;
|
|
1564
1628
|
exports.expectSuccessfulFail = expectSuccessfulFail;
|
package/test/index.esm.js
CHANGED
|
@@ -1218,6 +1218,69 @@ function _ts_generator(thisArg, body) {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
return promiseResult;
|
|
1220
1220
|
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Invokes `fn` and returns the value it rejects with. Throws {@link UnexpectedSuccessFailureError}
|
|
1223
|
+
* when `fn` resolves successfully.
|
|
1224
|
+
*
|
|
1225
|
+
* Use this when a test needs the thrown value in hand to assert on multiple of its properties
|
|
1226
|
+
* (e.g. inspect a structured `details.code`). For "did it throw at all" checks, prefer
|
|
1227
|
+
* {@link expectFail} or vitest's `await expect(fn()).rejects.toThrow(...)`.
|
|
1228
|
+
*
|
|
1229
|
+
* @param fn - Async function expected to reject.
|
|
1230
|
+
* @returns The thrown value as `unknown`.
|
|
1231
|
+
* @throws {UnexpectedSuccessFailureError} When `fn` resolves successfully.
|
|
1232
|
+
*
|
|
1233
|
+
* @example
|
|
1234
|
+
* ```ts
|
|
1235
|
+
* const error = await captureRejection(() => callResetPassword({ resetPassword: '000000' }));
|
|
1236
|
+
* expect(error).toBeInstanceOf(HttpsError);
|
|
1237
|
+
* expect((error as HttpsError).code).toBe('invalid-argument');
|
|
1238
|
+
* ```
|
|
1239
|
+
*/ function captureRejection(fn) {
|
|
1240
|
+
return _async_to_generator(function() {
|
|
1241
|
+
var thrown, didThrow, e;
|
|
1242
|
+
return _ts_generator(this, function(_state) {
|
|
1243
|
+
switch(_state.label){
|
|
1244
|
+
case 0:
|
|
1245
|
+
didThrow = false;
|
|
1246
|
+
_state.label = 1;
|
|
1247
|
+
case 1:
|
|
1248
|
+
_state.trys.push([
|
|
1249
|
+
1,
|
|
1250
|
+
3,
|
|
1251
|
+
,
|
|
1252
|
+
4
|
|
1253
|
+
]);
|
|
1254
|
+
return [
|
|
1255
|
+
4,
|
|
1256
|
+
fn()
|
|
1257
|
+
];
|
|
1258
|
+
case 2:
|
|
1259
|
+
_state.sent();
|
|
1260
|
+
return [
|
|
1261
|
+
3,
|
|
1262
|
+
4
|
|
1263
|
+
];
|
|
1264
|
+
case 3:
|
|
1265
|
+
e = _state.sent();
|
|
1266
|
+
thrown = e;
|
|
1267
|
+
didThrow = true;
|
|
1268
|
+
return [
|
|
1269
|
+
3,
|
|
1270
|
+
4
|
|
1271
|
+
];
|
|
1272
|
+
case 4:
|
|
1273
|
+
if (!didThrow) {
|
|
1274
|
+
failDueToSuccess();
|
|
1275
|
+
}
|
|
1276
|
+
return [
|
|
1277
|
+
2,
|
|
1278
|
+
thrown
|
|
1279
|
+
];
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
})();
|
|
1283
|
+
}
|
|
1221
1284
|
function expectSuccessfulFail(errorFn) {
|
|
1222
1285
|
var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
|
|
1223
1286
|
var result;
|
|
@@ -1543,4 +1606,4 @@ function _is_native_reflect_construct() {
|
|
|
1543
1606
|
* @deprecated Use useTestFunctionMapFixture from shared instead. This is kept for backwards compatibility.
|
|
1544
1607
|
*/ var useJestFunctionMapFixture = useTestFunctionMapFixture;
|
|
1545
1608
|
|
|
1546
|
-
export { AbstractChildJestTestContextFixture, AbstractChildTestContextFixture, AbstractJestTestContextFixture, AbstractTestContextFixture, AbstractWrappedFixture, AbstractWrappedFixtureWithInstance, EXPECT_ERROR_DEFAULT_HANDLER, ExpectedErrorOfSpecificTypeError, ExpectedFailError, JestExpectedErrorOfSpecificTypeError, JestExpectedFailError, JestUnexpectedSuccessFailureError, UnexpectedSuccessFailureError, callbackTest, expectFail, expectFailAssertErrorType, expectSuccessfulFail, failDueToSuccess, failDueToSuccessError, failSuccessfully, failSuccessfullyError, failTest, failWithDoneDueToSuccess, failWithJestDoneCallback, failWithTestDoneCallback, fakeDoneHandler, instanceWrapJestTestContextFactory, instanceWrapTestContextFactory, itShouldFail, jestExpectFailAssertErrorType, jestTestContextBuilder, shouldFail, testContextBuilder, testDoneCallbackRef, useJestContextFixture, useJestFunctionFixture, useJestFunctionMapFixture, useTestContextFixture, useTestFunctionFixture, useTestFunctionMapFixture, wrapJestTestContextFactory, wrapTestContextFactory };
|
|
1609
|
+
export { AbstractChildJestTestContextFixture, AbstractChildTestContextFixture, AbstractJestTestContextFixture, AbstractTestContextFixture, AbstractWrappedFixture, AbstractWrappedFixtureWithInstance, EXPECT_ERROR_DEFAULT_HANDLER, ExpectedErrorOfSpecificTypeError, ExpectedFailError, JestExpectedErrorOfSpecificTypeError, JestExpectedFailError, JestUnexpectedSuccessFailureError, UnexpectedSuccessFailureError, callbackTest, captureRejection, expectFail, expectFailAssertErrorType, expectSuccessfulFail, failDueToSuccess, failDueToSuccessError, failSuccessfully, failSuccessfullyError, failTest, failWithDoneDueToSuccess, failWithJestDoneCallback, failWithTestDoneCallback, fakeDoneHandler, instanceWrapJestTestContextFactory, instanceWrapTestContextFactory, itShouldFail, jestExpectFailAssertErrorType, jestTestContextBuilder, shouldFail, testContextBuilder, testDoneCallbackRef, useJestContextFixture, useJestFunctionFixture, useJestFunctionMapFixture, useTestContextFixture, useTestFunctionFixture, useTestFunctionMapFixture, wrapJestTestContextFactory, wrapTestContextFactory };
|
package/test/package.json
CHANGED
|
@@ -105,6 +105,26 @@ export declare function expectFailAssertErrorType(expectedType: ClassType | Clas
|
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
107
|
export declare function expectFail(errorFn: () => PromiseOrValue<any>, assertFailType?: ExpectFailAssertionFunction): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Invokes `fn` and returns the value it rejects with. Throws {@link UnexpectedSuccessFailureError}
|
|
110
|
+
* when `fn` resolves successfully.
|
|
111
|
+
*
|
|
112
|
+
* Use this when a test needs the thrown value in hand to assert on multiple of its properties
|
|
113
|
+
* (e.g. inspect a structured `details.code`). For "did it throw at all" checks, prefer
|
|
114
|
+
* {@link expectFail} or vitest's `await expect(fn()).rejects.toThrow(...)`.
|
|
115
|
+
*
|
|
116
|
+
* @param fn - Async function expected to reject.
|
|
117
|
+
* @returns The thrown value as `unknown`.
|
|
118
|
+
* @throws {UnexpectedSuccessFailureError} When `fn` resolves successfully.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const error = await captureRejection(() => callResetPassword({ resetPassword: '000000' }));
|
|
123
|
+
* expect(error).toBeInstanceOf(HttpsError);
|
|
124
|
+
* expect((error as HttpsError).code).toBe('invalid-argument');
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function captureRejection<T>(fn: () => Promise<T>): Promise<unknown>;
|
|
108
128
|
/**
|
|
109
129
|
* Function that expects an {@link ExpectedFailError} to be thrown by `errorFn`.
|
|
110
130
|
*
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
interface AstNode {
|
|
2
|
-
readonly type: string;
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Options for the require-dbx-model-companion-tags rule.
|
|
7
|
-
*/
|
|
8
|
-
export interface UtilRequireDbxModelCompanionTagsRuleOptions {
|
|
9
|
-
readonly allowedEncodings?: readonly string[];
|
|
10
|
-
readonly knownCompanions?: readonly string[];
|
|
11
|
-
readonly requireBareMarker?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* ESLint rule definition for require-dbx-model-companion-tags.
|
|
15
|
-
*/
|
|
16
|
-
export interface UtilRequireDbxModelCompanionTagsRuleDefinition {
|
|
17
|
-
readonly meta: {
|
|
18
|
-
readonly type: 'suggestion';
|
|
19
|
-
readonly fixable: 'code';
|
|
20
|
-
readonly docs: {
|
|
21
|
-
readonly description: string;
|
|
22
|
-
readonly recommended: boolean;
|
|
23
|
-
};
|
|
24
|
-
readonly messages: Readonly<Record<string, string>>;
|
|
25
|
-
readonly schema: readonly object[];
|
|
26
|
-
};
|
|
27
|
-
create(context: {
|
|
28
|
-
options: UtilRequireDbxModelCompanionTagsRuleOptions[];
|
|
29
|
-
report: (descriptor: {
|
|
30
|
-
loc?: AstNode;
|
|
31
|
-
messageId: string;
|
|
32
|
-
data?: Record<string, string>;
|
|
33
|
-
}) => void;
|
|
34
|
-
sourceCode: AstNode;
|
|
35
|
-
}): Record<string, (node: AstNode) => void>;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* ESLint rule enforcing `@dbxModel` / `@dbxModelSubObject` / `@dbxModelOrganizationalGroupRoot`
|
|
39
|
-
* companion tags. Mirrors the scanner schema at
|
|
40
|
-
* `packages/dbx-components-mcp/src/scan/extract-models/find-interfaces.ts`.
|
|
41
|
-
*
|
|
42
|
-
* Does NOT enforce a Slug / Category / Tags shape because the scanner does
|
|
43
|
-
* not consume those for this family.
|
|
44
|
-
*/
|
|
45
|
-
export declare const UTIL_REQUIRE_DBX_MODEL_COMPANION_TAGS_RULE: UtilRequireDbxModelCompanionTagsRuleDefinition;
|
|
46
|
-
export {};
|