Skip to content

Latest commit

 

History

History
270 lines (155 loc) · 14 KB

CHANGELOG.md

File metadata and controls

270 lines (155 loc) · 14 KB

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

8.0.1 (2023-01-18)

Bug Fixes

  • Allow mocks to be inside Promises (3144722), closes #321
  • deps: update dependency jest-matcher-utils to ~29.3.0 (929d16e)

8.0.0 (2022-10-02)

This is a major release with many new features, some breaking changes, and a lot of changes under the hood. See the migration guide.

⚠ BREAKING CHANGES

  • You no longer have to remember to call instance before passing the mock to the code under test, because we removed it! The object returned by mock() can now be passed directly to your code.
  • Expectations now have to be wrapped in a callback inside when. This change is necessary to remove the instance function.
  • The default matcher option previously available only in setDefaults has been renamed to concreteMatcher.
  • The default behavior now avoids immediately throwing on unexpected property access. This should lead to improved error messages, and less breaking on common code patterns e.g. destructuring. You can configure this with the unexpectedProperty option.
  • You can no longer pass a custom expectation repository or a custom expectation factory to the mock() function. These options weren't documented very well and just bloated the API.

Features

  • Add exactParams option (31acbbe)
  • Add unexpectedProperty option
  • Allow concrete matcher to be configured for each mock (32c82ba)

Bug Fixes

  • Don't treat any returns as promises (9304492)

8.0.0-beta.2 (2022-09-26)

⚠ BREAKING CHANGES

  • The strictness option has been renamed to unexpectedProperty to better illustrate its intent.

Features

Bug Fixes

  • deps: update dependency jest-matcher-utils to v28 (33fe92a)

  • Don't treat any returns as promises (9304492)

  • Rename option (db9cc06)

8.0.0-beta.1 (2022-08-18)

⚠ BREAKING CHANGES

  • The default matcher option previously available only in setDefaults has been renamed to concreteMatcher.
  • The default strictness now avoids immediately throwing on unexpected property access. This should lead to improved error messages, and less breaking on common code patterns e.g. destructuring.

If you want the old behavior use:

import { setDefaults, Strictness } from 'strong-mock';

setDefaults({ strictness: Strictness.SUPER_STRICT });
  • You can no longer pass a custom expectation repository or a custom expectation factory to the mock() function. These options weren't documented very well and just bloated the API.

Features

  • verify and verifyAll now respect the strictness option (c93c7be)
  • Add strictness option to improve unexpected call errors (71bb975)
  • Allow concrete matcher to be configured for each mock (32c82ba)
  • Allow strictness to be configured for each mock (c34bacc)
  • Control mock strictness through setDefaults (6590713)

Bug Fixes

  • Don't record property call stats for function calls (de204a5)

  • Print callback syntax in expectation error message (0bf9633)

  • Remove mock options (8bf2d2d)

8.0.0-beta.0 (2022-07-15)

⚠ BREAKING CHANGES

  • You no longer have to remember to call instance before passing the mock to the code under test, because we removed it! The object returned by mock() can now be passed directly to your code.
  • Expectations now have to be wrapped in a callback inside when. This change is necessary to remove the instance function. Before: when(foo.bar()). After: when(() => foo.bar()).

Bug Fixes

  • deps: update dependency jest-matcher-utils to ~27.3.0 (a287174)

  • deps: update dependency jest-matcher-utils to ~27.4.0 (133a17d)

  • Remove instance (dc2338d)

  • Require callback when setting expectations (b0e46f4)

7.3.0 (2021-09-26)

Features

Bug Fixes

  • deps: update dependency jest-matcher-utils to ~27.2.0 (8a68c86)

7.2.1 (2021-09-08)

Bug Fixes

  • Make instance referentially stable (4194526)

7.2.0 (2021-09-06)

Features

7.1.2 (2021-08-28)

Bug Fixes

  • Allow other strong mocks in expectations (569815b), closes #254 #256
  • deps: update dependency jest-matcher-utils to ~27.1.0 (b024ed0)

7.1.1 (2021-08-26)

7.1.0 (2021-06-24)

Features

  • thenReject now lazily creates promise rejection (01c9995), closes #238

Bug Fixes

  • Correctly throw error values from method expectations (a1ad324)

7.0.0 (2021-06-17)

⚠ BREAKING CHANGES

  • Node 10 is no longer supported.

Features

  • Allow mock instances to be enumerable (850223c), closes #235
  • Print promise values in error messages (bc0301f)

Bug Fixes

  • deps: update dependency jest-matcher-utils to ~26.2.0 (52e9740)
  • deps: update dependency jest-matcher-utils to ~26.3.0 (b7f483b)
  • deps: update dependency jest-matcher-utils to ~26.4.0 (3fe4f66)
  • deps: update dependency jest-matcher-utils to ~26.5.0 (b496bcf)
  • deps: update dependency jest-matcher-utils to ~26.6.0 (7e25d8c)
  • deps: update dependency jest-matcher-utils to v27 (ed3740b)
  • deps: update dependency lodash to ~4.17.0 (8c192bc)

build

6.0.0 (2020-06-27)

⚠ BREAKING CHANGES

  • Rename isObjectContaining to isObject

Features

  • Add isNumber matcher (cc5b0a8)
  • Add isString (6d5980f)
  • Add It.isArray (2359b43)
  • Add verifyAll and resetAll (eef45e0)
  • Improve error message when setting expectation on nested property (f1ebabe)
  • Make matching any object easier (6011775)
  • Support nested matchers (c3157b1)

Bug Fixes

  • deps: update dependency jest-matcher-utils to ~26.1.0 (7884b7d)
  • Make isNumber pretty print consistently with other matchers (bc5f4f8)
  • Make isString pretty print consistently with other matchers (3b6d9e8)
  • Make mocks pretty-format-able (73200db)

5.0.1 (2020-05-07)

Bug Fixes

  • Clear unexpected calls on reset() (04493f7)

5.0.0 (2020-05-07)

Features

  • Improve error message for UnexpectedCalls (ff8636c)

5.0.0-beta.1 (2020-05-05)

Bug Fixes

  • Don't mark toString accesses as unexpected (20247b6)

5.0.0-beta.0 (2020-05-05)

⚠ BREAKING CHANGES

  • verify used to rely on unexpected calls throwing when they were made. However, the code under test could try..catch that error and never bubble it up to the test. Unless the test explicitly checked that the SUT was not in an error state, verify would have not been enough to make sure that everything was correct. Now it throws if any unexpected calls happened.

Features

  • Record unexpected calls (a87f612)
  • Throw on unexpected calls when verifying mock (f68e2f2)

Bug Fixes

  • deps: update dependency jest-matcher-utils to v26 (5ae654d)