diff --git a/README.md b/README.md index 02771f1..b29fca0 100644 --- a/README.md +++ b/README.md @@ -484,8 +484,8 @@ debug(coolFunc) // `coolFunc()` has: // // 2 stubbings with 0 calls -// - 0 calls: `coolFunc(4, 5, 6) => { throw [Error: oh no] }` // - 0 calls: `coolFunc(1, 2, 3) => 123` +// - 0 calls: `coolFunc(4, 5, 6) => { throw [Error: oh no] }` // // 1 unmatched call // - `coolFunc(1, 2, 4)` diff --git a/src/debug.ts b/src/debug.ts index 4581259..fa407c0 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -52,7 +52,9 @@ export const formatDebug = (debug: DebugResult): string => { 'stubbing', stubbingCount, )} with ${callCount} calls`, - ...stubbings.map((stubbing) => `- ${formatStubbing(name, stubbing)}`), + ...stubbings + .map((stubbing) => `- ${formatStubbing(name, stubbing)}`) + .reverse(), '', `${unmatchedCallsCount} unmatched ${plural('call', unmatchedCallsCount)}`, ...unmatchedCalls.map((args) => `- \`${formatCall(name, args)}\``), diff --git a/test/vitest-when.test.ts b/test/vitest-when.test.ts index 51022a1..cf1cd60 100644 --- a/test/vitest-when.test.ts +++ b/test/vitest-when.test.ts @@ -349,15 +349,4 @@ describe('vitest-when', () => { unmatchedCalls: [], }) }) - - it('logs debug description', () => { - const coolFunction = vi.fn().mockName('coolFunc') - - subject.when(coolFunction).calledWith(1, 2, 3).thenReturn(123) - subject.when(coolFunction).calledWith(4, 5, 6).thenThrow(new Error('oh no')) - - coolFunction(1, 2, 4) - - subject.debug(coolFunction) - }) })