strong-mock 9.0.0-beta.3 → 9.0.1
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/dist/index.js +23 -21
- package/dist/index.js.map +1 -1
- package/dist/mock/mock.d.ts +0 -5
- package/dist/mock/mode.d.ts +6 -0
- package/dist/mock/stub.d.ts +1 -1
- package/package.json +14 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
var jestMatcherUtils = require('jest-matcher-utils');
|
|
2
2
|
var jestDiff = require('jest-diff');
|
|
3
|
-
var stripAnsi = require('strip-ansi');
|
|
4
3
|
var lodash = require('lodash');
|
|
5
4
|
|
|
6
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
-
|
|
8
|
-
var stripAnsi__default = /*#__PURE__*/_interopDefaultLegacy(stripAnsi);
|
|
9
|
-
|
|
10
5
|
/**
|
|
11
6
|
* Special symbol denoting the call of a function.
|
|
12
7
|
*/
|
|
@@ -142,15 +137,21 @@ ${printRemainingExpectations(expectations)}`));
|
|
|
142
137
|
}
|
|
143
138
|
}
|
|
144
139
|
|
|
140
|
+
const noColor = s => s;
|
|
145
141
|
const printArgsDiff = (expected, actual) => {
|
|
146
142
|
const diff = jestDiff.diff(expected, actual, {
|
|
147
|
-
omitAnnotationLines: true
|
|
143
|
+
omitAnnotationLines: true,
|
|
144
|
+
aColor: noColor,
|
|
145
|
+
bColor: noColor,
|
|
146
|
+
changeColor: noColor,
|
|
147
|
+
commonColor: noColor,
|
|
148
|
+
patchColor: noColor
|
|
148
149
|
});
|
|
149
150
|
/* istanbul ignore next this is not expected in practice */
|
|
150
151
|
if (!diff) {
|
|
151
152
|
return '';
|
|
152
153
|
}
|
|
153
|
-
const
|
|
154
|
+
const diffLines = diff.split('\n');
|
|
154
155
|
let relevantDiffLines;
|
|
155
156
|
// Strip Array [ ... ] surroundings.
|
|
156
157
|
if (!expected.length) {
|
|
@@ -158,18 +159,18 @@ const printArgsDiff = (expected, actual) => {
|
|
|
158
159
|
// + Array [
|
|
159
160
|
// ...
|
|
160
161
|
// ]
|
|
161
|
-
relevantDiffLines =
|
|
162
|
+
relevantDiffLines = diffLines.slice(2, -1);
|
|
162
163
|
} else if (!actual.length) {
|
|
163
164
|
// - Array [
|
|
164
165
|
// ...
|
|
165
166
|
// ]
|
|
166
167
|
// + Array []
|
|
167
|
-
relevantDiffLines =
|
|
168
|
+
relevantDiffLines = diffLines.slice(1, -2);
|
|
168
169
|
} else {
|
|
169
170
|
// Array [
|
|
170
171
|
// ...
|
|
171
172
|
// ]
|
|
172
|
-
relevantDiffLines =
|
|
173
|
+
relevantDiffLines = diffLines.slice(1, -1);
|
|
173
174
|
}
|
|
174
175
|
// Strip the trailing comma.
|
|
175
176
|
const lastLine = relevantDiffLines[relevantDiffLines.length - 1].slice(0, -1);
|
|
@@ -674,6 +675,17 @@ const setMockState = (mock, state) => {
|
|
|
674
675
|
};
|
|
675
676
|
const getAllMocks = () => Array.from(mockMap.entries());
|
|
676
677
|
|
|
678
|
+
var Mode;
|
|
679
|
+
(function (Mode) {
|
|
680
|
+
Mode[Mode["EXPECT"] = 0] = "EXPECT";
|
|
681
|
+
Mode[Mode["CALL"] = 1] = "CALL";
|
|
682
|
+
})(Mode || (Mode = {}));
|
|
683
|
+
let currentMode = Mode.CALL;
|
|
684
|
+
const setMode = mode => {
|
|
685
|
+
currentMode = mode;
|
|
686
|
+
};
|
|
687
|
+
const getMode = () => currentMode;
|
|
688
|
+
|
|
677
689
|
const createProxy = traps =>
|
|
678
690
|
// The Proxy target MUST be a function, otherwise we can't use the `apply` trap:
|
|
679
691
|
// https://262.ecma-international.org/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist
|
|
@@ -746,16 +758,6 @@ const createStub = (repo, builder, getCurrentMode) => {
|
|
|
746
758
|
|
|
747
759
|
const strongExpectationFactory = (property, args, returnValue, concreteMatcher, exactParams) => new StrongExpectation(property, // Wrap every non-matcher in the default matcher.
|
|
748
760
|
args == null ? void 0 : args.map(arg => isMatcher(arg) ? arg : concreteMatcher(arg)), returnValue, exactParams);
|
|
749
|
-
var Mode;
|
|
750
|
-
(function (Mode) {
|
|
751
|
-
Mode[Mode["EXPECT"] = 0] = "EXPECT";
|
|
752
|
-
Mode[Mode["CALL"] = 1] = "CALL";
|
|
753
|
-
})(Mode || (Mode = {}));
|
|
754
|
-
let currentMode = Mode.CALL;
|
|
755
|
-
const setMode = mode => {
|
|
756
|
-
currentMode = mode;
|
|
757
|
-
};
|
|
758
|
-
const getMode = () => currentMode;
|
|
759
761
|
/**
|
|
760
762
|
* Create a type safe mock.
|
|
761
763
|
*
|
|
@@ -1070,7 +1072,7 @@ const isArray = containing => matches(actual => {
|
|
|
1070
1072
|
return deepEquals(x).matches(y);
|
|
1071
1073
|
}) !== undefined);
|
|
1072
1074
|
}, {
|
|
1073
|
-
toString: () => containing ? `array(${printValue(
|
|
1075
|
+
toString: () => containing ? `array([${containing.map(v => printValue(v)).join(', ')}])` : 'array',
|
|
1074
1076
|
getDiff: actual => {
|
|
1075
1077
|
if (containing) {
|
|
1076
1078
|
return {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/expectation/expectation.ts","../src/matchers/matcher.ts","../src/print.ts","../src/errors/unexpected-access.ts","../src/errors/diff.ts","../src/errors/unexpected-call.ts","../src/mock/options.ts","../src/expectation/repository/return-value.ts","../src/expectation/repository/flexible-repository.ts","../src/expectation/strong-expectation.ts","../src/errors/api.ts","../src/when/expectation-builder.ts","../src/matchers/deep-equals.ts","../src/mock/defaults.ts","../src/mock/map.ts","../src/proxy.ts","../src/mock/stub.ts","../src/mock/mock.ts","../src/return/invocation-count.ts","../src/return/returns.ts","../src/when/when.ts","../src/verify/reset.ts","../src/errors/verify.ts","../src/verify/verify.ts","../src/matchers/is.ts","../src/matchers/is-any.ts","../src/matchers/is-array.ts","../src/matchers/is-number.ts","../src/matchers/is-plain-object.ts","../src/matchers/contains-object.ts","../src/matchers/is-string.ts","../src/matchers/will-capture.ts","../src/matchers/it.ts"],"sourcesContent":["import type { Matcher } from '../matchers/matcher';\nimport type { Property } from '../proxy';\nimport type { ReturnValue } from './repository/return-value';\n\n/**\n * Compare received arguments against matchers.\n */\nexport interface Expectation {\n property: Property;\n\n /**\n * `undefined` means this is a property expectation.\n * `[]` means this is a function call with no arguments.\n */\n args: Matcher[] | undefined;\n\n returnValue: ReturnValue;\n\n min: number;\n\n max: number;\n\n /**\n * How many times should this expectation match?\n */\n setInvocationCount: (min: number, max: number) => void;\n\n matches: (args: unknown[] | undefined) => boolean;\n\n toString: () => string;\n}\n\n/**\n * Special symbol denoting the call of a function.\n */\nexport const ApplyProp = Symbol('apply');\n","export const MATCHER_SYMBOL = Symbol('matcher');\n\nexport type MatcherDiffer = (actual: any) => { actual: any; expected: any };\n\nexport type MatcherOptions = {\n /**\n * Will be called when printing the diff between an expectation and the\n * (mismatching) received arguments.\n *\n * With this function you can pretty print the `actual` and `expected` values\n * according to your matcher's logic.\n *\n * @param actual The actual value received by this matcher, same as the one\n * in `matches`.\n *\n * @example\n * const neverMatcher = It.matches(() => false, {\n * getDiff: (actual) => ({ actual, expected: 'never' })\n * });\n *\n * when(() => fn(neverMatcher)).thenReturn(42);\n *\n * fn(42);\n * // - Expected\n * // + Received\n * //\n * // - 'never'\n * // + 42\n */\n getDiff: MatcherDiffer;\n\n /**\n * Will be called when printing arguments for an unexpected or unmet expectation.\n *\n * @example\n * const neverMatcher = It.matches(() => false, {\n * toString: () => 'never'\n * });\n * when(() => fn(neverMatcher)).thenReturn(42);\n *\n * fn(42);\n * // Unmet expectations:\n * // when(() => fn(never)).thenReturn(42)\n */\n toString: () => string;\n};\n\n/**\n * You MUST use {@link It.matches} to create this branded type.\n */\nexport interface Matcher extends MatcherOptions {\n [MATCHER_SYMBOL]: boolean;\n\n /**\n * Will be called with the received value and should return whether it matches\n * the expectation.\n */\n matches: (actual: any) => boolean;\n}\n\n/**\n * This takes the shape of T to satisfy call sites, but strong-mock will only\n * care about the matcher type.\n */\nexport type TypeMatcher<T> = T & Matcher;\n\n/**\n * Used to test if an expectation is an argument is a custom matcher.\n */\nexport function isMatcher(f: unknown): f is Matcher {\n return !!(f && (<Matcher>f)[MATCHER_SYMBOL]);\n}\n\nexport const getMatcherDiffs = (\n matchers: Matcher[],\n args: unknown[]\n): { actual: unknown[]; expected: unknown[] } => {\n const matcherDiffs = matchers.map((matcher, i) => matcher.getDiff(args[i]));\n const actual = matcherDiffs.map((d) => d.actual);\n const expected = matcherDiffs.map((d) => d.expected);\n\n return { actual, expected };\n};\n\n/**\n * Create a custom matcher.\n *\n * @param predicate Will receive the actual value and return whether it matches the expectation.\n * @param options\n * @param options.toString An optional function that should return a string that will be\n * used when the matcher needs to be printed in an error message. By default,\n * it stringifies `predicate`.\n * @param options.getDiff An optional function that will be called when printing the\n * diff for a failed expectation. It will only be called if there's a mismatch\n * between the expected and received values i.e. `predicate(actual)` fails.\n * By default, the `toString` method will be used to format the expected value,\n * while the received value will be returned as-is.\n *\n * @example\n * // Create a matcher for positive numbers.\n * const fn = mock<(x: number) => number>();\n * when(() => fn(It.matches(x => x >= 0))).thenReturn(42);\n *\n * fn(2) === 42\n * fn(-1) // throws\n */\nexport const matches = <T>(\n predicate: (actual: T) => boolean,\n options?: Partial<MatcherOptions>\n): TypeMatcher<T> => {\n // We can't use destructuring with default values because `options` is optional,\n // so it needs a default value of `{}`, which will come with a native `toString`.\n const toString =\n options?.toString ?? (() => `Matcher(${predicate.toString()})`);\n const getDiff =\n options?.getDiff ??\n ((actual) => ({\n actual,\n expected: toString(),\n }));\n\n const matcher: Matcher = {\n [MATCHER_SYMBOL]: true,\n matches: (actual: T) => predicate(actual),\n toString,\n getDiff: (actual) => {\n if (predicate(actual)) {\n return {\n actual,\n expected: actual,\n };\n }\n\n return getDiff(actual);\n },\n };\n\n return matcher as any;\n};\n","import { EXPECTED_COLOR, RECEIVED_COLOR, stringify } from 'jest-matcher-utils';\nimport type { Expectation } from './expectation/expectation';\nimport { ApplyProp } from './expectation/expectation';\nimport type { ReturnValue } from './expectation/repository/return-value';\nimport { isMatcher } from './matchers/matcher';\nimport type { Property } from './proxy';\n\nexport const printProperty = (property: Property) => {\n if (property === ApplyProp) {\n return '';\n }\n\n if (typeof property === 'symbol') {\n return `[${property.toString()}]`;\n }\n\n return `.${property}`;\n};\n\nexport const printValue = (arg: unknown): string => {\n // Call toString on matchers directly to avoid wrapping strings returned by them in quotes.\n if (isMatcher(arg)) {\n return arg.toString();\n }\n\n return stringify(arg);\n};\n\nconst printArgs = (args: any[]) =>\n args.map((arg) => printValue(arg)).join(', ');\n\nexport const printCall = (property: Property, args?: any[]) => {\n const prettyProperty = printProperty(property);\n\n if (args) {\n const prettyArgs = printArgs(args);\n\n return `mock${RECEIVED_COLOR(`${prettyProperty}(${prettyArgs})`)}`;\n }\n\n return `mock${RECEIVED_COLOR(`${prettyProperty}`)}`;\n};\n\nexport const printReturns = (\n { isError, isPromise, value }: ReturnValue,\n min: number,\n max: number\n) => {\n let thenPrefix = '';\n\n if (isPromise) {\n if (isError) {\n thenPrefix += 'thenReject';\n } else {\n thenPrefix += 'thenResolve';\n }\n } else if (isError) {\n thenPrefix += 'thenThrow';\n } else {\n thenPrefix += 'thenReturn';\n }\n\n return `.${thenPrefix}(${RECEIVED_COLOR(\n printValue(value)\n )}).between(${min}, ${max})`;\n};\n\nexport const printWhen = (property: Property, args: any[] | undefined) => {\n const prettyProperty = printProperty(property);\n\n if (args) {\n return `when(() => mock${EXPECTED_COLOR(\n `${prettyProperty}(${printArgs(args)})`\n )})`;\n }\n\n return `when(() => mock${EXPECTED_COLOR(`${printProperty(property)}`)})`;\n};\n\nexport const printExpectation = (\n property: Property,\n args: any[] | undefined,\n returnValue: ReturnValue,\n min: number,\n max: number\n) => `${printWhen(property, args)}${printReturns(returnValue, min, max)}`;\n\nexport const printRemainingExpectations = (expectations: Expectation[]) =>\n expectations.length\n ? `Remaining unmet expectations:\n - ${expectations.map((e) => e.toString()).join('\\n - ')}`\n : 'There are no remaining unmet expectations.';\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport { printCall, printRemainingExpectations } from '../print';\nimport type { Property } from '../proxy';\n\nexport class UnexpectedAccess extends Error {\n constructor(property: Property, expectations: Expectation[]) {\n super(\n DIM_COLOR(`Didn't expect ${printCall(property)} to be accessed.\n\nIf you expect this property to be accessed then please\nset an expectation for it.\n\n${printRemainingExpectations(expectations)}`)\n );\n }\n}\n","import { diff as printDiff } from 'jest-diff';\nimport { EXPECTED_COLOR, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport stripAnsi from 'strip-ansi';\nimport type { Expectation } from '../expectation/expectation';\nimport { getMatcherDiffs } from '../matchers/matcher';\n\nexport const printArgsDiff = (\n expected: unknown[],\n actual: unknown[]\n): string => {\n const diff = printDiff(expected, actual, { omitAnnotationLines: true });\n\n /* istanbul ignore next this is not expected in practice */\n if (!diff) {\n return '';\n }\n\n const ansilessDiffLines = stripAnsi(diff).split('\\n');\n let relevantDiffLines: string[];\n\n // Strip Array [ ... ] surroundings.\n if (!expected.length) {\n // - Array []\n // + Array [\n // ...\n // ]\n relevantDiffLines = ansilessDiffLines.slice(2, -1);\n } else if (!actual.length) {\n // - Array [\n // ...\n // ]\n // + Array []\n relevantDiffLines = ansilessDiffLines.slice(1, -2);\n } else {\n // Array [\n // ...\n // ]\n relevantDiffLines = ansilessDiffLines.slice(1, -1);\n }\n\n // Strip the trailing comma.\n const lastLine = relevantDiffLines[relevantDiffLines.length - 1].slice(0, -1);\n\n const coloredDiffLines = [...relevantDiffLines.slice(0, -1), lastLine].map(\n (line) => {\n const first = line.charAt(0);\n\n switch (first) {\n case '-':\n return EXPECTED_COLOR(line);\n case '+':\n return RECEIVED_COLOR(line);\n default:\n return line;\n }\n }\n );\n\n return coloredDiffLines.join('\\n');\n};\n\nexport const printExpectationDiff = (e: Expectation, args: unknown[]) => {\n if (!e.args?.length) {\n return '';\n }\n\n const { actual, expected } = getMatcherDiffs(e.args, args);\n\n return printArgsDiff(expected, actual);\n};\n\nexport const printDiffForAllExpectations = (\n expectations: Expectation[],\n actual: unknown[]\n) =>\n expectations\n .map((e) => {\n const diff = printExpectationDiff(e, actual);\n\n if (diff) {\n return `${e.toString()}\n${EXPECTED_COLOR('- Expected')}\n${RECEIVED_COLOR('+ Received')}\n\n${diff}`;\n }\n\n return undefined;\n })\n .filter((x) => x)\n .join('\\n\\n');\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport { getMatcherDiffs } from '../matchers/matcher';\nimport { printCall } from '../print';\nimport type { Property } from '../proxy';\nimport { printDiffForAllExpectations } from './diff';\n\ntype MatcherResult = {\n expected: unknown;\n actual: unknown;\n};\n\n// This is taken from jest.\ninterface MatcherError {\n matcherResult?: MatcherResult;\n}\n\nexport class UnexpectedCall extends Error implements MatcherError {\n public matcherResult?: MatcherResult;\n\n constructor(\n property: Property,\n args: unknown[],\n expectations: Expectation[]\n ) {\n const header = `Didn't expect ${printCall(property, args)} to be called.`;\n\n const propertyExpectations = expectations.filter(\n (e) => e.property === property\n );\n\n if (propertyExpectations.length) {\n super(\n DIM_COLOR(`${header}\n\nRemaining expectations:\n${printDiffForAllExpectations(propertyExpectations, args)}`)\n );\n\n // If we have a single expectation we can attach the actual/expected args\n // to the error instance, so that an IDE may show its own diff for them.\n if (\n propertyExpectations.length === 1 &&\n propertyExpectations[0].args?.length\n ) {\n const { actual, expected } = getMatcherDiffs(\n propertyExpectations[0].args,\n args\n );\n this.matcherResult = {\n actual,\n expected,\n };\n }\n } else {\n super(\n DIM_COLOR(`${header}\n \nNo remaining expectations.`)\n );\n }\n }\n}\n","import type { Matcher } from '../matchers/matcher';\n\nexport type ConcreteMatcher = <T>(expected: T) => Matcher;\n\nexport enum UnexpectedProperty {\n /**\n * Throw an error immediately.\n *\n * @example\n * // Will throw \"Didn't expect foo to be accessed\".\n * const { foo } = service;\n *\n * // Will throw \"Didn't expect foo to be accessed\",\n * // without printing the arguments.\n * foo(42);\n */\n THROW,\n\n /**\n * Return a function that will throw if called. This can be useful if your\n * code destructures a function but never calls it.\n *\n * It will also improve error messages for unexpected calls because arguments\n * will be captured instead of throwing immediately on the property access.\n *\n * The function will be returned even if the property is not supposed to be a\n * function. This could cause weird behavior at runtime, when your code expects\n * e.g. a number and gets a function instead.\n *\n * @example\n * // This will NOT throw.\n * const { foo } = service;\n *\n * // This will NOT throw, and might produce unexpected results.\n * foo > 0\n *\n * // Will throw \"Didn't expect foo(42) to be called\".\n * foo(42);\n */\n CALL_THROW,\n}\n\nexport interface MockOptions {\n /**\n * Controls what should be returned for a property with no expectations.\n *\n * A property with no expectations is a property that has no `when`\n * expectations set on it. It can also be a property that ran out of `when`\n * expectations.\n *\n * The default is to return a function that will throw when called.\n *\n * @example\n * const foo = mock<{ bar: () => number }>();\n * foo.bar() // unexpected property access\n *\n * @example\n * const foo = mock<{ bar: () => number }>();\n * when(() => foo.bar()).thenReturn(42);\n * foo.bar() === 42\n * foo.bar() // unexpected property access\n */\n unexpectedProperty?: UnexpectedProperty;\n\n /**\n * If `true`, the number of received arguments in a function/method call has to\n * match the number of arguments set in the expectation.\n *\n * If `false`, extra parameters are considered optional and checked by the\n * TypeScript compiler instead.\n *\n * You may want to set this to `true` if you're not using TypeScript,\n * or if you want to be extra strict.\n *\n * @example\n * const fn = mock<(value?: number) => number>({ exactParams: true });\n * when(() => fn()).thenReturn(42);\n *\n * fn(100) // throws with exactParams, returns 42 without\n */\n exactParams?: boolean;\n\n /**\n * The matcher that will be used when one isn't specified explicitly.\n *\n * The most common use case is replacing the default {@link It.deepEquals}\n * matcher with {@link It.is}, but you can also use {@link It.matches} to\n * create a custom matcher.\n *\n * @param expected The concrete expected value received from the\n * {@link when} expectation.\n *\n * @example\n * const fn = mock<(value: number[]) => boolean>({\n * concreteMatcher: It.is\n * });\n *\n * const expected = [1, 2, 3];\n * when(() => fn(expected).thenReturn(true);\n *\n * fn([1, 2, 3]); // throws because different array instance\n * fn(expected); // OK\n */\n concreteMatcher?: ConcreteMatcher;\n}\n","export type ReturnValue = {\n value: any;\n isPromise?: boolean;\n isError?: boolean;\n};\n\n/**\n * Unbox the expectation's return value.\n *\n * If the value is an error then throw it.\n *\n * If the value is a promise then resolve/reject it.\n */\nexport const unboxReturnValue = ({\n isError,\n isPromise,\n value,\n}: ReturnValue) => {\n if (isError) {\n if (value instanceof Error) {\n if (isPromise) {\n return Promise.reject(value);\n }\n throw value;\n }\n\n if (isPromise) {\n return Promise.reject(new Error(value));\n }\n\n throw new Error(value);\n }\n\n if (isPromise) {\n return Promise.resolve(value);\n }\n\n return value;\n};\n","import { UnexpectedAccess } from '../../errors/unexpected-access';\nimport { UnexpectedCall } from '../../errors/unexpected-call';\nimport { MATCHER_SYMBOL } from '../../matchers/matcher';\nimport { UnexpectedProperty } from '../../mock/options';\nimport type { Property } from '../../proxy';\nimport type { Expectation } from '../expectation';\nimport { ApplyProp } from '../expectation';\nimport type { CallMap, ExpectationRepository } from './expectation-repository';\nimport { unboxReturnValue } from './return-value';\n\ntype CountableExpectation = {\n expectation: Expectation;\n matchCount: number;\n};\n\n/**\n * An expectation repository with a configurable behavior for\n * unexpected property access.\n */\nexport class FlexibleRepository implements ExpectationRepository {\n constructor(\n private unexpectedProperty: UnexpectedProperty = UnexpectedProperty.THROW\n ) {}\n\n protected readonly expectations = new Map<Property, CountableExpectation[]>();\n\n private readonly expectedCallStats: CallMap = new Map();\n\n private readonly unexpectedCallStats: CallMap = new Map();\n\n add(expectation: Expectation): void {\n const { property } = expectation;\n\n const expectations = this.expectations.get(property) || [];\n\n this.expectations.set(property, [\n ...expectations,\n {\n expectation,\n matchCount: 0,\n },\n ]);\n }\n\n clear(): void {\n this.expectations.clear();\n this.expectedCallStats.clear();\n this.unexpectedCallStats.clear();\n }\n\n apply = (args: unknown[]): unknown => this.get(ApplyProp)(...args);\n\n // TODO: this returns any, but the interface returns unknown\n // unknown causes errors in apply tests, and any causes bugs in bootstrapped SM\n get(property: Property): any {\n const expectations = this.expectations.get(property);\n\n if (expectations && expectations.length) {\n return this.handlePropertyWithMatchingExpectations(\n property,\n expectations\n );\n }\n\n return this.handlePropertyWithNoExpectations(property);\n }\n\n private handlePropertyWithMatchingExpectations = (\n property: Property,\n expectations: CountableExpectation[]\n ) => {\n // Avoid recording call stats for function calls, since the property is an\n // internal detail.\n if (property !== ApplyProp) {\n // An unexpected call could still happen later, if the property returns a\n // function that will not match the given args.\n this.recordExpected(property, undefined);\n }\n\n const propertyExpectation = expectations.find((e) =>\n e.expectation.matches(undefined)\n );\n\n if (propertyExpectation) {\n this.countAndConsume(propertyExpectation);\n\n return unboxReturnValue(propertyExpectation.expectation.returnValue);\n }\n\n return (...args: any[]) => {\n const callExpectation = expectations.find((e) =>\n e.expectation.matches(args)\n );\n\n if (callExpectation) {\n this.recordExpected(property, args);\n this.countAndConsume(callExpectation);\n\n return unboxReturnValue(callExpectation.expectation.returnValue);\n }\n\n return this.getValueForUnexpectedCall(property, args);\n };\n };\n\n private handlePropertyWithNoExpectations = (property: Property) => {\n switch (property) {\n case 'toString':\n return () => 'mock';\n case '@@toStringTag':\n case Symbol.toStringTag:\n case 'name':\n return 'mock';\n\n // Promise.resolve() tries to see if it's a \"thenable\".\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables\n case 'then':\n return undefined;\n\n // pretty-format\n case '$$typeof':\n case 'constructor':\n case '@@__IMMUTABLE_ITERABLE__@@':\n case '@@__IMMUTABLE_RECORD__@@':\n return null;\n\n case MATCHER_SYMBOL:\n return false;\n\n case ApplyProp:\n return (...args: any[]) =>\n this.getValueForUnexpectedCall(property, args);\n default:\n return this.getValueForUnexpectedAccess(property);\n }\n };\n\n getAllProperties(): Property[] {\n return Array.from(this.expectations.keys());\n }\n\n getCallStats() {\n return {\n expected: this.expectedCallStats,\n unexpected: this.unexpectedCallStats,\n };\n }\n\n getUnmet(): Expectation[] {\n return ([] as Expectation[]).concat(\n ...Array.from(this.expectations.values()).map((expectations) =>\n expectations\n .filter((e) => e.expectation.min > e.matchCount)\n .map((e) => e.expectation)\n )\n );\n }\n\n private recordExpected(property: Property, args: any[] | undefined) {\n const calls = this.expectedCallStats.get(property) || [];\n\n this.expectedCallStats.set(property, [...calls, { arguments: args }]);\n }\n\n private recordUnexpected(property: Property, args: any[] | undefined) {\n const calls = this.unexpectedCallStats.get(property) || [];\n\n this.unexpectedCallStats.set(property, [...calls, { arguments: args }]);\n }\n\n private countAndConsume(expectation: CountableExpectation) {\n // eslint-disable-next-line no-param-reassign\n expectation.matchCount++;\n\n this.consumeExpectation(expectation);\n }\n\n private consumeExpectation(expectation: CountableExpectation): void {\n const { property, max } = expectation.expectation;\n\n const expectations = this.expectations.get(property)!;\n\n if (expectation.matchCount === max) {\n this.expectations.set(\n property,\n expectations.filter((e) => e !== expectation)\n );\n }\n }\n\n private getValueForUnexpectedCall(property: Property, args: any[]): never {\n this.recordUnexpected(property, args);\n\n throw new UnexpectedCall(property, args, this.getUnmet());\n }\n\n private getValueForUnexpectedAccess(property: Property): unknown {\n if (this.unexpectedProperty === UnexpectedProperty.THROW) {\n this.recordUnexpected(property, undefined);\n\n throw new UnexpectedAccess(property, this.getUnmet());\n }\n\n return (...args: unknown[]) => {\n this.recordUnexpected(property, args);\n\n throw new UnexpectedCall(property, args, this.getUnmet());\n };\n }\n}\n","import type { Matcher } from '../matchers/matcher';\nimport { printExpectation } from '../print';\nimport type { Property } from '../proxy';\nimport type { Expectation } from './expectation';\nimport type { ReturnValue } from './repository/return-value';\n\n/**\n * Matches a call with more parameters than expected because it is assumed the\n * compiler will check that those parameters are optional.\n *\n * @example\n * new StrongExpectation(\n * 'bar',\n * deepEquals([1, 2, 3]),\n * 23\n * ).matches('bar', [1, 2, 3]) === true;\n */\nexport class StrongExpectation implements Expectation {\n private matched = 0;\n\n public min = 1;\n\n public max = 1;\n\n constructor(\n public property: Property,\n public args: Matcher[] | undefined,\n public returnValue: ReturnValue,\n private exactParams: boolean = false\n ) {}\n\n setInvocationCount(min: number, max = 1) {\n this.min = min;\n this.max = max;\n }\n\n matches(args: any[] | undefined): boolean {\n if (!this.matchesArgs(args)) {\n return false;\n }\n\n this.matched++;\n\n return this.max === 0 || this.matched <= this.max;\n }\n\n isUnmet(): boolean {\n return this.matched < this.min;\n }\n\n private matchesArgs(received: any[] | undefined) {\n if (this.args === undefined) {\n return !received;\n }\n\n if (!received) {\n return false;\n }\n\n if (this.exactParams) {\n if (this.args.length !== received.length) {\n return false;\n }\n }\n\n return this.args.every((arg, i) => arg.matches(received[i]));\n }\n\n toString() {\n return printExpectation(\n this.property,\n this.args,\n this.returnValue,\n this.min,\n this.max\n );\n }\n}\n","import { printProperty, printWhen } from '../print';\nimport type { Property } from '../proxy';\n\nexport class UnfinishedExpectation extends Error {\n constructor(property: Property, args: any[] | undefined) {\n super(`There is an unfinished pending expectation:\n\n${printWhen(property, args)}\n\nPlease finish it by setting a return value even if the value\nis undefined.`);\n }\n}\n\nexport class MissingWhen extends Error {\n constructor() {\n super(`You tried setting a return value without an expectation.\n\nEvery call to set a return value must be preceded by an expectation.`);\n }\n}\n\nexport class NotAMock extends Error {\n constructor() {\n super(`We couldn't find the mock.\n\nMake sure you're passing in an actual mock.`);\n }\n}\n\nexport class NestedWhen extends Error {\n constructor(parentProp: Property, childProp: Property) {\n const snippet = `\nconst parentMock = mock<T1>();\nconst childMock = mock<T2>();\n\nwhen(() => childMock${printProperty(childProp)}).thenReturn(...);\nwhen(() => parentMock${printProperty(parentProp)}).thenReturn(childMock)\n`;\n\n super(\n `Setting an expectation on a nested property is not supported.\n\nYou can return an object directly when the first property is accessed,\nor you can even return a separate mock:\n${snippet}`\n );\n }\n}\n","import { MissingWhen, UnfinishedExpectation } from '../errors/api';\nimport type { Expectation } from '../expectation/expectation';\nimport type { ReturnValue } from '../expectation/repository/return-value';\nimport type { ConcreteMatcher } from '../mock/options';\nimport type { Property } from '../proxy';\n\n/**\n * An expectation has to be built incrementally, starting first with the property\n * being accessed inside {@link createStub}, then any arguments passed to it, and ending\n * it with the returned value from {@link createReturns}.\n */\nexport interface ExpectationBuilder {\n setProperty: (prop: Property) => void;\n\n setArgs: (args: unknown[] | undefined) => void;\n\n finish: (returnValue: ReturnValue) => Expectation;\n}\n\nexport type ExpectationFactory = (\n property: Property,\n args: any[] | undefined,\n returnValue: ReturnValue,\n concreteMatcher: ConcreteMatcher,\n exactParams: boolean\n) => Expectation;\n\nexport class ExpectationBuilderWithFactory implements ExpectationBuilder {\n private args: unknown[] | undefined;\n\n private property: Property | undefined;\n\n constructor(\n private createExpectation: ExpectationFactory,\n private concreteMatcher: ConcreteMatcher,\n private exactParams: boolean\n ) {}\n\n setProperty(value: Property) {\n if (this.property) {\n throw new UnfinishedExpectation(this.property, this.args);\n }\n\n this.property = value;\n }\n\n setArgs(value: unknown[] | undefined) {\n this.args = value;\n }\n\n finish(returnValue: ReturnValue): Expectation {\n if (!this.property) {\n throw new MissingWhen();\n }\n\n const expectation = this.createExpectation(\n this.property,\n this.args,\n returnValue,\n this.concreteMatcher,\n this.exactParams\n );\n\n this.property = undefined;\n this.args = undefined;\n\n return expectation;\n }\n}\n","import { isEqual, isObjectLike, isUndefined, omitBy } from 'lodash';\nimport { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\nconst removeUndefined = (object: any): any => {\n if (Array.isArray(object)) {\n return object.map((x) => removeUndefined(x));\n }\n\n if (!isObjectLike(object)) {\n return object;\n }\n\n return omitBy(object, isUndefined);\n};\n\n/**\n * Compare values using deep equality.\n *\n * @param expected\n * @param strict By default, this matcher will treat a missing key in an object\n * and a key with the value `undefined` as not equal. It will also consider\n * non `Object` instances with different constructors as not equal. Setting\n * this to `false` will consider the objects in both cases as equal.\n *\n * @see {@link It.containsObject} or {@link It.isArray} if you want to nest matchers.\n * @see {@link It.is} if you want to use strict equality.\n */\nexport const deepEquals = <T>(\n expected: T,\n {\n strict = true,\n }: {\n strict?: boolean;\n } = {}\n): TypeMatcher<T> =>\n matches(\n (actual) => {\n if (strict) {\n return isEqual(actual, expected);\n }\n\n return isEqual(removeUndefined(actual), removeUndefined(expected));\n },\n {\n toString: () => printValue(expected),\n getDiff: (actual) => ({\n actual,\n expected,\n }),\n }\n );\n","import { deepEquals } from '../matchers/deep-equals';\nimport type { MockOptions } from './options';\nimport { UnexpectedProperty } from './options';\n\nexport type StrongMockDefaults = Required<MockOptions>;\n\nconst defaults: StrongMockDefaults = {\n concreteMatcher: deepEquals,\n unexpectedProperty: UnexpectedProperty.CALL_THROW,\n exactParams: false,\n};\n\nexport let currentDefaults: StrongMockDefaults = defaults;\n\n/**\n * Override strong-mock's defaults.\n *\n * @param newDefaults These will be applied to the library defaults. Multiple\n * calls don't stack e.g. calling this with `{}` will clear any previously\n * applied defaults.\n */\nexport const setDefaults = (newDefaults: MockOptions): void => {\n currentDefaults = {\n ...defaults,\n ...newDefaults,\n };\n};\n","import { NotAMock } from '../errors/api';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport type { StrongMockDefaults } from './defaults';\nimport type { Mock } from './mock';\n\n/**\n * Since `when` doesn't receive the mock subject (because we can't make it\n * consistently return it from `mock()`, `mock.foo` and `mock.bar()`) we need\n * to store a global state for the currently active mock.\n *\n * We also want to throw in the following case:\n *\n * ```\n * when(() => mock()) // forgot returns here\n * when(() => mock()) // should throw\n * ```\n *\n * For that reason we can't just store the currently active mock, but also\n * whether we finished the expectation or not.\n */\nlet activeMock: Mock<any> | undefined;\n\nexport const setActiveMock = (mock: Mock<any>) => {\n activeMock = mock;\n};\n\nexport const clearActiveMock = () => {\n activeMock = undefined;\n};\n\nexport const getActiveMock = (): Mock<any> => activeMock;\n\ntype MockState = {\n repository: ExpectationRepository;\n builder: ExpectationBuilder;\n options: StrongMockDefaults;\n};\n\n/**\n * Store a global map of all mocks created and their state.\n *\n * This is needed because we can't reliably pass the state between `when`\n * and `thenReturn`.\n */\nconst mockMap = new Map<Mock<any>, MockState>();\n\nexport const getMockState = (mock: Mock<any>): MockState => {\n if (mockMap.has(mock)) {\n return mockMap.get(mock)!;\n }\n\n throw new NotAMock();\n};\n\nexport const setMockState = (mock: Mock<any>, state: MockState): void => {\n mockMap.set(mock, state);\n};\n\nexport const getAllMocks = (): [Mock<any>, MockState][] =>\n Array.from(mockMap.entries());\n","import type { Mock } from './mock/mock';\n\nexport type Property = string | symbol;\n\nexport interface ProxyTraps {\n /**\n * Called when accessing any property on an object, except for\n * `.call`, `.apply` and `.bind`.\n */\n property: (property: Property) => unknown;\n\n /**\n * Called when calling a function.\n *\n * @example\n * ```\n * fn(...args)\n * ```\n *\n * @example\n * ```\n * fn.call(this, ...args)\n * ```\n *\n * @example\n * ```\n * fn.apply(this, [...args])\n * ```\n *\n * @example\n * ```\n * Reflect.apply(fn, this, [...args])\n * ```\n */\n apply: (args: unknown[]) => unknown;\n\n /**\n * Called when getting the proxy's own enumerable keys.\n *\n * @example\n * ```\n * Object.keys(proxy);\n * ```\n *\n * @example\n * ```\n * const foo = { ...proxy };\n * ```\n */\n ownKeys: () => Property[];\n}\n\nexport const createProxy = <T>(traps: ProxyTraps): Mock<T> =>\n // The Proxy target MUST be a function, otherwise we can't use the `apply` trap:\n // https://262.ecma-international.org/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist\n // eslint-disable-next-line no-empty-function,@typescript-eslint/no-empty-function\n new Proxy(/* istanbul ignore next */ () => {}, {\n get: (target, prop: string | symbol) => {\n if (prop === 'bind') {\n return (thisArg: unknown, ...args: unknown[]) =>\n (...moreArgs: unknown[]) =>\n traps.apply([...args, ...moreArgs]);\n }\n\n if (prop === 'apply') {\n return (thisArg: unknown, args: unknown[] | undefined) =>\n traps.apply(args || []);\n }\n\n if (prop === 'call') {\n return (thisArg: unknown, ...args: unknown[]) => traps.apply(args);\n }\n\n return traps.property(prop);\n },\n\n apply: (target, thisArg: unknown, args: unknown[]) => traps.apply(args),\n\n ownKeys: () => traps.ownKeys(),\n\n getOwnPropertyDescriptor(\n target: () => void,\n prop: string | symbol\n ): PropertyDescriptor | undefined {\n const keys = traps.ownKeys();\n\n if (keys.includes(prop)) {\n return {\n configurable: true,\n enumerable: true,\n };\n }\n\n return undefined;\n },\n }) as unknown as Mock<T>;\n","import { NestedWhen } from '../errors/api';\nimport { ApplyProp } from '../expectation/expectation';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { Property } from '../proxy';\nimport { createProxy } from '../proxy';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport { setActiveMock } from './map';\nimport type { Mock } from './mock';\nimport { Mode } from './mock';\n\nexport const createStub = <T>(\n repo: ExpectationRepository,\n builder: ExpectationBuilder,\n getCurrentMode: () => Mode\n): Mock<T> => {\n const stub = createProxy<T>({\n property: (property) => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.get(property);\n }\n\n setActiveMock(stub);\n\n builder.setProperty(property);\n\n return createProxy({\n property: (childProp: Property) => {\n throw new NestedWhen(property, childProp);\n },\n apply: (args: unknown[]) => {\n builder.setArgs(args);\n },\n ownKeys: () => {\n throw new Error('Spreading during an expectation is not supported.');\n },\n });\n },\n apply: (args: unknown[]) => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.apply(args);\n }\n\n setActiveMock(stub);\n\n builder.setProperty(ApplyProp);\n builder.setArgs(args);\n\n return undefined;\n },\n ownKeys: () => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.getAllProperties();\n }\n\n throw new Error('Spreading during an expectation is not supported.');\n },\n });\n\n return stub;\n};\n","import { FlexibleRepository } from '../expectation/repository/flexible-repository';\nimport { StrongExpectation } from '../expectation/strong-expectation';\nimport { isMatcher } from '../matchers/matcher';\nimport type { ExpectationFactory } from '../when/expectation-builder';\nimport { ExpectationBuilderWithFactory } from '../when/expectation-builder';\nimport type { StrongMockDefaults } from './defaults';\nimport { currentDefaults } from './defaults';\nimport { setMockState } from './map';\nimport type { MockOptions } from './options';\nimport { createStub } from './stub';\n\nexport type Mock<T> = T;\n\nconst strongExpectationFactory: ExpectationFactory = (\n property,\n args,\n returnValue,\n concreteMatcher,\n exactParams\n) =>\n new StrongExpectation(\n property,\n // Wrap every non-matcher in the default matcher.\n args?.map((arg) => (isMatcher(arg) ? arg : concreteMatcher(arg))),\n returnValue,\n exactParams\n );\n\nexport enum Mode {\n EXPECT,\n CALL,\n}\n\nlet currentMode: Mode = Mode.CALL;\n\nexport const setMode = (mode: Mode) => {\n currentMode = mode;\n};\nconst getMode = () => currentMode;\n\n/**\n * Create a type safe mock.\n *\n * @see {@link when} Set expectations on the mock using `when`.\n *\n * @param options Configure the options for this specific mock, overriding any\n * defaults that were set with {@link setDefaults}.\n * @param options.unexpectedProperty Controls what happens when an unexpected\n * property is accessed.\n * @param options.concreteMatcher The matcher that will be used when one isn't\n * specified explicitly.\n * @param options.exactParams Controls whether the number of received arguments\n * has to match the expectation.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * fn() === 23;\n */\nexport const mock = <T>({\n unexpectedProperty,\n concreteMatcher,\n exactParams,\n}: MockOptions = {}): Mock<T> => {\n const options: StrongMockDefaults = {\n unexpectedProperty:\n unexpectedProperty ?? currentDefaults.unexpectedProperty,\n concreteMatcher: concreteMatcher ?? currentDefaults.concreteMatcher,\n exactParams: exactParams ?? currentDefaults.exactParams,\n };\n\n const repository = new FlexibleRepository(options.unexpectedProperty);\n\n const builder = new ExpectationBuilderWithFactory(\n strongExpectationFactory,\n options.concreteMatcher,\n options.exactParams\n );\n\n const stub = createStub<T>(repository, builder, getMode);\n\n setMockState(stub, {\n repository,\n builder,\n options,\n });\n\n return stub;\n};\n","import type { Expectation } from '../expectation/expectation';\n\nexport interface InvocationCount {\n /**\n * Expect a call to be made at least `min` times and at most `max` times.\n */\n between: (min: number, max: number) => void;\n\n /**\n * Expect a call to be made exactly `exact` times.\n *\n * Shortcut for `between(exact, exact)`.\n */\n times: (exact: number) => void;\n\n /**\n * Expect a call to be made any number of times, including never.\n *\n * Shortcut for `between(0, Infinity)`.\n */\n anyTimes: () => void;\n\n /**\n * Expect a call to be made at least `min` times.\n *\n * Shortcut for `between(min, Infinity)`.\n */\n atLeast: (min: number) => void;\n\n /**\n * Expect a call to be made at most `max` times.\n *\n * Shortcut for `between(0, max)`.\n */\n atMost: (max: number) => void;\n\n /**\n * Expect a call to be made exactly once.\n *\n * Shortcut for `times(1)`.\n */\n once: () => void;\n\n /**\n * Expect a call to be made exactly twice.\n *\n * Shortcut for `times(2)`.\n */\n twice: () => void;\n}\n\nexport const createInvocationCount = (\n expectation: Expectation\n): InvocationCount => ({\n between(min: number, max: number) {\n expectation.setInvocationCount(min, max);\n },\n\n /* istanbul ignore next */\n times(exact: number) {\n expectation.setInvocationCount(exact, exact);\n },\n\n /* istanbul ignore next */\n anyTimes(): void {\n expectation.setInvocationCount(0, 0);\n },\n\n /* istanbul ignore next */\n atLeast(min: number) {\n expectation.setInvocationCount(min, Infinity);\n },\n\n /* istanbul ignore next */\n atMost(max: number) {\n expectation.setInvocationCount(0, max);\n },\n\n /* istanbul ignore next */\n once() {\n expectation.setInvocationCount(1, 1);\n },\n\n /* istanbul ignore next */\n twice() {\n expectation.setInvocationCount(2, 2);\n },\n /* eslint-enable no-param-reassign, no-multi-assign */\n});\n","import type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { ReturnValue } from '../expectation/repository/return-value';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport type { InvocationCount } from './invocation-count';\nimport { createInvocationCount } from './invocation-count';\n\nexport type PromiseStub<R, P> = {\n /**\n * Set the return value for the current call.\n *\n * @param value This needs to be of the same type as the value returned\n * by the call inside `when`.\n *\n * @example\n * when(() => fn()).thenReturn(Promise.resolve(23));\n *\n * @example\n * when(() => fn()).thenReturn(Promise.reject({ foo: 'bar' });\n */\n thenReturn: (value: P) => InvocationCount;\n\n /**\n * Set the return value for the current call.\n *\n * @param promiseValue This needs to be of the same type as the value inside\n * the promise returned by the `when` callback.\n *\n * @example\n * when(() => fn()).thenResolve('foo');\n */\n thenResolve: (promiseValue: R) => InvocationCount;\n\n /**\n * Make the current call reject with the given error.\n *\n * @param error An `Error` instance. You can pass just a message, and\n * it will be wrapped in an `Error` instance. If you want to reject with\n * a non error then use the {@link thenReturn} method.\n *\n * @example\n * when(() => fn()).thenReject(new Error('oops'));\n */\n thenReject: ((error: Error) => InvocationCount) &\n ((message: string) => InvocationCount) &\n (() => InvocationCount);\n};\n\nexport type NonPromiseStub<R> = {\n /**\n * Set the return value for the current call.\n *\n * @param returnValue This needs to be of the same type as the value returned\n * by the `when` callback.\n */\n thenReturn: (returnValue: R) => InvocationCount;\n\n /**\n * Make the current call throw the given error.\n *\n * @param error The error instance. If you want to throw a simple `Error`\n * you can pass just the message.\n */\n thenThrow: ((error: Error) => InvocationCount) &\n ((message: string) => InvocationCount) &\n (() => InvocationCount);\n};\n\nconst finishExpectation = (\n returnValue: ReturnValue,\n builder: ExpectationBuilder,\n repo: ExpectationRepository\n) => {\n const finishedExpectation = builder.finish(returnValue);\n\n repo.add(finishedExpectation);\n\n return createInvocationCount(finishedExpectation);\n};\n\nconst getError = (errorOrMessage: Error | string | undefined): Error => {\n if (typeof errorOrMessage === 'string') {\n return new Error(errorOrMessage);\n }\n\n if (errorOrMessage instanceof Error) {\n return errorOrMessage;\n }\n\n return new Error();\n};\n\nexport const createReturns = (\n builder: ExpectationBuilder,\n repository: ExpectationRepository\n) => ({\n thenReturn: (returnValue: any): InvocationCount =>\n finishExpectation(\n // This will handle both thenReturn(23) and thenReturn(Promise.resolve(3)).\n { value: returnValue, isError: false, isPromise: false },\n builder,\n repository\n ),\n thenThrow: (errorOrMessage?: Error | string): InvocationCount =>\n finishExpectation(\n { value: getError(errorOrMessage), isError: true, isPromise: false },\n builder,\n repository\n ),\n thenResolve: (promiseValue: any): InvocationCount =>\n finishExpectation(\n {\n value: promiseValue,\n isError: false,\n isPromise: true,\n },\n builder,\n repository\n ),\n\n thenReject: (errorOrMessage?: Error | string): InvocationCount =>\n finishExpectation(\n {\n value: getError(errorOrMessage),\n isError: true,\n isPromise: true,\n },\n builder,\n repository\n ),\n});\n","import { getActiveMock, getMockState } from '../mock/map';\nimport { Mode, setMode } from '../mock/mock';\nimport type { NonPromiseStub, PromiseStub } from '../return/returns';\nimport { createReturns } from '../return/returns';\n\ninterface When {\n <R>(expectation: () => Promise<R>): PromiseStub<R, Promise<R>>;\n <R>(expectation: () => R): NonPromiseStub<R>;\n}\n\n/**\n * Set an expectation on a mock.\n *\n * The expectation must be finished by setting a return value, even if the value\n * is `undefined`.\n *\n * If a call happens that was not expected then the mock will throw an error.\n * By default, the call is expected to only be made once. Use the invocation\n * count helpers to expect a call multiple times.\n *\n * @param expectation A callback to set the expectation on your mock. The\n * callback must return the value from the mock to properly infer types.\n *\n * @example\n * const fn = mock<() => void>();\n * when(() => fn()).thenReturn(undefined);\n *\n * @example\n * const fn = mock<() => number>();\n * when(() => fn()).thenReturn(42).atMost(3);\n *\n * @example\n * const fn = mock<(x: number) => Promise<number>();\n * when(() => fn(23)).thenResolve(42);\n */\nexport const when: When = <R>(expectation: () => R) => {\n setMode(Mode.EXPECT);\n expectation();\n setMode(Mode.CALL);\n\n const { builder, repository } = getMockState(getActiveMock());\n\n return createReturns(builder, repository);\n};\n","import { getAllMocks, getMockState } from '../mock/map';\nimport type { Mock } from '../mock/mock';\n\n/**\n * Remove any remaining expectations on the given mock.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * reset(fn);\n *\n * fn(); // throws\n */\nexport const reset = (mock: Mock<any>): void => {\n getMockState(mock).repository.clear();\n};\n\n/**\n * Reset all existing mocks.\n *\n * @see reset\n */\nexport const resetAll = (): void => {\n getAllMocks().forEach(([mock]) => {\n reset(mock);\n });\n};\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport type { CallMap } from '../expectation/repository/expectation-repository';\nimport { printCall, printRemainingExpectations } from '../print';\n\nexport class UnmetExpectations extends Error {\n constructor(expectations: Expectation[]) {\n super(\n DIM_COLOR(`There are unmet expectations:\n\n - ${expectations.map((e) => e.toString()).join('\\n - ')}`)\n );\n }\n}\n\n/**\n * Merge property accesses and method calls for the same property\n * into a single call.\n *\n * @example\n * mergeCalls({ getData: [{ arguments: undefined }, { arguments: [1, 2, 3] }] }\n * // returns { getData: [{ arguments: [1, 2, 3] } }\n */\nconst mergeCalls = (callMap: CallMap): CallMap =>\n new Map(\n Array.from(callMap.entries()).map(([property, calls]) => {\n const hasMethodCalls = calls.some((call) => call.arguments);\n const hasPropertyAccesses = calls.some((call) => !call.arguments);\n\n if (hasMethodCalls && hasPropertyAccesses) {\n return [property, calls.filter((call) => call.arguments)];\n }\n\n return [property, calls];\n })\n );\n\nexport class UnexpectedCalls extends Error {\n constructor(unexpectedCalls: CallMap, expectations: Expectation[]) {\n const printedCalls = Array.from(mergeCalls(unexpectedCalls).entries())\n .map(([property, calls]) =>\n calls.map((call) => printCall(property, call.arguments)).join('\\n - ')\n )\n .join('\\n - ');\n\n super(\n DIM_COLOR(`The following calls were unexpected:\n\n - ${printedCalls}\n\n${printRemainingExpectations(expectations)}`)\n );\n }\n}\n","import { UnexpectedCalls, UnmetExpectations } from '../errors/verify';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport { getAllMocks, getMockState } from '../mock/map';\nimport type { Mock } from '../mock/mock';\n\nexport const verifyRepo = (repository: ExpectationRepository) => {\n const unmetExpectations = repository.getUnmet();\n\n if (unmetExpectations.length) {\n throw new UnmetExpectations(unmetExpectations);\n }\n\n const callStats = repository.getCallStats();\n\n if (callStats.unexpected.size) {\n throw new UnexpectedCalls(callStats.unexpected, unmetExpectations);\n }\n};\n\n/**\n * Verify that all expectations on the given mock have been met.\n *\n * @throws Will throw if there are remaining expectations that were set\n * using `when` and that weren't met.\n *\n * @throws Will throw if any unexpected calls happened. Normally those\n * calls throw on their own, but the error might be caught by the code\n * being tested.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * verify(fn); // throws\n */\nexport const verify = <T>(mock: Mock<T>): void => {\n const { repository } = getMockState(mock);\n\n verifyRepo(repository);\n};\n\n/**\n * Verify all existing mocks.\n *\n * @see verify\n */\nexport const verifyAll = (): void => {\n getAllMocks().forEach(([mock]) => {\n verify(mock);\n });\n};\n","import { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Compare values using `Object.is`.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n *\n * @see It.deepEquals A matcher that uses deep equality.\n */\nexport const is = <T = unknown>(expected: T): TypeMatcher<T> =>\n matches((actual) => Object.is(actual, expected), {\n toString: () => `${printValue(expected)}`,\n getDiff: (actual) => ({ actual, expected }),\n });\n","import type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any value, including `undefined` and `null`.\n *\n * @example\n * const fn = mock<(x: number, y: string) => number>();\n * when(() => fn(It.isAny(), It.isAny())).thenReturn(1);\n *\n * fn(23, 'foobar') === 1\n */\nexport const isAny = (): TypeMatcher<any> =>\n matches(() => true, {\n toString: () => 'Matcher<any>',\n });\n","import { printValue } from '../print';\nimport { deepEquals } from './deep-equals';\nimport type { TypeMatcher } from './matcher';\nimport { isMatcher, matches } from './matcher';\n\n/**\n * Match an array.\n *\n * Supports nested matchers.\n *\n * @param containing If given, the matched array has to contain ALL of these\n * elements in ANY order.\n *\n * @example\n * const fn = mock<(arr: number[]) => number>();\n * when(() => fn(It.isArray())).thenReturn(1);\n * when(() => fn(It.isArray([2, 3]))).thenReturn(2);\n *\n * fn({ length: 1, 0: 42 }) // throws\n * fn([]) === 1\n * fn([3, 2, 1]) === 2\n *\n * @example\n * It.isArray([It.isString({ containing: 'foobar' })])\n */\nexport const isArray = <T extends unknown[]>(containing?: T): TypeMatcher<T> =>\n matches(\n (actual) => {\n if (!Array.isArray(actual)) {\n return false;\n }\n\n if (!containing) {\n return true;\n }\n\n return containing.every(\n (x) =>\n actual.find((y) => {\n if (isMatcher(x)) {\n return x.matches(y);\n }\n\n return deepEquals(x).matches(y);\n }) !== undefined\n );\n },\n {\n toString: () =>\n containing ? `array(${printValue(containing)})` : 'array',\n getDiff: (actual) => {\n if (containing) {\n return {\n actual,\n expected: `Matcher<array>([${containing\n .map((value) => {\n if (isMatcher(value)) {\n return value.toString();\n }\n\n return value;\n })\n .join(', ')}])`,\n };\n }\n\n return {\n actual: `${printValue(actual)} (${typeof actual})`,\n expected: 'Matcher<array>',\n };\n },\n }\n );\n","import { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any number.\n *\n * @example\n * const fn = mock<(x: number) => number>();\n * when(() => fn(It.isNumber())).returns(42);\n *\n * fn(20.5) === 42\n * fn(NaN) // throws\n */\nexport const isNumber = (): TypeMatcher<number> =>\n matches((actual) => typeof actual === 'number' && !Number.isNaN(actual), {\n toString: () => 'Matcher<number>',\n getDiff: (actual) => ({\n actual: `${printValue(actual)} (${typeof actual})`,\n expected: 'Matcher<number>',\n }),\n });\n","import { isObjectLike, isPlainObject as isPlainObjectLodash } from 'lodash';\nimport { printValue } from '../print';\nimport type { Property } from '../proxy';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\ntype ObjectType = Record<Property, unknown>;\n\n/**\n * Matches any plain object e.g. object literals or objects created with `Object.create()`.\n *\n * Classes, arrays, maps, sets etc. are not considered plain objects.\n * You can use {@link containsObject} or {@link matches} to match those.\n *\n * @example\n * const fn = mock<({ foo: string }) => number>();\n * when(() => fn(It.isPlainObject())).thenReturn(42);\n *\n * fn({ foo: 'bar' }) // returns 42\n */\nexport const isPlainObject = <T extends ObjectType>(): TypeMatcher<T> =>\n matches((actual) => isPlainObjectLodash(actual), {\n toString: () => 'Matcher<object>',\n getDiff: (actual) => {\n const type = isObjectLike(actual) ? 'object-like' : typeof actual;\n\n return {\n actual: `${printValue(actual)} (${type})`,\n expected: 'Matcher<object>',\n };\n },\n });\n","import { cloneDeepWith, isPlainObject } from 'lodash';\nimport { printValue } from '../print';\nimport type { Property } from '../proxy';\nimport { deepEquals } from './deep-equals';\nimport { isArray } from './is-array';\nimport type { TypeMatcher } from './matcher';\nimport { isMatcher, matches } from './matcher';\n\ntype ObjectType = Record<Property, unknown>;\ntype NonEmptyObject<T extends ObjectType> = keyof T extends never ? never : T;\n\ntype DeepPartial<T> = T extends ObjectType\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\nconst looksLikeObject = (value: unknown): value is ObjectType =>\n isPlainObject(value);\n\nconst getExpectedObjectDiff = (actual: unknown, expected: unknown): object =>\n Object.fromEntries(\n getKeys(expected).map((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return [key, expectedValue.getDiff(actualValue).expected];\n }\n\n if (looksLikeObject(expectedValue)) {\n return [key, getExpectedObjectDiff(actualValue, expectedValue)];\n }\n\n return [key, expectedValue];\n })\n );\n\nconst getActualObjectDiff = (actual: unknown, expected: unknown): unknown => {\n const actualKeys = getKeys(actual);\n const expectedKeys = new Set(getKeys(expected));\n const commonKeys = actualKeys.filter((key) => expectedKeys.has(key));\n\n if (!commonKeys.length) {\n // When we don't have any common keys we return the whole object\n // so the user can inspect what's in there.\n return actual;\n }\n\n return Object.fromEntries(\n commonKeys.map((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return [key, expectedValue.getDiff(actualValue).actual];\n }\n\n if (looksLikeObject(expectedValue)) {\n return [key, getActualObjectDiff(actualValue, expectedValue)];\n }\n\n return [key, actualValue];\n })\n );\n};\n\nconst getKeys = (value: unknown): Property[] => {\n if (typeof value === 'object' && value !== null) {\n return Reflect.ownKeys(value);\n }\n\n return [];\n};\n\nconst getKey = (value: unknown, key: Property): unknown =>\n // @ts-expect-error because we're fine with a runtime undefined value\n value?.[key];\n\nconst isMatch = (actual: unknown, expected: unknown): boolean => {\n const actualKeys = getKeys(actual);\n const expectedKeys = getKeys(expected);\n\n if (!isArray(expectedKeys).matches(actualKeys)) {\n return false;\n }\n\n return expectedKeys.every((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return expectedValue.matches(actualValue);\n }\n\n if (looksLikeObject(expectedValue)) {\n return isMatch(actualValue, expectedValue);\n }\n\n return deepEquals(expectedValue).matches(actualValue);\n });\n};\n\nconst deepPrintObject = (value: unknown) =>\n cloneDeepWith(value, (value) => {\n if (isMatcher(value)) {\n return value.toString();\n }\n\n return undefined;\n });\n\n/**\n * Check if an object recursively contains the expected properties,\n * i.e. the expected object is a subset of the received object.\n *\n * @param partial A subset of the expected object that will be recursively matched.\n * Supports nested matchers.\n * Concrete values will be compared with {@link deepEquals}.\n *\n * @see {@link isPlainObject} if you want to match any plain object.\n *\n * @example\n * const fn = mock<(pos: { x: number, y: number }) => number>();\n * when(() => fn(It.containsObject({ x: 23 }))).returns(42);\n *\n * fn({ x: 23, y: 200 }) // returns 42\n *\n * @example\n * It.containsObject({ foo: It.isString() })\n */\n// T is not constrained to ObjectType because of\n// https://github.com/microsoft/TypeScript/issues/57810,\n// but K is to avoid inferring non-object partials\nexport const containsObject = <T, K extends DeepPartial<T>>(\n partial: K extends ObjectType ? NonEmptyObject<K> : never\n): TypeMatcher<T> =>\n matches((actual) => isMatch(actual, partial), {\n toString: () => `Matcher<object>(${printValue(deepPrintObject(partial))})`,\n getDiff: (actual) => ({\n actual: getActualObjectDiff(actual, partial),\n expected: getExpectedObjectDiff(actual, partial),\n }),\n });\n","import type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any string.\n *\n * @param matching An optional string or RegExp to match the string against.\n * If it's a string, a case-sensitive search will be performed.\n *\n * @example\n * const fn = mock<(x: string, y: string) => number>();\n * when(() => fn(It.isString(), It.isString('bar'))).returns(42);\n *\n * fn('foo', 'baz') // throws\n * fn('foo', 'bar') === 42\n */\nexport const isString = (matching?: string | RegExp): TypeMatcher<string> =>\n matches(\n (actual) => {\n if (typeof actual !== 'string') {\n return false;\n }\n\n if (!matching) {\n return true;\n }\n\n if (typeof matching === 'string') {\n return actual.indexOf(matching) !== -1;\n }\n\n return matching.test(actual);\n },\n {\n toString: () => {\n if (matching) {\n return `Matcher<string>(${matching})`;\n }\n\n return 'Matcher<string>';\n },\n getDiff: (actual) => {\n if (matching) {\n return {\n expected: `Matcher<string>(${matching})`,\n actual,\n };\n }\n\n return {\n expected: 'Matcher<string>',\n actual: `${actual} (${typeof actual})`,\n };\n },\n }\n );\n","import type { Matcher, TypeMatcher } from './matcher';\nimport { MATCHER_SYMBOL } from './matcher';\n\n/**\n * Matches anything and stores the received value.\n *\n * This should not be needed for most cases, but can be useful if you need\n * access to a complex argument outside the expectation e.g. to test a\n * callback.\n *\n * @param name If given, this name will be printed in error messages.\n *\n * @example\n * const fn = mock<(cb: (value: number) => number) => void>();\n * const matcher = It.willCapture();\n * when(() => fn(matcher)).thenReturn();\n *\n * fn(x => x + 1);\n * matcher.value?.(3) === 4\n */\nexport const willCapture = <T = unknown>(\n name?: string\n): TypeMatcher<T> & {\n value: T | undefined;\n} => {\n let capturedValue: T | undefined;\n\n const matcher: Matcher & {\n value: T | undefined;\n } = {\n [MATCHER_SYMBOL]: true,\n matches: (actual) => {\n capturedValue = actual;\n\n return true;\n },\n toString: () => (name ? `Capture(${name})` : 'Capture'),\n getDiff: (actual) => ({\n actual,\n expected: actual,\n }),\n get value(): T | undefined {\n return capturedValue;\n },\n };\n\n return matcher as any;\n};\n","/* istanbul ignore file */\nexport { deepEquals } from './deep-equals';\n\nexport { is } from './is';\n\nexport { isAny } from './is-any';\n\nexport { isArray } from './is-array';\n\nexport { isNumber } from './is-number';\n\nexport { isPlainObject } from './is-plain-object';\n\nexport { containsObject } from './contains-object';\n\nexport { isString } from './is-string';\n\nexport { matches } from './matcher';\n\nexport { willCapture } from './will-capture';\n"],"names":["ApplyProp","Symbol","MATCHER_SYMBOL","isMatcher","f","getMatcherDiffs","matchers","args","matcherDiffs","map","matcher","i","getDiff","actual","d","expected","matches","predicate","options","_options$toString","_options$getDiff","toString","printProperty","property","printValue","arg","stringify","printArgs","join","printCall","prettyProperty","prettyArgs","RECEIVED_COLOR","printReturns","isError","isPromise","value","min","max","thenPrefix","printWhen","EXPECTED_COLOR","printExpectation","returnValue","printRemainingExpectations","expectations","length","e","UnexpectedAccess","Error","constructor","DIM_COLOR","printArgsDiff","diff","printDiff","omitAnnotationLines","ansilessDiffLines","stripAnsi","split","relevantDiffLines","slice","lastLine","coloredDiffLines","line","first","charAt","printExpectationDiff","_e$args","printDiffForAllExpectations","undefined","filter","x","UnexpectedCall","header","propertyExpectations","_propertyExpectations","matcherResult","UnexpectedProperty","unboxReturnValue","Promise","reject","resolve","FlexibleRepository","unexpectedProperty","THROW","Map","expectedCallStats","unexpectedCallStats","apply","get","handlePropertyWithMatchingExpectations","recordExpected","propertyExpectation","find","expectation","countAndConsume","callExpectation","getValueForUnexpectedCall","handlePropertyWithNoExpectations","toStringTag","getValueForUnexpectedAccess","add","set","matchCount","clear","getAllProperties","Array","from","keys","getCallStats","unexpected","getUnmet","concat","values","calls","arguments","recordUnexpected","consumeExpectation","StrongExpectation","exactParams","matched","setInvocationCount","matchesArgs","isUnmet","received","every","UnfinishedExpectation","MissingWhen","NotAMock","NestedWhen","parentProp","childProp","snippet","ExpectationBuilderWithFactory","createExpectation","concreteMatcher","setProperty","setArgs","finish","removeUndefined","object","isArray","isObjectLike","omitBy","isUndefined","deepEquals","strict","isEqual","defaults","CALL_THROW","currentDefaults","setDefaults","newDefaults","activeMock","setActiveMock","mock","getActiveMock","mockMap","getMockState","has","setMockState","state","getAllMocks","entries","createProxy","traps","Proxy","target","prop","thisArg","moreArgs","ownKeys","getOwnPropertyDescriptor","includes","configurable","enumerable","createStub","repo","builder","getCurrentMode","stub","Mode","CALL","strongExpectationFactory","currentMode","setMode","mode","getMode","repository","createInvocationCount","between","times","exact","anyTimes","atLeast","Infinity","atMost","once","twice","finishExpectation","finishedExpectation","getError","errorOrMessage","createReturns","thenReturn","thenThrow","thenResolve","promiseValue","thenReject","when","EXPECT","reset","resetAll","forEach","UnmetExpectations","mergeCalls","callMap","hasMethodCalls","some","call","hasPropertyAccesses","UnexpectedCalls","unexpectedCalls","printedCalls","verifyRepo","unmetExpectations","callStats","size","verify","verifyAll","is","Object","isAny","containing","y","isNumber","Number","isNaN","isPlainObject","isPlainObjectLodash","type","looksLikeObject","getExpectedObjectDiff","fromEntries","getKeys","key","expectedValue","getKey","actualValue","getActualObjectDiff","actualKeys","expectedKeys","Set","commonKeys","Reflect","isMatch","deepPrintObject","cloneDeepWith","containsObject","partial","isString","matching","indexOf","test","willCapture","name","capturedValue"],"mappings":";;;;;;;;;AAgCA;;AAEG;AACI,MAAMA,SAAS,GAAGC,MAAM,CAAC,OAAO,CAAC;;ACnCjC,MAAMC,cAAc,GAAGD,MAAM,CAAC,SAAS,CAAC,CAAA;AAkE/C;;AAEG;AACG,SAAUE,SAASA,CAACC,CAAU,EAAA;EAClC,OAAO,CAAC,EAAEA,CAAC,IAAcA,CAAE,CAACF,cAAc,CAAC,CAAC,CAAA;AAC9C,CAAA;AAEO,MAAMG,eAAe,GAAGA,CAC7BC,QAAmB,EACnBC,IAAe,KAC+B;EAC9C,MAAMC,YAAY,GAAGF,QAAQ,CAACG,GAAG,CAAC,CAACC,OAAO,EAAEC,CAAC,KAAKD,OAAO,CAACE,OAAO,CAACL,IAAI,CAACI,CAAC,CAAC,CAAC,CAAC,CAAA;EAC3E,MAAME,MAAM,GAAGL,YAAY,CAACC,GAAG,CAAEK,CAAC,IAAKA,C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,QAAQ,EAAEA,MAAOoP,IAAI,GAAG,CAAWA,QAAAA,EAAAA,IAAO,CAAA,CAAA,CAAA,GAAG,SAAU;IACvD7P,OAAO,EAAGC,MAAM,KAAM;MACpBA,MAAM;AACNE,MAAAA,QAAQ,EAAEF,MAAAA;KACX,CAAC;IACF,IAAIuB,KAAKA,GAAA;AACP,MAAA,OAAOsO,aAAa,CAAA;AACtB,KAAA;GACD,CAAA;AAED,EAAA,OAAOhQ,OAAc,CAAA;AACvB,CAAC;;AC/CD;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/expectation/expectation.ts","../src/matchers/matcher.ts","../src/print.ts","../src/errors/unexpected-access.ts","../src/errors/diff.ts","../src/errors/unexpected-call.ts","../src/mock/options.ts","../src/expectation/repository/return-value.ts","../src/expectation/repository/flexible-repository.ts","../src/expectation/strong-expectation.ts","../src/errors/api.ts","../src/when/expectation-builder.ts","../src/matchers/deep-equals.ts","../src/mock/defaults.ts","../src/mock/map.ts","../src/mock/mode.ts","../src/proxy.ts","../src/mock/stub.ts","../src/mock/mock.ts","../src/return/invocation-count.ts","../src/return/returns.ts","../src/when/when.ts","../src/verify/reset.ts","../src/errors/verify.ts","../src/verify/verify.ts","../src/matchers/is.ts","../src/matchers/is-any.ts","../src/matchers/is-array.ts","../src/matchers/is-number.ts","../src/matchers/is-plain-object.ts","../src/matchers/contains-object.ts","../src/matchers/is-string.ts","../src/matchers/will-capture.ts","../src/matchers/it.ts"],"sourcesContent":["import type { Matcher } from '../matchers/matcher';\nimport type { Property } from '../proxy';\nimport type { ReturnValue } from './repository/return-value';\n\n/**\n * Compare received arguments against matchers.\n */\nexport interface Expectation {\n property: Property;\n\n /**\n * `undefined` means this is a property expectation.\n * `[]` means this is a function call with no arguments.\n */\n args: Matcher[] | undefined;\n\n returnValue: ReturnValue;\n\n min: number;\n\n max: number;\n\n /**\n * How many times should this expectation match?\n */\n setInvocationCount: (min: number, max: number) => void;\n\n matches: (args: unknown[] | undefined) => boolean;\n\n toString: () => string;\n}\n\n/**\n * Special symbol denoting the call of a function.\n */\nexport const ApplyProp = Symbol('apply');\n","export const MATCHER_SYMBOL = Symbol('matcher');\n\nexport type MatcherDiffer = (actual: any) => { actual: any; expected: any };\n\nexport type MatcherOptions = {\n /**\n * Will be called when printing the diff between an expectation and the\n * (mismatching) received arguments.\n *\n * With this function you can pretty print the `actual` and `expected` values\n * according to your matcher's logic.\n *\n * @param actual The actual value received by this matcher, same as the one\n * in `matches`.\n *\n * @example\n * const neverMatcher = It.matches(() => false, {\n * getDiff: (actual) => ({ actual, expected: 'never' })\n * });\n *\n * when(() => fn(neverMatcher)).thenReturn(42);\n *\n * fn(42);\n * // - Expected\n * // + Received\n * //\n * // - 'never'\n * // + 42\n */\n getDiff: MatcherDiffer;\n\n /**\n * Will be called when printing arguments for an unexpected or unmet expectation.\n *\n * @example\n * const neverMatcher = It.matches(() => false, {\n * toString: () => 'never'\n * });\n * when(() => fn(neverMatcher)).thenReturn(42);\n *\n * fn(42);\n * // Unmet expectations:\n * // when(() => fn(never)).thenReturn(42)\n */\n toString: () => string;\n};\n\n/**\n * You MUST use {@link It.matches} to create this branded type.\n */\nexport interface Matcher extends MatcherOptions {\n [MATCHER_SYMBOL]: boolean;\n\n /**\n * Will be called with the received value and should return whether it matches\n * the expectation.\n */\n matches: (actual: any) => boolean;\n}\n\n/**\n * This takes the shape of T to satisfy call sites, but strong-mock will only\n * care about the matcher type.\n */\nexport type TypeMatcher<T> = T & Matcher;\n\n/**\n * Used to test if an expectation is an argument is a custom matcher.\n */\nexport function isMatcher(f: unknown): f is Matcher {\n return !!(f && (<Matcher>f)[MATCHER_SYMBOL]);\n}\n\nexport const getMatcherDiffs = (\n matchers: Matcher[],\n args: unknown[]\n): { actual: unknown[]; expected: unknown[] } => {\n const matcherDiffs = matchers.map((matcher, i) => matcher.getDiff(args[i]));\n const actual = matcherDiffs.map((d) => d.actual);\n const expected = matcherDiffs.map((d) => d.expected);\n\n return { actual, expected };\n};\n\n/**\n * Create a custom matcher.\n *\n * @param predicate Will receive the actual value and return whether it matches the expectation.\n * @param options\n * @param options.toString An optional function that should return a string that will be\n * used when the matcher needs to be printed in an error message. By default,\n * it stringifies `predicate`.\n * @param options.getDiff An optional function that will be called when printing the\n * diff for a failed expectation. It will only be called if there's a mismatch\n * between the expected and received values i.e. `predicate(actual)` fails.\n * By default, the `toString` method will be used to format the expected value,\n * while the received value will be returned as-is.\n *\n * @example\n * // Create a matcher for positive numbers.\n * const fn = mock<(x: number) => number>();\n * when(() => fn(It.matches(x => x >= 0))).thenReturn(42);\n *\n * fn(2) === 42\n * fn(-1) // throws\n */\nexport const matches = <T>(\n predicate: (actual: T) => boolean,\n options?: Partial<MatcherOptions>\n): TypeMatcher<T> => {\n // We can't use destructuring with default values because `options` is optional,\n // so it needs a default value of `{}`, which will come with a native `toString`.\n const toString =\n options?.toString ?? (() => `Matcher(${predicate.toString()})`);\n const getDiff =\n options?.getDiff ??\n ((actual) => ({\n actual,\n expected: toString(),\n }));\n\n const matcher: Matcher = {\n [MATCHER_SYMBOL]: true,\n matches: (actual: T) => predicate(actual),\n toString,\n getDiff: (actual) => {\n if (predicate(actual)) {\n return {\n actual,\n expected: actual,\n };\n }\n\n return getDiff(actual);\n },\n };\n\n return matcher as any;\n};\n","import { EXPECTED_COLOR, RECEIVED_COLOR, stringify } from 'jest-matcher-utils';\nimport type { Expectation } from './expectation/expectation';\nimport { ApplyProp } from './expectation/expectation';\nimport type { ReturnValue } from './expectation/repository/return-value';\nimport { isMatcher } from './matchers/matcher';\nimport type { Property } from './proxy';\n\nexport const printProperty = (property: Property) => {\n if (property === ApplyProp) {\n return '';\n }\n\n if (typeof property === 'symbol') {\n return `[${property.toString()}]`;\n }\n\n return `.${property}`;\n};\n\nexport const printValue = (arg: unknown): string => {\n // Call toString on matchers directly to avoid wrapping strings returned by them in quotes.\n if (isMatcher(arg)) {\n return arg.toString();\n }\n\n return stringify(arg);\n};\n\nconst printArgs = (args: any[]) =>\n args.map((arg) => printValue(arg)).join(', ');\n\nexport const printCall = (property: Property, args?: any[]) => {\n const prettyProperty = printProperty(property);\n\n if (args) {\n const prettyArgs = printArgs(args);\n\n return `mock${RECEIVED_COLOR(`${prettyProperty}(${prettyArgs})`)}`;\n }\n\n return `mock${RECEIVED_COLOR(`${prettyProperty}`)}`;\n};\n\nexport const printReturns = (\n { isError, isPromise, value }: ReturnValue,\n min: number,\n max: number\n) => {\n let thenPrefix = '';\n\n if (isPromise) {\n if (isError) {\n thenPrefix += 'thenReject';\n } else {\n thenPrefix += 'thenResolve';\n }\n } else if (isError) {\n thenPrefix += 'thenThrow';\n } else {\n thenPrefix += 'thenReturn';\n }\n\n return `.${thenPrefix}(${RECEIVED_COLOR(\n printValue(value)\n )}).between(${min}, ${max})`;\n};\n\nexport const printWhen = (property: Property, args: any[] | undefined) => {\n const prettyProperty = printProperty(property);\n\n if (args) {\n return `when(() => mock${EXPECTED_COLOR(\n `${prettyProperty}(${printArgs(args)})`\n )})`;\n }\n\n return `when(() => mock${EXPECTED_COLOR(`${printProperty(property)}`)})`;\n};\n\nexport const printExpectation = (\n property: Property,\n args: any[] | undefined,\n returnValue: ReturnValue,\n min: number,\n max: number\n) => `${printWhen(property, args)}${printReturns(returnValue, min, max)}`;\n\nexport const printRemainingExpectations = (expectations: Expectation[]) =>\n expectations.length\n ? `Remaining unmet expectations:\n - ${expectations.map((e) => e.toString()).join('\\n - ')}`\n : 'There are no remaining unmet expectations.';\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport { printCall, printRemainingExpectations } from '../print';\nimport type { Property } from '../proxy';\n\nexport class UnexpectedAccess extends Error {\n constructor(property: Property, expectations: Expectation[]) {\n super(\n DIM_COLOR(`Didn't expect ${printCall(property)} to be accessed.\n\nIf you expect this property to be accessed then please\nset an expectation for it.\n\n${printRemainingExpectations(expectations)}`)\n );\n }\n}\n","import { diff as printDiff } from 'jest-diff';\nimport { EXPECTED_COLOR, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport { getMatcherDiffs } from '../matchers/matcher';\n\nconst noColor = (s: string) => s;\n\nexport const printArgsDiff = (\n expected: unknown[],\n actual: unknown[]\n): string => {\n const diff = printDiff(expected, actual, {\n omitAnnotationLines: true,\n aColor: noColor,\n bColor: noColor,\n changeColor: noColor,\n commonColor: noColor,\n patchColor: noColor,\n });\n\n /* istanbul ignore next this is not expected in practice */\n if (!diff) {\n return '';\n }\n\n const diffLines = diff.split('\\n');\n let relevantDiffLines: string[];\n\n // Strip Array [ ... ] surroundings.\n if (!expected.length) {\n // - Array []\n // + Array [\n // ...\n // ]\n relevantDiffLines = diffLines.slice(2, -1);\n } else if (!actual.length) {\n // - Array [\n // ...\n // ]\n // + Array []\n relevantDiffLines = diffLines.slice(1, -2);\n } else {\n // Array [\n // ...\n // ]\n relevantDiffLines = diffLines.slice(1, -1);\n }\n\n // Strip the trailing comma.\n const lastLine = relevantDiffLines[relevantDiffLines.length - 1].slice(0, -1);\n\n const coloredDiffLines = [...relevantDiffLines.slice(0, -1), lastLine].map(\n (line) => {\n const first = line.charAt(0);\n\n switch (first) {\n case '-':\n return EXPECTED_COLOR(line);\n case '+':\n return RECEIVED_COLOR(line);\n default:\n return line;\n }\n }\n );\n\n return coloredDiffLines.join('\\n');\n};\n\nexport const printExpectationDiff = (e: Expectation, args: unknown[]) => {\n if (!e.args?.length) {\n return '';\n }\n\n const { actual, expected } = getMatcherDiffs(e.args, args);\n\n return printArgsDiff(expected, actual);\n};\n\nexport const printDiffForAllExpectations = (\n expectations: Expectation[],\n actual: unknown[]\n) =>\n expectations\n .map((e) => {\n const diff = printExpectationDiff(e, actual);\n\n if (diff) {\n return `${e.toString()}\n${EXPECTED_COLOR('- Expected')}\n${RECEIVED_COLOR('+ Received')}\n\n${diff}`;\n }\n\n return undefined;\n })\n .filter((x) => x)\n .join('\\n\\n');\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport { getMatcherDiffs } from '../matchers/matcher';\nimport { printCall } from '../print';\nimport type { Property } from '../proxy';\nimport { printDiffForAllExpectations } from './diff';\n\ntype MatcherResult = {\n expected: unknown;\n actual: unknown;\n};\n\n// This is taken from jest.\ninterface MatcherError {\n matcherResult?: MatcherResult;\n}\n\nexport class UnexpectedCall extends Error implements MatcherError {\n public matcherResult?: MatcherResult;\n\n constructor(\n property: Property,\n args: unknown[],\n expectations: Expectation[]\n ) {\n const header = `Didn't expect ${printCall(property, args)} to be called.`;\n\n const propertyExpectations = expectations.filter(\n (e) => e.property === property\n );\n\n if (propertyExpectations.length) {\n super(\n DIM_COLOR(`${header}\n\nRemaining expectations:\n${printDiffForAllExpectations(propertyExpectations, args)}`)\n );\n\n // If we have a single expectation we can attach the actual/expected args\n // to the error instance, so that an IDE may show its own diff for them.\n if (\n propertyExpectations.length === 1 &&\n propertyExpectations[0].args?.length\n ) {\n const { actual, expected } = getMatcherDiffs(\n propertyExpectations[0].args,\n args\n );\n this.matcherResult = {\n actual,\n expected,\n };\n }\n } else {\n super(\n DIM_COLOR(`${header}\n \nNo remaining expectations.`)\n );\n }\n }\n}\n","import type { Matcher } from '../matchers/matcher';\n\nexport type ConcreteMatcher = <T>(expected: T) => Matcher;\n\nexport enum UnexpectedProperty {\n /**\n * Throw an error immediately.\n *\n * @example\n * // Will throw \"Didn't expect foo to be accessed\".\n * const { foo } = service;\n *\n * // Will throw \"Didn't expect foo to be accessed\",\n * // without printing the arguments.\n * foo(42);\n */\n THROW,\n\n /**\n * Return a function that will throw if called. This can be useful if your\n * code destructures a function but never calls it.\n *\n * It will also improve error messages for unexpected calls because arguments\n * will be captured instead of throwing immediately on the property access.\n *\n * The function will be returned even if the property is not supposed to be a\n * function. This could cause weird behavior at runtime, when your code expects\n * e.g. a number and gets a function instead.\n *\n * @example\n * // This will NOT throw.\n * const { foo } = service;\n *\n * // This will NOT throw, and might produce unexpected results.\n * foo > 0\n *\n * // Will throw \"Didn't expect foo(42) to be called\".\n * foo(42);\n */\n CALL_THROW,\n}\n\nexport interface MockOptions {\n /**\n * Controls what should be returned for a property with no expectations.\n *\n * A property with no expectations is a property that has no `when`\n * expectations set on it. It can also be a property that ran out of `when`\n * expectations.\n *\n * The default is to return a function that will throw when called.\n *\n * @example\n * const foo = mock<{ bar: () => number }>();\n * foo.bar() // unexpected property access\n *\n * @example\n * const foo = mock<{ bar: () => number }>();\n * when(() => foo.bar()).thenReturn(42);\n * foo.bar() === 42\n * foo.bar() // unexpected property access\n */\n unexpectedProperty?: UnexpectedProperty;\n\n /**\n * If `true`, the number of received arguments in a function/method call has to\n * match the number of arguments set in the expectation.\n *\n * If `false`, extra parameters are considered optional and checked by the\n * TypeScript compiler instead.\n *\n * You may want to set this to `true` if you're not using TypeScript,\n * or if you want to be extra strict.\n *\n * @example\n * const fn = mock<(value?: number) => number>({ exactParams: true });\n * when(() => fn()).thenReturn(42);\n *\n * fn(100) // throws with exactParams, returns 42 without\n */\n exactParams?: boolean;\n\n /**\n * The matcher that will be used when one isn't specified explicitly.\n *\n * The most common use case is replacing the default {@link It.deepEquals}\n * matcher with {@link It.is}, but you can also use {@link It.matches} to\n * create a custom matcher.\n *\n * @param expected The concrete expected value received from the\n * {@link when} expectation.\n *\n * @example\n * const fn = mock<(value: number[]) => boolean>({\n * concreteMatcher: It.is\n * });\n *\n * const expected = [1, 2, 3];\n * when(() => fn(expected).thenReturn(true);\n *\n * fn([1, 2, 3]); // throws because different array instance\n * fn(expected); // OK\n */\n concreteMatcher?: ConcreteMatcher;\n}\n","export type ReturnValue = {\n value: any;\n isPromise?: boolean;\n isError?: boolean;\n};\n\n/**\n * Unbox the expectation's return value.\n *\n * If the value is an error then throw it.\n *\n * If the value is a promise then resolve/reject it.\n */\nexport const unboxReturnValue = ({\n isError,\n isPromise,\n value,\n}: ReturnValue) => {\n if (isError) {\n if (value instanceof Error) {\n if (isPromise) {\n return Promise.reject(value);\n }\n throw value;\n }\n\n if (isPromise) {\n return Promise.reject(new Error(value));\n }\n\n throw new Error(value);\n }\n\n if (isPromise) {\n return Promise.resolve(value);\n }\n\n return value;\n};\n","import { UnexpectedAccess } from '../../errors/unexpected-access';\nimport { UnexpectedCall } from '../../errors/unexpected-call';\nimport { MATCHER_SYMBOL } from '../../matchers/matcher';\nimport { UnexpectedProperty } from '../../mock/options';\nimport type { Property } from '../../proxy';\nimport type { Expectation } from '../expectation';\nimport { ApplyProp } from '../expectation';\nimport type { CallMap, ExpectationRepository } from './expectation-repository';\nimport { unboxReturnValue } from './return-value';\n\ntype CountableExpectation = {\n expectation: Expectation;\n matchCount: number;\n};\n\n/**\n * An expectation repository with a configurable behavior for\n * unexpected property access.\n */\nexport class FlexibleRepository implements ExpectationRepository {\n constructor(\n private unexpectedProperty: UnexpectedProperty = UnexpectedProperty.THROW\n ) {}\n\n protected readonly expectations = new Map<Property, CountableExpectation[]>();\n\n private readonly expectedCallStats: CallMap = new Map();\n\n private readonly unexpectedCallStats: CallMap = new Map();\n\n add(expectation: Expectation): void {\n const { property } = expectation;\n\n const expectations = this.expectations.get(property) || [];\n\n this.expectations.set(property, [\n ...expectations,\n {\n expectation,\n matchCount: 0,\n },\n ]);\n }\n\n clear(): void {\n this.expectations.clear();\n this.expectedCallStats.clear();\n this.unexpectedCallStats.clear();\n }\n\n apply = (args: unknown[]): unknown => this.get(ApplyProp)(...args);\n\n // TODO: this returns any, but the interface returns unknown\n // unknown causes errors in apply tests, and any causes bugs in bootstrapped SM\n get(property: Property): any {\n const expectations = this.expectations.get(property);\n\n if (expectations && expectations.length) {\n return this.handlePropertyWithMatchingExpectations(\n property,\n expectations\n );\n }\n\n return this.handlePropertyWithNoExpectations(property);\n }\n\n private handlePropertyWithMatchingExpectations = (\n property: Property,\n expectations: CountableExpectation[]\n ) => {\n // Avoid recording call stats for function calls, since the property is an\n // internal detail.\n if (property !== ApplyProp) {\n // An unexpected call could still happen later, if the property returns a\n // function that will not match the given args.\n this.recordExpected(property, undefined);\n }\n\n const propertyExpectation = expectations.find((e) =>\n e.expectation.matches(undefined)\n );\n\n if (propertyExpectation) {\n this.countAndConsume(propertyExpectation);\n\n return unboxReturnValue(propertyExpectation.expectation.returnValue);\n }\n\n return (...args: any[]) => {\n const callExpectation = expectations.find((e) =>\n e.expectation.matches(args)\n );\n\n if (callExpectation) {\n this.recordExpected(property, args);\n this.countAndConsume(callExpectation);\n\n return unboxReturnValue(callExpectation.expectation.returnValue);\n }\n\n return this.getValueForUnexpectedCall(property, args);\n };\n };\n\n private handlePropertyWithNoExpectations = (property: Property) => {\n switch (property) {\n case 'toString':\n return () => 'mock';\n case '@@toStringTag':\n case Symbol.toStringTag:\n case 'name':\n return 'mock';\n\n // Promise.resolve() tries to see if it's a \"thenable\".\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables\n case 'then':\n return undefined;\n\n // pretty-format\n case '$$typeof':\n case 'constructor':\n case '@@__IMMUTABLE_ITERABLE__@@':\n case '@@__IMMUTABLE_RECORD__@@':\n return null;\n\n case MATCHER_SYMBOL:\n return false;\n\n case ApplyProp:\n return (...args: any[]) =>\n this.getValueForUnexpectedCall(property, args);\n default:\n return this.getValueForUnexpectedAccess(property);\n }\n };\n\n getAllProperties(): Property[] {\n return Array.from(this.expectations.keys());\n }\n\n getCallStats() {\n return {\n expected: this.expectedCallStats,\n unexpected: this.unexpectedCallStats,\n };\n }\n\n getUnmet(): Expectation[] {\n return ([] as Expectation[]).concat(\n ...Array.from(this.expectations.values()).map((expectations) =>\n expectations\n .filter((e) => e.expectation.min > e.matchCount)\n .map((e) => e.expectation)\n )\n );\n }\n\n private recordExpected(property: Property, args: any[] | undefined) {\n const calls = this.expectedCallStats.get(property) || [];\n\n this.expectedCallStats.set(property, [...calls, { arguments: args }]);\n }\n\n private recordUnexpected(property: Property, args: any[] | undefined) {\n const calls = this.unexpectedCallStats.get(property) || [];\n\n this.unexpectedCallStats.set(property, [...calls, { arguments: args }]);\n }\n\n private countAndConsume(expectation: CountableExpectation) {\n // eslint-disable-next-line no-param-reassign\n expectation.matchCount++;\n\n this.consumeExpectation(expectation);\n }\n\n private consumeExpectation(expectation: CountableExpectation): void {\n const { property, max } = expectation.expectation;\n\n const expectations = this.expectations.get(property)!;\n\n if (expectation.matchCount === max) {\n this.expectations.set(\n property,\n expectations.filter((e) => e !== expectation)\n );\n }\n }\n\n private getValueForUnexpectedCall(property: Property, args: any[]): never {\n this.recordUnexpected(property, args);\n\n throw new UnexpectedCall(property, args, this.getUnmet());\n }\n\n private getValueForUnexpectedAccess(property: Property): unknown {\n if (this.unexpectedProperty === UnexpectedProperty.THROW) {\n this.recordUnexpected(property, undefined);\n\n throw new UnexpectedAccess(property, this.getUnmet());\n }\n\n return (...args: unknown[]) => {\n this.recordUnexpected(property, args);\n\n throw new UnexpectedCall(property, args, this.getUnmet());\n };\n }\n}\n","import type { Matcher } from '../matchers/matcher';\nimport { printExpectation } from '../print';\nimport type { Property } from '../proxy';\nimport type { Expectation } from './expectation';\nimport type { ReturnValue } from './repository/return-value';\n\n/**\n * Matches a call with more parameters than expected because it is assumed the\n * compiler will check that those parameters are optional.\n *\n * @example\n * new StrongExpectation(\n * 'bar',\n * deepEquals([1, 2, 3]),\n * 23\n * ).matches('bar', [1, 2, 3]) === true;\n */\nexport class StrongExpectation implements Expectation {\n private matched = 0;\n\n public min = 1;\n\n public max = 1;\n\n constructor(\n public property: Property,\n public args: Matcher[] | undefined,\n public returnValue: ReturnValue,\n private exactParams: boolean = false\n ) {}\n\n setInvocationCount(min: number, max = 1) {\n this.min = min;\n this.max = max;\n }\n\n matches(args: any[] | undefined): boolean {\n if (!this.matchesArgs(args)) {\n return false;\n }\n\n this.matched++;\n\n return this.max === 0 || this.matched <= this.max;\n }\n\n isUnmet(): boolean {\n return this.matched < this.min;\n }\n\n private matchesArgs(received: any[] | undefined) {\n if (this.args === undefined) {\n return !received;\n }\n\n if (!received) {\n return false;\n }\n\n if (this.exactParams) {\n if (this.args.length !== received.length) {\n return false;\n }\n }\n\n return this.args.every((arg, i) => arg.matches(received[i]));\n }\n\n toString() {\n return printExpectation(\n this.property,\n this.args,\n this.returnValue,\n this.min,\n this.max\n );\n }\n}\n","import { printProperty, printWhen } from '../print';\nimport type { Property } from '../proxy';\n\nexport class UnfinishedExpectation extends Error {\n constructor(property: Property, args: any[] | undefined) {\n super(`There is an unfinished pending expectation:\n\n${printWhen(property, args)}\n\nPlease finish it by setting a return value even if the value\nis undefined.`);\n }\n}\n\nexport class MissingWhen extends Error {\n constructor() {\n super(`You tried setting a return value without an expectation.\n\nEvery call to set a return value must be preceded by an expectation.`);\n }\n}\n\nexport class NotAMock extends Error {\n constructor() {\n super(`We couldn't find the mock.\n\nMake sure you're passing in an actual mock.`);\n }\n}\n\nexport class NestedWhen extends Error {\n constructor(parentProp: Property, childProp: Property) {\n const snippet = `\nconst parentMock = mock<T1>();\nconst childMock = mock<T2>();\n\nwhen(() => childMock${printProperty(childProp)}).thenReturn(...);\nwhen(() => parentMock${printProperty(parentProp)}).thenReturn(childMock)\n`;\n\n super(\n `Setting an expectation on a nested property is not supported.\n\nYou can return an object directly when the first property is accessed,\nor you can even return a separate mock:\n${snippet}`\n );\n }\n}\n","import { MissingWhen, UnfinishedExpectation } from '../errors/api';\nimport type { Expectation } from '../expectation/expectation';\nimport type { ReturnValue } from '../expectation/repository/return-value';\nimport type { ConcreteMatcher } from '../mock/options';\nimport type { Property } from '../proxy';\n\n/**\n * An expectation has to be built incrementally, starting first with the property\n * being accessed inside {@link createStub}, then any arguments passed to it, and ending\n * it with the returned value from {@link createReturns}.\n */\nexport interface ExpectationBuilder {\n setProperty: (prop: Property) => void;\n\n setArgs: (args: unknown[] | undefined) => void;\n\n finish: (returnValue: ReturnValue) => Expectation;\n}\n\nexport type ExpectationFactory = (\n property: Property,\n args: any[] | undefined,\n returnValue: ReturnValue,\n concreteMatcher: ConcreteMatcher,\n exactParams: boolean\n) => Expectation;\n\nexport class ExpectationBuilderWithFactory implements ExpectationBuilder {\n private args: unknown[] | undefined;\n\n private property: Property | undefined;\n\n constructor(\n private createExpectation: ExpectationFactory,\n private concreteMatcher: ConcreteMatcher,\n private exactParams: boolean\n ) {}\n\n setProperty(value: Property) {\n if (this.property) {\n throw new UnfinishedExpectation(this.property, this.args);\n }\n\n this.property = value;\n }\n\n setArgs(value: unknown[] | undefined) {\n this.args = value;\n }\n\n finish(returnValue: ReturnValue): Expectation {\n if (!this.property) {\n throw new MissingWhen();\n }\n\n const expectation = this.createExpectation(\n this.property,\n this.args,\n returnValue,\n this.concreteMatcher,\n this.exactParams\n );\n\n this.property = undefined;\n this.args = undefined;\n\n return expectation;\n }\n}\n","import { isEqual, isObjectLike, isUndefined, omitBy } from 'lodash';\nimport { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\nconst removeUndefined = (object: any): any => {\n if (Array.isArray(object)) {\n return object.map((x) => removeUndefined(x));\n }\n\n if (!isObjectLike(object)) {\n return object;\n }\n\n return omitBy(object, isUndefined);\n};\n\n/**\n * Compare values using deep equality.\n *\n * @param expected\n * @param strict By default, this matcher will treat a missing key in an object\n * and a key with the value `undefined` as not equal. It will also consider\n * non `Object` instances with different constructors as not equal. Setting\n * this to `false` will consider the objects in both cases as equal.\n *\n * @see {@link It.containsObject} or {@link It.isArray} if you want to nest matchers.\n * @see {@link It.is} if you want to use strict equality.\n */\nexport const deepEquals = <T>(\n expected: T,\n {\n strict = true,\n }: {\n strict?: boolean;\n } = {}\n): TypeMatcher<T> =>\n matches(\n (actual) => {\n if (strict) {\n return isEqual(actual, expected);\n }\n\n return isEqual(removeUndefined(actual), removeUndefined(expected));\n },\n {\n toString: () => printValue(expected),\n getDiff: (actual) => ({\n actual,\n expected,\n }),\n }\n );\n","import { deepEquals } from '../matchers/deep-equals';\nimport type { MockOptions } from './options';\nimport { UnexpectedProperty } from './options';\n\nexport type StrongMockDefaults = Required<MockOptions>;\n\nconst defaults: StrongMockDefaults = {\n concreteMatcher: deepEquals,\n unexpectedProperty: UnexpectedProperty.CALL_THROW,\n exactParams: false,\n};\n\nexport let currentDefaults: StrongMockDefaults = defaults;\n\n/**\n * Override strong-mock's defaults.\n *\n * @param newDefaults These will be applied to the library defaults. Multiple\n * calls don't stack e.g. calling this with `{}` will clear any previously\n * applied defaults.\n */\nexport const setDefaults = (newDefaults: MockOptions): void => {\n currentDefaults = {\n ...defaults,\n ...newDefaults,\n };\n};\n","import { NotAMock } from '../errors/api';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport type { StrongMockDefaults } from './defaults';\nimport type { Mock } from './mock';\n\n/**\n * Since `when` doesn't receive the mock subject (because we can't make it\n * consistently return it from `mock()`, `mock.foo` and `mock.bar()`) we need\n * to store a global state for the currently active mock.\n *\n * We also want to throw in the following case:\n *\n * ```\n * when(() => mock()) // forgot returns here\n * when(() => mock()) // should throw\n * ```\n *\n * For that reason we can't just store the currently active mock, but also\n * whether we finished the expectation or not.\n */\nlet activeMock: Mock<any> | undefined;\n\nexport const setActiveMock = (mock: Mock<any>) => {\n activeMock = mock;\n};\n\nexport const clearActiveMock = () => {\n activeMock = undefined;\n};\n\nexport const getActiveMock = (): Mock<any> => activeMock;\n\ntype MockState = {\n repository: ExpectationRepository;\n builder: ExpectationBuilder;\n options: StrongMockDefaults;\n};\n\n/**\n * Store a global map of all mocks created and their state.\n *\n * This is needed because we can't reliably pass the state between `when`\n * and `thenReturn`.\n */\nconst mockMap = new Map<Mock<any>, MockState>();\n\nexport const getMockState = (mock: Mock<any>): MockState => {\n if (mockMap.has(mock)) {\n return mockMap.get(mock)!;\n }\n\n throw new NotAMock();\n};\n\nexport const setMockState = (mock: Mock<any>, state: MockState): void => {\n mockMap.set(mock, state);\n};\n\nexport const getAllMocks = (): [Mock<any>, MockState][] =>\n Array.from(mockMap.entries());\n","export enum Mode {\n EXPECT,\n CALL,\n}\n\nlet currentMode: Mode = Mode.CALL;\n\nexport const setMode = (mode: Mode) => {\n currentMode = mode;\n};\n\nexport const getMode = () => currentMode;\n","import type { Mock } from './mock/mock';\n\nexport type Property = string | symbol;\n\nexport interface ProxyTraps {\n /**\n * Called when accessing any property on an object, except for\n * `.call`, `.apply` and `.bind`.\n */\n property: (property: Property) => unknown;\n\n /**\n * Called when calling a function.\n *\n * @example\n * ```\n * fn(...args)\n * ```\n *\n * @example\n * ```\n * fn.call(this, ...args)\n * ```\n *\n * @example\n * ```\n * fn.apply(this, [...args])\n * ```\n *\n * @example\n * ```\n * Reflect.apply(fn, this, [...args])\n * ```\n */\n apply: (args: unknown[]) => unknown;\n\n /**\n * Called when getting the proxy's own enumerable keys.\n *\n * @example\n * ```\n * Object.keys(proxy);\n * ```\n *\n * @example\n * ```\n * const foo = { ...proxy };\n * ```\n */\n ownKeys: () => Property[];\n}\n\nexport const createProxy = <T>(traps: ProxyTraps): Mock<T> =>\n // The Proxy target MUST be a function, otherwise we can't use the `apply` trap:\n // https://262.ecma-international.org/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist\n // eslint-disable-next-line no-empty-function,@typescript-eslint/no-empty-function\n new Proxy(/* istanbul ignore next */ () => {}, {\n get: (target, prop: string | symbol) => {\n if (prop === 'bind') {\n return (thisArg: unknown, ...args: unknown[]) =>\n (...moreArgs: unknown[]) =>\n traps.apply([...args, ...moreArgs]);\n }\n\n if (prop === 'apply') {\n return (thisArg: unknown, args: unknown[] | undefined) =>\n traps.apply(args || []);\n }\n\n if (prop === 'call') {\n return (thisArg: unknown, ...args: unknown[]) => traps.apply(args);\n }\n\n return traps.property(prop);\n },\n\n apply: (target, thisArg: unknown, args: unknown[]) => traps.apply(args),\n\n ownKeys: () => traps.ownKeys(),\n\n getOwnPropertyDescriptor(\n target: () => void,\n prop: string | symbol\n ): PropertyDescriptor | undefined {\n const keys = traps.ownKeys();\n\n if (keys.includes(prop)) {\n return {\n configurable: true,\n enumerable: true,\n };\n }\n\n return undefined;\n },\n }) as unknown as Mock<T>;\n","import { NestedWhen } from '../errors/api';\nimport { ApplyProp } from '../expectation/expectation';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { Property } from '../proxy';\nimport { createProxy } from '../proxy';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport { setActiveMock } from './map';\nimport type { Mock } from './mock';\n\nimport { Mode } from './mode';\n\nexport const createStub = <T>(\n repo: ExpectationRepository,\n builder: ExpectationBuilder,\n getCurrentMode: () => Mode\n): Mock<T> => {\n const stub = createProxy<T>({\n property: (property) => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.get(property);\n }\n\n setActiveMock(stub);\n\n builder.setProperty(property);\n\n return createProxy({\n property: (childProp: Property) => {\n throw new NestedWhen(property, childProp);\n },\n apply: (args: unknown[]) => {\n builder.setArgs(args);\n },\n ownKeys: () => {\n throw new Error('Spreading during an expectation is not supported.');\n },\n });\n },\n apply: (args: unknown[]) => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.apply(args);\n }\n\n setActiveMock(stub);\n\n builder.setProperty(ApplyProp);\n builder.setArgs(args);\n\n return undefined;\n },\n ownKeys: () => {\n if (getCurrentMode() === Mode.CALL) {\n return repo.getAllProperties();\n }\n\n throw new Error('Spreading during an expectation is not supported.');\n },\n });\n\n return stub;\n};\n","import { FlexibleRepository } from '../expectation/repository/flexible-repository';\nimport { StrongExpectation } from '../expectation/strong-expectation';\nimport { isMatcher } from '../matchers/matcher';\nimport type { ExpectationFactory } from '../when/expectation-builder';\nimport { ExpectationBuilderWithFactory } from '../when/expectation-builder';\nimport type { StrongMockDefaults } from './defaults';\nimport { currentDefaults } from './defaults';\nimport { setMockState } from './map';\nimport { getMode } from './mode';\nimport type { MockOptions } from './options';\nimport { createStub } from './stub';\n\nexport type Mock<T> = T;\n\nconst strongExpectationFactory: ExpectationFactory = (\n property,\n args,\n returnValue,\n concreteMatcher,\n exactParams\n) =>\n new StrongExpectation(\n property,\n // Wrap every non-matcher in the default matcher.\n args?.map((arg) => (isMatcher(arg) ? arg : concreteMatcher(arg))),\n returnValue,\n exactParams\n );\n\n/**\n * Create a type safe mock.\n *\n * @see {@link when} Set expectations on the mock using `when`.\n *\n * @param options Configure the options for this specific mock, overriding any\n * defaults that were set with {@link setDefaults}.\n * @param options.unexpectedProperty Controls what happens when an unexpected\n * property is accessed.\n * @param options.concreteMatcher The matcher that will be used when one isn't\n * specified explicitly.\n * @param options.exactParams Controls whether the number of received arguments\n * has to match the expectation.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * fn() === 23;\n */\nexport const mock = <T>({\n unexpectedProperty,\n concreteMatcher,\n exactParams,\n}: MockOptions = {}): Mock<T> => {\n const options: StrongMockDefaults = {\n unexpectedProperty:\n unexpectedProperty ?? currentDefaults.unexpectedProperty,\n concreteMatcher: concreteMatcher ?? currentDefaults.concreteMatcher,\n exactParams: exactParams ?? currentDefaults.exactParams,\n };\n\n const repository = new FlexibleRepository(options.unexpectedProperty);\n\n const builder = new ExpectationBuilderWithFactory(\n strongExpectationFactory,\n options.concreteMatcher,\n options.exactParams\n );\n\n const stub = createStub<T>(repository, builder, getMode);\n\n setMockState(stub, {\n repository,\n builder,\n options,\n });\n\n return stub;\n};\n","import type { Expectation } from '../expectation/expectation';\n\nexport interface InvocationCount {\n /**\n * Expect a call to be made at least `min` times and at most `max` times.\n */\n between: (min: number, max: number) => void;\n\n /**\n * Expect a call to be made exactly `exact` times.\n *\n * Shortcut for `between(exact, exact)`.\n */\n times: (exact: number) => void;\n\n /**\n * Expect a call to be made any number of times, including never.\n *\n * Shortcut for `between(0, Infinity)`.\n */\n anyTimes: () => void;\n\n /**\n * Expect a call to be made at least `min` times.\n *\n * Shortcut for `between(min, Infinity)`.\n */\n atLeast: (min: number) => void;\n\n /**\n * Expect a call to be made at most `max` times.\n *\n * Shortcut for `between(0, max)`.\n */\n atMost: (max: number) => void;\n\n /**\n * Expect a call to be made exactly once.\n *\n * Shortcut for `times(1)`.\n */\n once: () => void;\n\n /**\n * Expect a call to be made exactly twice.\n *\n * Shortcut for `times(2)`.\n */\n twice: () => void;\n}\n\nexport const createInvocationCount = (\n expectation: Expectation\n): InvocationCount => ({\n between(min: number, max: number) {\n expectation.setInvocationCount(min, max);\n },\n\n /* istanbul ignore next */\n times(exact: number) {\n expectation.setInvocationCount(exact, exact);\n },\n\n /* istanbul ignore next */\n anyTimes(): void {\n expectation.setInvocationCount(0, 0);\n },\n\n /* istanbul ignore next */\n atLeast(min: number) {\n expectation.setInvocationCount(min, Infinity);\n },\n\n /* istanbul ignore next */\n atMost(max: number) {\n expectation.setInvocationCount(0, max);\n },\n\n /* istanbul ignore next */\n once() {\n expectation.setInvocationCount(1, 1);\n },\n\n /* istanbul ignore next */\n twice() {\n expectation.setInvocationCount(2, 2);\n },\n /* eslint-enable no-param-reassign, no-multi-assign */\n});\n","import type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport type { ReturnValue } from '../expectation/repository/return-value';\nimport type { ExpectationBuilder } from '../when/expectation-builder';\nimport type { InvocationCount } from './invocation-count';\nimport { createInvocationCount } from './invocation-count';\n\nexport type PromiseStub<R, P> = {\n /**\n * Set the return value for the current call.\n *\n * @param value This needs to be of the same type as the value returned\n * by the call inside `when`.\n *\n * @example\n * when(() => fn()).thenReturn(Promise.resolve(23));\n *\n * @example\n * when(() => fn()).thenReturn(Promise.reject({ foo: 'bar' });\n */\n thenReturn: (value: P) => InvocationCount;\n\n /**\n * Set the return value for the current call.\n *\n * @param promiseValue This needs to be of the same type as the value inside\n * the promise returned by the `when` callback.\n *\n * @example\n * when(() => fn()).thenResolve('foo');\n */\n thenResolve: (promiseValue: R) => InvocationCount;\n\n /**\n * Make the current call reject with the given error.\n *\n * @param error An `Error` instance. You can pass just a message, and\n * it will be wrapped in an `Error` instance. If you want to reject with\n * a non error then use the {@link thenReturn} method.\n *\n * @example\n * when(() => fn()).thenReject(new Error('oops'));\n */\n thenReject: ((error: Error) => InvocationCount) &\n ((message: string) => InvocationCount) &\n (() => InvocationCount);\n};\n\nexport type NonPromiseStub<R> = {\n /**\n * Set the return value for the current call.\n *\n * @param returnValue This needs to be of the same type as the value returned\n * by the `when` callback.\n */\n thenReturn: (returnValue: R) => InvocationCount;\n\n /**\n * Make the current call throw the given error.\n *\n * @param error The error instance. If you want to throw a simple `Error`\n * you can pass just the message.\n */\n thenThrow: ((error: Error) => InvocationCount) &\n ((message: string) => InvocationCount) &\n (() => InvocationCount);\n};\n\nconst finishExpectation = (\n returnValue: ReturnValue,\n builder: ExpectationBuilder,\n repo: ExpectationRepository\n) => {\n const finishedExpectation = builder.finish(returnValue);\n\n repo.add(finishedExpectation);\n\n return createInvocationCount(finishedExpectation);\n};\n\nconst getError = (errorOrMessage: Error | string | undefined): Error => {\n if (typeof errorOrMessage === 'string') {\n return new Error(errorOrMessage);\n }\n\n if (errorOrMessage instanceof Error) {\n return errorOrMessage;\n }\n\n return new Error();\n};\n\nexport const createReturns = (\n builder: ExpectationBuilder,\n repository: ExpectationRepository\n) => ({\n thenReturn: (returnValue: any): InvocationCount =>\n finishExpectation(\n // This will handle both thenReturn(23) and thenReturn(Promise.resolve(3)).\n { value: returnValue, isError: false, isPromise: false },\n builder,\n repository\n ),\n thenThrow: (errorOrMessage?: Error | string): InvocationCount =>\n finishExpectation(\n { value: getError(errorOrMessage), isError: true, isPromise: false },\n builder,\n repository\n ),\n thenResolve: (promiseValue: any): InvocationCount =>\n finishExpectation(\n {\n value: promiseValue,\n isError: false,\n isPromise: true,\n },\n builder,\n repository\n ),\n\n thenReject: (errorOrMessage?: Error | string): InvocationCount =>\n finishExpectation(\n {\n value: getError(errorOrMessage),\n isError: true,\n isPromise: true,\n },\n builder,\n repository\n ),\n});\n","import { getActiveMock, getMockState } from '../mock/map';\nimport { Mode, setMode } from '../mock/mode';\nimport type { NonPromiseStub, PromiseStub } from '../return/returns';\nimport { createReturns } from '../return/returns';\n\ninterface When {\n <R>(expectation: () => Promise<R>): PromiseStub<R, Promise<R>>;\n <R>(expectation: () => R): NonPromiseStub<R>;\n}\n\n/**\n * Set an expectation on a mock.\n *\n * The expectation must be finished by setting a return value, even if the value\n * is `undefined`.\n *\n * If a call happens that was not expected then the mock will throw an error.\n * By default, the call is expected to only be made once. Use the invocation\n * count helpers to expect a call multiple times.\n *\n * @param expectation A callback to set the expectation on your mock. The\n * callback must return the value from the mock to properly infer types.\n *\n * @example\n * const fn = mock<() => void>();\n * when(() => fn()).thenReturn(undefined);\n *\n * @example\n * const fn = mock<() => number>();\n * when(() => fn()).thenReturn(42).atMost(3);\n *\n * @example\n * const fn = mock<(x: number) => Promise<number>();\n * when(() => fn(23)).thenResolve(42);\n */\nexport const when: When = <R>(expectation: () => R) => {\n setMode(Mode.EXPECT);\n expectation();\n setMode(Mode.CALL);\n\n const { builder, repository } = getMockState(getActiveMock());\n\n return createReturns(builder, repository);\n};\n","import { getAllMocks, getMockState } from '../mock/map';\nimport type { Mock } from '../mock/mock';\n\n/**\n * Remove any remaining expectations on the given mock.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * reset(fn);\n *\n * fn(); // throws\n */\nexport const reset = (mock: Mock<any>): void => {\n getMockState(mock).repository.clear();\n};\n\n/**\n * Reset all existing mocks.\n *\n * @see reset\n */\nexport const resetAll = (): void => {\n getAllMocks().forEach(([mock]) => {\n reset(mock);\n });\n};\n","import { DIM_COLOR } from 'jest-matcher-utils';\nimport type { Expectation } from '../expectation/expectation';\nimport type { CallMap } from '../expectation/repository/expectation-repository';\nimport { printCall, printRemainingExpectations } from '../print';\n\nexport class UnmetExpectations extends Error {\n constructor(expectations: Expectation[]) {\n super(\n DIM_COLOR(`There are unmet expectations:\n\n - ${expectations.map((e) => e.toString()).join('\\n - ')}`)\n );\n }\n}\n\n/**\n * Merge property accesses and method calls for the same property\n * into a single call.\n *\n * @example\n * mergeCalls({ getData: [{ arguments: undefined }, { arguments: [1, 2, 3] }] }\n * // returns { getData: [{ arguments: [1, 2, 3] } }\n */\nconst mergeCalls = (callMap: CallMap): CallMap =>\n new Map(\n Array.from(callMap.entries()).map(([property, calls]) => {\n const hasMethodCalls = calls.some((call) => call.arguments);\n const hasPropertyAccesses = calls.some((call) => !call.arguments);\n\n if (hasMethodCalls && hasPropertyAccesses) {\n return [property, calls.filter((call) => call.arguments)];\n }\n\n return [property, calls];\n })\n );\n\nexport class UnexpectedCalls extends Error {\n constructor(unexpectedCalls: CallMap, expectations: Expectation[]) {\n const printedCalls = Array.from(mergeCalls(unexpectedCalls).entries())\n .map(([property, calls]) =>\n calls.map((call) => printCall(property, call.arguments)).join('\\n - ')\n )\n .join('\\n - ');\n\n super(\n DIM_COLOR(`The following calls were unexpected:\n\n - ${printedCalls}\n\n${printRemainingExpectations(expectations)}`)\n );\n }\n}\n","import { UnexpectedCalls, UnmetExpectations } from '../errors/verify';\nimport type { ExpectationRepository } from '../expectation/repository/expectation-repository';\nimport { getAllMocks, getMockState } from '../mock/map';\nimport type { Mock } from '../mock/mock';\n\nexport const verifyRepo = (repository: ExpectationRepository) => {\n const unmetExpectations = repository.getUnmet();\n\n if (unmetExpectations.length) {\n throw new UnmetExpectations(unmetExpectations);\n }\n\n const callStats = repository.getCallStats();\n\n if (callStats.unexpected.size) {\n throw new UnexpectedCalls(callStats.unexpected, unmetExpectations);\n }\n};\n\n/**\n * Verify that all expectations on the given mock have been met.\n *\n * @throws Will throw if there are remaining expectations that were set\n * using `when` and that weren't met.\n *\n * @throws Will throw if any unexpected calls happened. Normally those\n * calls throw on their own, but the error might be caught by the code\n * being tested.\n *\n * @example\n * const fn = mock<() => number>();\n *\n * when(() => fn()).thenReturn(23);\n *\n * verify(fn); // throws\n */\nexport const verify = <T>(mock: Mock<T>): void => {\n const { repository } = getMockState(mock);\n\n verifyRepo(repository);\n};\n\n/**\n * Verify all existing mocks.\n *\n * @see verify\n */\nexport const verifyAll = (): void => {\n getAllMocks().forEach(([mock]) => {\n verify(mock);\n });\n};\n","import { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Compare values using `Object.is`.\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n *\n * @see It.deepEquals A matcher that uses deep equality.\n */\nexport const is = <T = unknown>(expected: T): TypeMatcher<T> =>\n matches((actual) => Object.is(actual, expected), {\n toString: () => `${printValue(expected)}`,\n getDiff: (actual) => ({ actual, expected }),\n });\n","import type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any value, including `undefined` and `null`.\n *\n * @example\n * const fn = mock<(x: number, y: string) => number>();\n * when(() => fn(It.isAny(), It.isAny())).thenReturn(1);\n *\n * fn(23, 'foobar') === 1\n */\nexport const isAny = (): TypeMatcher<any> =>\n matches(() => true, {\n toString: () => 'Matcher<any>',\n });\n","import { printValue } from '../print';\nimport { deepEquals } from './deep-equals';\nimport type { TypeMatcher } from './matcher';\nimport { isMatcher, matches } from './matcher';\n\n/**\n * Match an array.\n *\n * Supports nested matchers.\n *\n * @param containing If given, the matched array has to contain ALL of these\n * elements in ANY order.\n *\n * @example\n * const fn = mock<(arr: number[]) => number>();\n * when(() => fn(It.isArray())).thenReturn(1);\n * when(() => fn(It.isArray([2, 3]))).thenReturn(2);\n *\n * fn({ length: 1, 0: 42 }) // throws\n * fn([]) === 1\n * fn([3, 2, 1]) === 2\n *\n * @example\n * It.isArray([It.isString({ containing: 'foobar' })])\n */\nexport const isArray = <T extends unknown[]>(containing?: T): TypeMatcher<T> =>\n matches(\n (actual) => {\n if (!Array.isArray(actual)) {\n return false;\n }\n\n if (!containing) {\n return true;\n }\n\n return containing.every(\n (x) =>\n actual.find((y) => {\n if (isMatcher(x)) {\n return x.matches(y);\n }\n\n return deepEquals(x).matches(y);\n }) !== undefined\n );\n },\n {\n toString: () =>\n containing\n ? `array([${containing.map((v) => printValue(v)).join(', ')}])`\n : 'array',\n getDiff: (actual) => {\n if (containing) {\n return {\n actual,\n expected: `Matcher<array>([${containing\n .map((value) => {\n if (isMatcher(value)) {\n return value.toString();\n }\n\n return value;\n })\n .join(', ')}])`,\n };\n }\n\n return {\n actual: `${printValue(actual)} (${typeof actual})`,\n expected: 'Matcher<array>',\n };\n },\n }\n );\n","import { printValue } from '../print';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any number.\n *\n * @example\n * const fn = mock<(x: number) => number>();\n * when(() => fn(It.isNumber())).returns(42);\n *\n * fn(20.5) === 42\n * fn(NaN) // throws\n */\nexport const isNumber = (): TypeMatcher<number> =>\n matches((actual) => typeof actual === 'number' && !Number.isNaN(actual), {\n toString: () => 'Matcher<number>',\n getDiff: (actual) => ({\n actual: `${printValue(actual)} (${typeof actual})`,\n expected: 'Matcher<number>',\n }),\n });\n","import { isObjectLike, isPlainObject as isPlainObjectLodash } from 'lodash';\nimport { printValue } from '../print';\nimport type { Property } from '../proxy';\nimport type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\ntype ObjectType = Record<Property, unknown>;\n\n/**\n * Matches any plain object e.g. object literals or objects created with `Object.create()`.\n *\n * Classes, arrays, maps, sets etc. are not considered plain objects.\n * You can use {@link containsObject} or {@link matches} to match those.\n *\n * @example\n * const fn = mock<({ foo: string }) => number>();\n * when(() => fn(It.isPlainObject())).thenReturn(42);\n *\n * fn({ foo: 'bar' }) // returns 42\n */\nexport const isPlainObject = <T extends ObjectType>(): TypeMatcher<T> =>\n matches((actual) => isPlainObjectLodash(actual), {\n toString: () => 'Matcher<object>',\n getDiff: (actual) => {\n const type = isObjectLike(actual) ? 'object-like' : typeof actual;\n\n return {\n actual: `${printValue(actual)} (${type})`,\n expected: 'Matcher<object>',\n };\n },\n });\n","import { cloneDeepWith, isPlainObject } from 'lodash';\nimport { printValue } from '../print';\nimport type { Property } from '../proxy';\nimport { deepEquals } from './deep-equals';\nimport { isArray } from './is-array';\nimport type { TypeMatcher } from './matcher';\nimport { isMatcher, matches } from './matcher';\n\ntype ObjectType = Record<Property, unknown>;\ntype NonEmptyObject<T extends ObjectType> = keyof T extends never ? never : T;\n\ntype DeepPartial<T> = T extends ObjectType\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\nconst looksLikeObject = (value: unknown): value is ObjectType =>\n isPlainObject(value);\n\nconst getExpectedObjectDiff = (actual: unknown, expected: unknown): object =>\n Object.fromEntries(\n getKeys(expected).map((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return [key, expectedValue.getDiff(actualValue).expected];\n }\n\n if (looksLikeObject(expectedValue)) {\n return [key, getExpectedObjectDiff(actualValue, expectedValue)];\n }\n\n return [key, expectedValue];\n })\n );\n\nconst getActualObjectDiff = (actual: unknown, expected: unknown): unknown => {\n const actualKeys = getKeys(actual);\n const expectedKeys = new Set(getKeys(expected));\n const commonKeys = actualKeys.filter((key) => expectedKeys.has(key));\n\n if (!commonKeys.length) {\n // When we don't have any common keys we return the whole object\n // so the user can inspect what's in there.\n return actual;\n }\n\n return Object.fromEntries(\n commonKeys.map((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return [key, expectedValue.getDiff(actualValue).actual];\n }\n\n if (looksLikeObject(expectedValue)) {\n return [key, getActualObjectDiff(actualValue, expectedValue)];\n }\n\n return [key, actualValue];\n })\n );\n};\n\nconst getKeys = (value: unknown): Property[] => {\n if (typeof value === 'object' && value !== null) {\n return Reflect.ownKeys(value);\n }\n\n return [];\n};\n\nconst getKey = (value: unknown, key: Property): unknown =>\n // @ts-expect-error because we're fine with a runtime undefined value\n value?.[key];\n\nconst isMatch = (actual: unknown, expected: unknown): boolean => {\n const actualKeys = getKeys(actual);\n const expectedKeys = getKeys(expected);\n\n if (!isArray(expectedKeys).matches(actualKeys)) {\n return false;\n }\n\n return expectedKeys.every((key) => {\n const expectedValue = getKey(expected, key);\n const actualValue = getKey(actual, key);\n\n if (isMatcher(expectedValue)) {\n return expectedValue.matches(actualValue);\n }\n\n if (looksLikeObject(expectedValue)) {\n return isMatch(actualValue, expectedValue);\n }\n\n return deepEquals(expectedValue).matches(actualValue);\n });\n};\n\nconst deepPrintObject = (value: unknown) =>\n cloneDeepWith(value, (value) => {\n if (isMatcher(value)) {\n return value.toString();\n }\n\n return undefined;\n });\n\n/**\n * Check if an object recursively contains the expected properties,\n * i.e. the expected object is a subset of the received object.\n *\n * @param partial A subset of the expected object that will be recursively matched.\n * Supports nested matchers.\n * Concrete values will be compared with {@link deepEquals}.\n *\n * @see {@link isPlainObject} if you want to match any plain object.\n *\n * @example\n * const fn = mock<(pos: { x: number, y: number }) => number>();\n * when(() => fn(It.containsObject({ x: 23 }))).returns(42);\n *\n * fn({ x: 23, y: 200 }) // returns 42\n *\n * @example\n * It.containsObject({ foo: It.isString() })\n */\n// T is not constrained to ObjectType because of\n// https://github.com/microsoft/TypeScript/issues/57810,\n// but K is to avoid inferring non-object partials\nexport const containsObject = <T, K extends DeepPartial<T>>(\n partial: K extends ObjectType ? NonEmptyObject<K> : never\n): TypeMatcher<T> =>\n matches((actual) => isMatch(actual, partial), {\n toString: () => `Matcher<object>(${printValue(deepPrintObject(partial))})`,\n getDiff: (actual) => ({\n actual: getActualObjectDiff(actual, partial),\n expected: getExpectedObjectDiff(actual, partial),\n }),\n });\n","import type { TypeMatcher } from './matcher';\nimport { matches } from './matcher';\n\n/**\n * Match any string.\n *\n * @param matching An optional string or RegExp to match the string against.\n * If it's a string, a case-sensitive search will be performed.\n *\n * @example\n * const fn = mock<(x: string, y: string) => number>();\n * when(() => fn(It.isString(), It.isString('bar'))).returns(42);\n *\n * fn('foo', 'baz') // throws\n * fn('foo', 'bar') === 42\n */\nexport const isString = (matching?: string | RegExp): TypeMatcher<string> =>\n matches(\n (actual) => {\n if (typeof actual !== 'string') {\n return false;\n }\n\n if (!matching) {\n return true;\n }\n\n if (typeof matching === 'string') {\n return actual.indexOf(matching) !== -1;\n }\n\n return matching.test(actual);\n },\n {\n toString: () => {\n if (matching) {\n return `Matcher<string>(${matching})`;\n }\n\n return 'Matcher<string>';\n },\n getDiff: (actual) => {\n if (matching) {\n return {\n expected: `Matcher<string>(${matching})`,\n actual,\n };\n }\n\n return {\n expected: 'Matcher<string>',\n actual: `${actual} (${typeof actual})`,\n };\n },\n }\n );\n","import type { Matcher, TypeMatcher } from './matcher';\nimport { MATCHER_SYMBOL } from './matcher';\n\n/**\n * Matches anything and stores the received value.\n *\n * This should not be needed for most cases, but can be useful if you need\n * access to a complex argument outside the expectation e.g. to test a\n * callback.\n *\n * @param name If given, this name will be printed in error messages.\n *\n * @example\n * const fn = mock<(cb: (value: number) => number) => void>();\n * const matcher = It.willCapture();\n * when(() => fn(matcher)).thenReturn();\n *\n * fn(x => x + 1);\n * matcher.value?.(3) === 4\n */\nexport const willCapture = <T = unknown>(\n name?: string\n): TypeMatcher<T> & {\n value: T | undefined;\n} => {\n let capturedValue: T | undefined;\n\n const matcher: Matcher & {\n value: T | undefined;\n } = {\n [MATCHER_SYMBOL]: true,\n matches: (actual) => {\n capturedValue = actual;\n\n return true;\n },\n toString: () => (name ? `Capture(${name})` : 'Capture'),\n getDiff: (actual) => ({\n actual,\n expected: actual,\n }),\n get value(): T | undefined {\n return capturedValue;\n },\n };\n\n return matcher as any;\n};\n","/* istanbul ignore file */\nexport { deepEquals } from './deep-equals';\n\nexport { is } from './is';\n\nexport { isAny } from './is-any';\n\nexport { isArray } from './is-array';\n\nexport { isNumber } from './is-number';\n\nexport { isPlainObject } from './is-plain-object';\n\nexport { containsObject } from './contains-object';\n\nexport { isString } from './is-string';\n\nexport { matches } from './matcher';\n\nexport { willCapture } from './will-capture';\n"],"names":["ApplyProp","Symbol","MATCHER_SYMBOL","isMatcher","f","getMatcherDiffs","matchers","args","matcherDiffs","map","matcher","i","getDiff","actual","d","expected","matches","predicate","options","_options$toString","_options$getDiff","toString","printProperty","property","printValue","arg","stringify","printArgs","join","printCall","prettyProperty","prettyArgs","RECEIVED_COLOR","printReturns","isError","isPromise","value","min","max","thenPrefix","printWhen","EXPECTED_COLOR","printExpectation","returnValue","printRemainingExpectations","expectations","length","e","UnexpectedAccess","Error","constructor","DIM_COLOR","noColor","s","printArgsDiff","diff","printDiff","omitAnnotationLines","aColor","bColor","changeColor","commonColor","patchColor","diffLines","split","relevantDiffLines","slice","lastLine","coloredDiffLines","line","first","charAt","printExpectationDiff","_e$args","printDiffForAllExpectations","undefined","filter","x","UnexpectedCall","header","propertyExpectations","_propertyExpectations","matcherResult","UnexpectedProperty","unboxReturnValue","Promise","reject","resolve","FlexibleRepository","unexpectedProperty","THROW","Map","expectedCallStats","unexpectedCallStats","apply","get","handlePropertyWithMatchingExpectations","recordExpected","propertyExpectation","find","expectation","countAndConsume","callExpectation","getValueForUnexpectedCall","handlePropertyWithNoExpectations","toStringTag","getValueForUnexpectedAccess","add","set","matchCount","clear","getAllProperties","Array","from","keys","getCallStats","unexpected","getUnmet","concat","values","calls","arguments","recordUnexpected","consumeExpectation","StrongExpectation","exactParams","matched","setInvocationCount","matchesArgs","isUnmet","received","every","UnfinishedExpectation","MissingWhen","NotAMock","NestedWhen","parentProp","childProp","snippet","ExpectationBuilderWithFactory","createExpectation","concreteMatcher","setProperty","setArgs","finish","removeUndefined","object","isArray","isObjectLike","omitBy","isUndefined","deepEquals","strict","isEqual","defaults","CALL_THROW","currentDefaults","setDefaults","newDefaults","activeMock","setActiveMock","mock","getActiveMock","mockMap","getMockState","has","setMockState","state","getAllMocks","entries","Mode","currentMode","CALL","setMode","mode","getMode","createProxy","traps","Proxy","target","prop","thisArg","moreArgs","ownKeys","getOwnPropertyDescriptor","includes","configurable","enumerable","createStub","repo","builder","getCurrentMode","stub","strongExpectationFactory","repository","createInvocationCount","between","times","exact","anyTimes","atLeast","Infinity","atMost","once","twice","finishExpectation","finishedExpectation","getError","errorOrMessage","createReturns","thenReturn","thenThrow","thenResolve","promiseValue","thenReject","when","EXPECT","reset","resetAll","forEach","UnmetExpectations","mergeCalls","callMap","hasMethodCalls","some","call","hasPropertyAccesses","UnexpectedCalls","unexpectedCalls","printedCalls","verifyRepo","unmetExpectations","callStats","size","verify","verifyAll","is","Object","isAny","containing","y","v","isNumber","Number","isNaN","isPlainObject","isPlainObjectLodash","type","looksLikeObject","getExpectedObjectDiff","fromEntries","getKeys","key","expectedValue","getKey","actualValue","getActualObjectDiff","actualKeys","expectedKeys","Set","commonKeys","Reflect","isMatch","deepPrintObject","cloneDeepWith","containsObject","partial","isString","matching","indexOf","test","willCapture","name","capturedValue"],"mappings":";;;;AAgCA;;AAEG;AACI,MAAMA,SAAS,GAAGC,MAAM,CAAC,OAAO,CAAC;;ACnCjC,MAAMC,cAAc,GAAGD,MAAM,CAAC,SAAS,CAAC,CAAA;AAkE/C;;AAEG;AACG,SAAUE,SAASA,CAACC,CAAU,EAAA;EAClC,OAAO,CAAC,EAAEA,CAAC,IAAcA,CAAE,CAACF,cAAc,CAAC,CAAC,CAAA;AAC9C,CAAA;AAEO,MAAMG,eAAe,GAAGA,CAC7BC,QAAmB,EACnBC,IAAe,KAC+B;EAC9C,MAAMC,YAAY,GAAGF,QAAQ,CAACG,GAAG,CAAC,CAACC,OAAO,EAAEC,CAAC,KAAKD,OAAO,CAACE,OAAO,CAACL,IAAI,CAACI,CAAC,CAAC,CAAC,CAAC,CAAA;EAC3E,MAAME,MAAM,GAAGL,YAAY,CAACC,GAAG,CAAEK,CAAC,IAAKA,CAAC,CAACD,MAAM,CAAC,CAAA;EAChD,MAAME,QAAQ,GAAGP,YAAY,CAACC,GAAG,CAAEK,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAAC,CAAA;EAEpD,OAAO;IAAEF,MAAM;AAAEE,IAAAA,QAAAA;GAAU,CAAA;AAC7B,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;AAqBG;AACI,MAAMC,OAAO,GAAGA,CACrBC,SAAiC,EACjCC,OAAiC,KACf;EAAA,IAAAC,iBAAA,EAAAC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A,CAAA,GAAG,SAAU;IACvDpQ,OAAO,EAAGC,MAAM,KAAM;MACpBA,MAAM;AACNE,MAAAA,QAAQ,EAAEF,MAAAA;KACX,CAAC;IACF,IAAIuB,KAAKA,GAAA;AACP,MAAA,OAAO6O,aAAa,CAAA;AACtB,KAAA;GACD,CAAA;AAED,EAAA,OAAOvQ,OAAc,CAAA;AACvB,CAAC;;AC/CD;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/mock/mock.d.ts
CHANGED
package/dist/mock/stub.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExpectationRepository } from '../expectation/repository/expectation-repository';
|
|
2
2
|
import type { ExpectationBuilder } from '../when/expectation-builder';
|
|
3
3
|
import type { Mock } from './mock';
|
|
4
|
-
import { Mode } from './
|
|
4
|
+
import { Mode } from './mode';
|
|
5
5
|
export declare const createStub: <T>(repo: ExpectationRepository, builder: ExpectationBuilder, getCurrentMode: () => Mode) => Mock<T>;
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strong-mock",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Type safe mocking library for TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tdd",
|
|
7
7
|
"test",
|
|
8
8
|
"mock",
|
|
9
|
-
"expectation",
|
|
10
9
|
"stub",
|
|
10
|
+
"fake",
|
|
11
|
+
"test double",
|
|
12
|
+
"expectation",
|
|
11
13
|
"interface",
|
|
12
14
|
"type",
|
|
13
|
-
"typescript"
|
|
15
|
+
"typescript",
|
|
16
|
+
"ts",
|
|
17
|
+
"diff",
|
|
18
|
+
"matcher"
|
|
14
19
|
],
|
|
15
20
|
"repository": {
|
|
16
21
|
"type": "git",
|
|
@@ -24,26 +29,26 @@
|
|
|
24
29
|
"dist"
|
|
25
30
|
],
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"jest-diff": "~29.
|
|
32
|
+
"jest-diff": "~29.7.0",
|
|
28
33
|
"jest-matcher-utils": "~29.7.0",
|
|
29
|
-
"lodash": "~4.17.0"
|
|
30
|
-
"strip-ansi": "~6.0.0"
|
|
34
|
+
"lodash": "~4.17.0"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
37
|
"@nighttrax/eslint-config-ts": "~12.0.0-alpha.0",
|
|
34
38
|
"@tdd-buffet/jest-config": "~6.0.0",
|
|
35
39
|
"@tdd-buffet/tsconfig": "~1.0.5",
|
|
36
40
|
"@types/jest": "~29.5.0",
|
|
37
|
-
"@types/node": "~
|
|
41
|
+
"@types/node": "~22.9.0",
|
|
38
42
|
"@types/lodash": "~4.17.0",
|
|
39
43
|
"doctoc": "~2.2.0",
|
|
40
44
|
"eslint": "~8.57.0",
|
|
41
45
|
"jest": "~29.7.0",
|
|
42
46
|
"microbundle": "~0.15.0",
|
|
43
47
|
"standard-version": "~9.5.0",
|
|
48
|
+
"strip-ansi": "~6.0.0",
|
|
44
49
|
"strong-mock": "~6.0.0",
|
|
45
|
-
"tslib": "~2.
|
|
46
|
-
"typescript": "~5.
|
|
50
|
+
"tslib": "~2.8.0",
|
|
51
|
+
"typescript": "~5.6.0"
|
|
47
52
|
},
|
|
48
53
|
"scripts": {
|
|
49
54
|
"docs": "doctoc --title '**Table of Contents**' README.md",
|