diff --git a/README.md b/README.md index 90d791a..cb40041 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ export const calculateQuestion = async (answer: number): Promise => { ## API -### `when(spy: TFunc): StubWrapper` +### `when(spy: TFunc, options?: WhenOptions): StubWrapper` Configures a `vi.fn()` mock function to act as a vitest-when stub. Adds an implementation to the function that initially no-ops, and returns an API to configure behaviors for given arguments using [`.calledWith(...)`][called-with] @@ -199,6 +199,16 @@ when(spy) expect(spy()).toBe(undefined) ``` +#### Options + +```ts +import type { WhenOptions } from 'vitest-when' +``` + +| option | required | type | description | +| ------- | -------- | ------- | -------------------------------------------------- | +| `times` | no | integer | Only trigger configured behavior a number of times | + ### `.calledWith(...args: TArgs): Stub` Create a stub that matches a given set of arguments which you can configure with different behaviors using methods like [`.thenReturn(...)`][then-return]. @@ -266,20 +276,20 @@ when(spy).calledWith('hello').thenReturn('world') expect(spy('hello')).toEqual('world') ``` -To only return a value once, use the `ONCE` option. +To only return a value once, use the `times` option. ```ts -import { ONCE, when } from 'vitest-when' +import { when } from 'vitest-when' const spy = vi.fn() -when(spy).calledWith('hello').thenReturn('world', ONCE) +when(spy, { times: 1 }).calledWith('hello').thenReturn('world') expect(spy('hello')).toEqual('world') expect(spy('hello')).toEqual(undefined) ``` -You may pass several values to `thenReturn` to return different values in succession. The last value will be latched, unless you pass the `ONCE` option. +You may pass several values to `thenReturn` to return different values in succession. If you do not specify `times`, the last value will be latched. Otherwise, each value will be returned the specified number of times. ```ts const spy = vi.fn() @@ -303,20 +313,20 @@ when(spy).calledWith('hello').thenResolve('world') expect(await spy('hello')).toEqual('world') ``` -To only resolve a value once, use the `ONCE` option. +To only resolve a value once, use the `times` option. ```ts -import { ONCE, when } from 'vitest-when' +import { when } from 'vitest-when' const spy = vi.fn() -when(spy).calledWith('hello').thenResolve('world', ONCE) +when(spy, { times: 1 }).calledWith('hello').thenResolve('world') expect(await spy('hello')).toEqual('world') expect(spy('hello')).toEqual(undefined) ``` -You may pass several values to `thenResolve` to resolve different values in succession. The last value will be latched, unless you pass the `ONCE` option. +You may pass several values to `thenResolve` to resolve different values in succession. If you do not specify `times`, the last value will be latched. Otherwise, each value will be resolved the specified number of times. ```ts const spy = vi.fn() @@ -340,20 +350,20 @@ when(spy).calledWith('hello').thenThrow(new Error('oh no')) expect(() => spy('hello')).toThrow('oh no') ``` -To only throw an error only once, use the `ONCE` option. +To only throw an error only once, use the `times` option. ```ts -import { ONCE, when } from 'vitest-when' +import { when } from 'vitest-when' const spy = vi.fn() -when(spy).calledWith('hello').thenThrow(new Error('oh no'), ONCE) +when(spy, { times: 1 }).calledWith('hello').thenThrow(new Error('oh no')) expect(() => spy('hello')).toThrow('oh no') expect(spy('hello')).toEqual(undefined) ``` -You may pass several values to `thenThrow` to throw different errors in succession. The last value will be latched, unless you pass the `ONCE` option. +You may pass several values to `thenThrow` to throw different errors in succession. If you do not specify `times`, the last value will be latched. Otherwise, each error will be thrown the specified number of times. ```ts const spy = vi.fn() @@ -379,20 +389,20 @@ when(spy).calledWith('hello').thenReject(new Error('oh no')) await expect(spy('hello')).rejects.toThrow('oh no') ``` -To only throw an error only once, use the `ONCE` option. +To only throw an error only once, use the `times` option. ```ts -import { ONCE, when } from 'vitest-when' +import { times, when } from 'vitest-when' const spy = vi.fn() -when(spy).calledWith('hello').thenReject(new Error('oh no'), ONCE) +when(spy, { times: 1 }).calledWith('hello').thenReject(new Error('oh no')) await expect(spy('hello')).rejects.toThrow('oh no') expect(spy('hello')).toEqual(undefined) ``` -You may pass several values to `thenReject` to throw different errors in succession. The last value will be latched, unless you pass the `ONCE` option. +You may pass several values to `thenReject` to throw different errors in succession. If you do not specify `times`, the last value will be latched. Otherwise, each rejection will be triggered the specified number of times. ```ts const spy = vi.fn() @@ -425,22 +435,22 @@ expect(spy('hello')).toEqual('world') expect(called).toEqual(true) ``` -To only run the callback once, use the `ONCE` option. +To only run the callback once, use the `times` option. ```ts -import { ONCE, when } from 'vitest-when' +import { times, when } from 'vitest-when' const spy = vi.fn() -when(spy) +when(spy, { times: 1 }) .calledWith('hello') - .thenDo(() => 'world', ONCE) + .thenDo(() => 'world') expect(spy('hello')).toEqual('world') expect(spy('hello')).toEqual(undefined) ``` -You may pass several callbacks to `thenDo` to trigger different side-effects in succession. The last callback will be latched, unless you pass the `ONCE` option. +You may pass several callbacks to `thenDo` to trigger different side-effects in succession. If you do not specify `times`, the last callback will be latched. Otherwise, each callback will be triggered the specified number of times. ```ts const spy = vi.fn() diff --git a/package.json b/package.json index 3f5dfeb..4c39a3d 100644 --- a/package.json +++ b/package.json @@ -53,20 +53,20 @@ "@mcous/eslint-config": "0.4.2", "@mcous/prettier-config": "0.3.0", "@mcous/typescript-config": "0.2.1", - "@typescript-eslint/eslint-plugin": "6.13.1", - "@typescript-eslint/parser": "6.13.1", - "@vitest/coverage-istanbul": "^1.0.0-beta.6", - "@vitest/expect": "^1.0.0-beta.6", + "@typescript-eslint/eslint-plugin": "6.13.2", + "@typescript-eslint/parser": "6.13.2", + "@vitest/coverage-istanbul": "^1.0.1", + "@vitest/expect": "^1.0.1", "concurrently": "^8.2.2", - "eslint": "8.54.0", - "eslint-config-prettier": "9.0.0", + "eslint": "8.55.0", + "eslint-config-prettier": "9.1.0", "eslint-plugin-promise": "6.1.1", "eslint-plugin-sonarjs": "0.23.0", "eslint-plugin-unicorn": "49.0.0", "prettier": "3.1.0", "tsup": "^8.0.1", "typescript": "5.3.2", - "vitest": "^1.0.0-beta.6" + "vitest": "^1.0.1" }, "peerDependencies": { "@vitest/expect": ">=0.31.0 <2.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32357c3..8acea2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,7 +7,7 @@ settings: devDependencies: '@mcous/eslint-config': specifier: 0.4.2 - version: 0.4.2(@typescript-eslint/eslint-plugin@6.13.1)(@typescript-eslint/parser@6.13.1)(eslint-config-prettier@9.0.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-sonarjs@0.23.0)(eslint-plugin-unicorn@49.0.0)(eslint-plugin-vitest@0.3.10)(eslint@8.54.0) + version: 0.4.2(@typescript-eslint/eslint-plugin@6.13.2)(@typescript-eslint/parser@6.13.2)(eslint-config-prettier@9.1.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-sonarjs@0.23.0)(eslint-plugin-unicorn@49.0.0)(eslint-plugin-vitest@0.3.10)(eslint@8.55.0) '@mcous/prettier-config': specifier: 0.3.0 version: 0.3.0(prettier@3.1.0) @@ -15,35 +15,35 @@ devDependencies: specifier: 0.2.1 version: 0.2.1(typescript@5.3.2) '@typescript-eslint/eslint-plugin': - specifier: 6.13.1 - version: 6.13.1(@typescript-eslint/parser@6.13.1)(eslint@8.54.0)(typescript@5.3.2) + specifier: 6.13.2 + version: 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.2) '@typescript-eslint/parser': - specifier: 6.13.1 - version: 6.13.1(eslint@8.54.0)(typescript@5.3.2) + specifier: 6.13.2 + version: 6.13.2(eslint@8.55.0)(typescript@5.3.2) '@vitest/coverage-istanbul': - specifier: ^1.0.0-beta.6 - version: 1.0.0-beta.6(vitest@1.0.0-beta.6) + specifier: ^1.0.1 + version: 1.0.1(vitest@1.0.1) '@vitest/expect': - specifier: ^1.0.0-beta.6 - version: 1.0.0-beta.6 + specifier: ^1.0.1 + version: 1.0.1 concurrently: specifier: ^8.2.2 version: 8.2.2 eslint: - specifier: 8.54.0 - version: 8.54.0 + specifier: 8.55.0 + version: 8.55.0 eslint-config-prettier: - specifier: 9.0.0 - version: 9.0.0(eslint@8.54.0) + specifier: 9.1.0 + version: 9.1.0(eslint@8.55.0) eslint-plugin-promise: specifier: 6.1.1 - version: 6.1.1(eslint@8.54.0) + version: 6.1.1(eslint@8.55.0) eslint-plugin-sonarjs: specifier: 0.23.0 - version: 0.23.0(eslint@8.54.0) + version: 0.23.0(eslint@8.55.0) eslint-plugin-unicorn: specifier: 49.0.0 - version: 49.0.0(eslint@8.54.0) + version: 49.0.0(eslint@8.55.0) prettier: specifier: 3.1.0 version: 3.1.0 @@ -54,8 +54,8 @@ devDependencies: specifier: 5.3.2 version: 5.3.2 vitest: - specifier: ^1.0.0-beta.6 - version: 1.0.0-beta.6 + specifier: ^1.0.1 + version: 1.0.1 packages: @@ -69,7 +69,7 @@ packages: engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.18 + '@jridgewell/trace-mapping': 0.3.20 dev: true /@babel/code-frame@7.22.13: @@ -80,113 +80,116 @@ packages: chalk: 2.4.2 dev: true - /@babel/compat-data@7.21.7: - resolution: {integrity: sha512-KYMqFYTaenzMK4yUtf4EW9wc4N9ef80FsbMtkwool5zpwl4YrT1SdWYSTRcT94KO4hannogdS+LxY7L+arP3gA==} + /@babel/code-frame@7.23.5: + resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.23.4 + chalk: 2.4.2 dev: true - /@babel/core@7.21.8: - resolution: {integrity: sha512-YeM22Sondbo523Sz0+CirSPnbj9bG3P0CdHcBZdqUuaeOaYEFbOLoGU7lebvGP6P5J/WE9wOn7u7C4J9HvS1xQ==} + /@babel/compat-data@7.23.5: + resolution: {integrity: sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/core@7.23.5: + resolution: {integrity: sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.1 - '@babel/code-frame': 7.22.13 - '@babel/generator': 7.21.5 - '@babel/helper-compilation-targets': 7.21.5(@babel/core@7.21.8) - '@babel/helper-module-transforms': 7.21.5 - '@babel/helpers': 7.21.5 - '@babel/parser': 7.23.4 - '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 - '@babel/types': 7.23.4 - convert-source-map: 1.9.0 + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.5 + '@babel/helper-compilation-targets': 7.22.15 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.5) + '@babel/helpers': 7.23.5 + '@babel/parser': 7.23.5 + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.5 + '@babel/types': 7.23.5 + convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 json5: 2.2.3 - semver: 6.3.0 + semver: 6.3.1 transitivePeerDependencies: - supports-color dev: true - /@babel/generator@7.21.5: - resolution: {integrity: sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w==} + /@babel/generator@7.23.5: + resolution: {integrity: sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.18 + '@jridgewell/trace-mapping': 0.3.20 jsesc: 2.5.2 dev: true - /@babel/helper-compilation-targets@7.21.5(@babel/core@7.21.8): - resolution: {integrity: sha512-1RkbFGUKex4lvsB9yhIfWltJM5cZKUftB2eNajaDv3dCMEp49iBG0K14uH8NnX9IPux2+mK7JGEOB0jn48/J6w==} + /@babel/helper-compilation-targets@7.22.15: + resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 dependencies: - '@babel/compat-data': 7.21.7 - '@babel/core': 7.21.8 - '@babel/helper-validator-option': 7.21.0 - browserslist: 4.21.5 + '@babel/compat-data': 7.23.5 + '@babel/helper-validator-option': 7.23.5 + browserslist: 4.22.2 lru-cache: 5.1.1 - semver: 6.3.0 + semver: 6.3.1 dev: true - /@babel/helper-environment-visitor@7.21.5: - resolution: {integrity: sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ==} + /@babel/helper-environment-visitor@7.22.20: + resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} engines: {node: '>=6.9.0'} dev: true - /@babel/helper-function-name@7.21.0: - resolution: {integrity: sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==} + /@babel/helper-function-name@7.23.0: + resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.20.7 - '@babel/types': 7.23.4 + '@babel/template': 7.22.15 + '@babel/types': 7.23.5 dev: true - /@babel/helper-hoist-variables@7.18.6: - resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==} + /@babel/helper-hoist-variables@7.22.5: + resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 dev: true - /@babel/helper-module-imports@7.21.4: - resolution: {integrity: sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==} + /@babel/helper-module-imports@7.22.15: + resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 dev: true - /@babel/helper-module-transforms@7.21.5: - resolution: {integrity: sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw==} + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.5): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 dependencies: - '@babel/helper-environment-visitor': 7.21.5 - '@babel/helper-module-imports': 7.21.4 - '@babel/helper-simple-access': 7.21.5 - '@babel/helper-split-export-declaration': 7.18.6 + '@babel/core': 7.23.5 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-module-imports': 7.22.15 + '@babel/helper-simple-access': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 '@babel/helper-validator-identifier': 7.22.20 - '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 - '@babel/types': 7.23.4 - transitivePeerDependencies: - - supports-color dev: true - /@babel/helper-simple-access@7.21.5: - resolution: {integrity: sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg==} + /@babel/helper-simple-access@7.22.5: + resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 dev: true - /@babel/helper-split-export-declaration@7.18.6: - resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==} + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 dev: true /@babel/helper-string-parser@7.23.4: @@ -199,18 +202,18 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/helper-validator-option@7.21.0: - resolution: {integrity: sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==} + /@babel/helper-validator-option@7.23.5: + resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} engines: {node: '>=6.9.0'} dev: true - /@babel/helpers@7.21.5: - resolution: {integrity: sha512-BSY+JSlHxOmGsPTydUkPf1MdMQ3M81x5xGCOVgWM3G8XH77sJ292Y2oqcp0CbbgxhqBuI46iUz1tT7hqP7EfgA==} + /@babel/helpers@7.23.5: + resolution: {integrity: sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.20.7 - '@babel/traverse': 7.21.5 - '@babel/types': 7.23.4 + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.5 + '@babel/types': 7.23.5 transitivePeerDependencies: - supports-color dev: true @@ -224,12 +227,21 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser@7.23.4: - resolution: {integrity: sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==} + /@babel/highlight@7.23.4: + resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + + /@babel/parser@7.23.5: + resolution: {integrity: sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.23.4 + '@babel/types': 7.23.5 dev: true /@babel/runtime@7.23.2: @@ -239,35 +251,35 @@ packages: regenerator-runtime: 0.14.0 dev: true - /@babel/template@7.20.7: - resolution: {integrity: sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==} + /@babel/template@7.22.15: + resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.22.13 - '@babel/parser': 7.23.4 - '@babel/types': 7.23.4 + '@babel/code-frame': 7.23.5 + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 dev: true - /@babel/traverse@7.21.5: - resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==} + /@babel/traverse@7.23.5: + resolution: {integrity: sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.22.13 - '@babel/generator': 7.21.5 - '@babel/helper-environment-visitor': 7.21.5 - '@babel/helper-function-name': 7.21.0 - '@babel/helper-hoist-variables': 7.18.6 - '@babel/helper-split-export-declaration': 7.18.6 - '@babel/parser': 7.23.4 - '@babel/types': 7.23.4 + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.5 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color dev: true - /@babel/types@7.23.4: - resolution: {integrity: sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==} + /@babel/types@7.23.5: + resolution: {integrity: sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.23.4 @@ -284,6 +296,15 @@ packages: dev: true optional: true + /@esbuild/android-arm64@0.19.8: + resolution: {integrity: sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.19.7: resolution: {integrity: sha512-YGSPnndkcLo4PmVl2tKatEn+0mlVMr3yEpOOT0BeMria87PhvoJb5dg5f5Ft9fbCVgtAz4pWMzZVgSEGpDAlww==} engines: {node: '>=12'} @@ -293,6 +314,15 @@ packages: dev: true optional: true + /@esbuild/android-arm@0.19.8: + resolution: {integrity: sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.19.7: resolution: {integrity: sha512-jhINx8DEjz68cChFvM72YzrqfwJuFbfvSxZAk4bebpngGfNNRm+zRl4rtT9oAX6N9b6gBcFaJHFew5Blf6CvUw==} engines: {node: '>=12'} @@ -302,6 +332,15 @@ packages: dev: true optional: true + /@esbuild/android-x64@0.19.8: + resolution: {integrity: sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.19.7: resolution: {integrity: sha512-dr81gbmWN//3ZnBIm6YNCl4p3pjnabg1/ZVOgz2fJoUO1a3mq9WQ/1iuEluMs7mCL+Zwv7AY5e3g1hjXqQZ9Iw==} engines: {node: '>=12'} @@ -311,6 +350,15 @@ packages: dev: true optional: true + /@esbuild/darwin-arm64@0.19.8: + resolution: {integrity: sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.19.7: resolution: {integrity: sha512-Lc0q5HouGlzQEwLkgEKnWcSazqr9l9OdV2HhVasWJzLKeOt0PLhHaUHuzb8s/UIya38DJDoUm74GToZ6Wc7NGQ==} engines: {node: '>=12'} @@ -320,6 +368,15 @@ packages: dev: true optional: true + /@esbuild/darwin-x64@0.19.8: + resolution: {integrity: sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.19.7: resolution: {integrity: sha512-+y2YsUr0CxDFF7GWiegWjGtTUF6gac2zFasfFkRJPkMAuMy9O7+2EH550VlqVdpEEchWMynkdhC9ZjtnMiHImQ==} engines: {node: '>=12'} @@ -329,6 +386,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-arm64@0.19.8: + resolution: {integrity: sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.19.7: resolution: {integrity: sha512-CdXOxIbIzPJmJhrpmJTLx+o35NoiKBIgOvmvT+jeSadYiWJn0vFKsl+0bSG/5lwjNHoIDEyMYc/GAPR9jxusTA==} engines: {node: '>=12'} @@ -338,6 +404,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-x64@0.19.8: + resolution: {integrity: sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.19.7: resolution: {integrity: sha512-inHqdOVCkUhHNvuQPT1oCB7cWz9qQ/Cz46xmVe0b7UXcuIJU3166aqSunsqkgSGMtUCWOZw3+KMwI6otINuC9g==} engines: {node: '>=12'} @@ -347,6 +422,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm64@0.19.8: + resolution: {integrity: sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.19.7: resolution: {integrity: sha512-Y+SCmWxsJOdQtjcBxoacn/pGW9HDZpwsoof0ttL+2vGcHokFlfqV666JpfLCSP2xLxFpF1lj7T3Ox3sr95YXww==} engines: {node: '>=12'} @@ -356,6 +440,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm@0.19.8: + resolution: {integrity: sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.19.7: resolution: {integrity: sha512-2BbiL7nLS5ZO96bxTQkdO0euGZIUQEUXMTrqLxKUmk/Y5pmrWU84f+CMJpM8+EHaBPfFSPnomEaQiG/+Gmh61g==} engines: {node: '>=12'} @@ -365,6 +458,15 @@ packages: dev: true optional: true + /@esbuild/linux-ia32@0.19.8: + resolution: {integrity: sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.19.7: resolution: {integrity: sha512-BVFQla72KXv3yyTFCQXF7MORvpTo4uTA8FVFgmwVrqbB/4DsBFWilUm1i2Oq6zN36DOZKSVUTb16jbjedhfSHw==} engines: {node: '>=12'} @@ -374,6 +476,15 @@ packages: dev: true optional: true + /@esbuild/linux-loong64@0.19.8: + resolution: {integrity: sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.19.7: resolution: {integrity: sha512-DzAYckIaK+pS31Q/rGpvUKu7M+5/t+jI+cdleDgUwbU7KdG2eC3SUbZHlo6Q4P1CfVKZ1lUERRFP8+q0ob9i2w==} engines: {node: '>=12'} @@ -383,6 +494,15 @@ packages: dev: true optional: true + /@esbuild/linux-mips64el@0.19.8: + resolution: {integrity: sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.19.7: resolution: {integrity: sha512-JQ1p0SmUteNdUaaiRtyS59GkkfTW0Edo+e0O2sihnY4FoZLz5glpWUQEKMSzMhA430ctkylkS7+vn8ziuhUugQ==} engines: {node: '>=12'} @@ -392,6 +512,15 @@ packages: dev: true optional: true + /@esbuild/linux-ppc64@0.19.8: + resolution: {integrity: sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.19.7: resolution: {integrity: sha512-xGwVJ7eGhkprY/nB7L7MXysHduqjpzUl40+XoYDGC4UPLbnG+gsyS1wQPJ9lFPcxYAaDXbdRXd1ACs9AE9lxuw==} engines: {node: '>=12'} @@ -401,6 +530,15 @@ packages: dev: true optional: true + /@esbuild/linux-riscv64@0.19.8: + resolution: {integrity: sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.19.7: resolution: {integrity: sha512-U8Rhki5PVU0L0nvk+E8FjkV8r4Lh4hVEb9duR6Zl21eIEYEwXz8RScj4LZWA2i3V70V4UHVgiqMpszXvG0Yqhg==} engines: {node: '>=12'} @@ -410,6 +548,15 @@ packages: dev: true optional: true + /@esbuild/linux-s390x@0.19.8: + resolution: {integrity: sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.19.7: resolution: {integrity: sha512-ZYZopyLhm4mcoZXjFt25itRlocKlcazDVkB4AhioiL9hOWhDldU9n38g62fhOI4Pth6vp+Mrd5rFKxD0/S+7aQ==} engines: {node: '>=12'} @@ -419,6 +566,15 @@ packages: dev: true optional: true + /@esbuild/linux-x64@0.19.8: + resolution: {integrity: sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.19.7: resolution: {integrity: sha512-/yfjlsYmT1O3cum3J6cmGG16Fd5tqKMcg5D+sBYLaOQExheAJhqr8xOAEIuLo8JYkevmjM5zFD9rVs3VBcsjtQ==} engines: {node: '>=12'} @@ -428,6 +584,15 @@ packages: dev: true optional: true + /@esbuild/netbsd-x64@0.19.8: + resolution: {integrity: sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.19.7: resolution: {integrity: sha512-MYDFyV0EW1cTP46IgUJ38OnEY5TaXxjoDmwiTXPjezahQgZd+j3T55Ht8/Q9YXBM0+T9HJygrSRGV5QNF/YVDQ==} engines: {node: '>=12'} @@ -437,6 +602,15 @@ packages: dev: true optional: true + /@esbuild/openbsd-x64@0.19.8: + resolution: {integrity: sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.19.7: resolution: {integrity: sha512-JcPvgzf2NN/y6X3UUSqP6jSS06V0DZAV/8q0PjsZyGSXsIGcG110XsdmuWiHM+pno7/mJF6fjH5/vhUz/vA9fw==} engines: {node: '>=12'} @@ -446,6 +620,15 @@ packages: dev: true optional: true + /@esbuild/sunos-x64@0.19.8: + resolution: {integrity: sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.19.7: resolution: {integrity: sha512-ZA0KSYti5w5toax5FpmfcAgu3ZNJxYSRm0AW/Dao5up0YV1hDVof1NvwLomjEN+3/GMtaWDI+CIyJOMTRSTdMw==} engines: {node: '>=12'} @@ -455,6 +638,15 @@ packages: dev: true optional: true + /@esbuild/win32-arm64@0.19.8: + resolution: {integrity: sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.19.7: resolution: {integrity: sha512-CTOnijBKc5Jpk6/W9hQMMvJnsSYRYgveN6O75DTACCY18RA2nqka8dTZR+x/JqXCRiKk84+5+bRKXUSbbwsS0A==} engines: {node: '>=12'} @@ -464,6 +656,15 @@ packages: dev: true optional: true + /@esbuild/win32-ia32@0.19.8: + resolution: {integrity: sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.19.7: resolution: {integrity: sha512-gRaP2sk6hc98N734luX4VpF318l3w+ofrtTu9j5L8EQXF+FzQKV6alCOHMVoJJHvVK/mGbwBXfOL1HETQu9IGQ==} engines: {node: '>=12'} @@ -473,13 +674,22 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.54.0): + /@esbuild/win32-x64@0.19.8: + resolution: {integrity: sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@eslint-community/eslint-utils@4.4.0(eslint@8.55.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.54.0 + eslint: 8.55.0 eslint-visitor-keys: 3.4.3 dev: true @@ -488,8 +698,8 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@2.1.3: - resolution: {integrity: sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==} + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -505,8 +715,8 @@ packages: - supports-color dev: true - /@eslint/js@8.54.0: - resolution: {integrity: sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==} + /@eslint/js@8.55.0: + resolution: {integrity: sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -556,6 +766,11 @@ packages: engines: {node: '>=6.0.0'} dev: true + /@jridgewell/resolve-uri@3.1.1: + resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + engines: {node: '>=6.0.0'} + dev: true + /@jridgewell/set-array@1.1.2: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} engines: {node: '>=6.0.0'} @@ -576,7 +791,14 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true - /@mcous/eslint-config@0.4.2(@typescript-eslint/eslint-plugin@6.13.1)(@typescript-eslint/parser@6.13.1)(eslint-config-prettier@9.0.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-sonarjs@0.23.0)(eslint-plugin-unicorn@49.0.0)(eslint-plugin-vitest@0.3.10)(eslint@8.54.0): + /@jridgewell/trace-mapping@0.3.20: + resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /@mcous/eslint-config@0.4.2(@typescript-eslint/eslint-plugin@6.13.2)(@typescript-eslint/parser@6.13.2)(eslint-config-prettier@9.1.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-sonarjs@0.23.0)(eslint-plugin-unicorn@49.0.0)(eslint-plugin-vitest@0.3.10)(eslint@8.55.0): resolution: {integrity: sha512-YwsxtdMio+4IJfpuRrpI3PZBrdXOrk7x6NpI5eRNTLsT+I6HQP614W5acoHjo16Vm8bNyJud3Yzt5HzgPOEmfQ==} peerDependencies: '@typescript-eslint/eslint-plugin': '>=5.0.0 <7' @@ -588,14 +810,14 @@ packages: eslint-plugin-unicorn: '>=47.0.0 <50' eslint-plugin-vitest: '>=0.3.0 <0.4' dependencies: - '@typescript-eslint/eslint-plugin': 6.13.1(@typescript-eslint/parser@6.13.1)(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/parser': 6.13.1(eslint@8.54.0)(typescript@5.3.2) - eslint: 8.54.0 - eslint-config-prettier: 9.0.0(eslint@8.54.0) - eslint-plugin-promise: 6.1.1(eslint@8.54.0) - eslint-plugin-sonarjs: 0.23.0(eslint@8.54.0) - eslint-plugin-unicorn: 49.0.0(eslint@8.54.0) - eslint-plugin-vitest: 0.3.10(@typescript-eslint/eslint-plugin@6.13.1)(eslint@8.54.0)(typescript@5.3.2)(vitest@1.0.0-beta.6) + '@typescript-eslint/eslint-plugin': 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.2) + '@typescript-eslint/parser': 6.13.2(eslint@8.55.0)(typescript@5.3.2) + eslint: 8.55.0 + eslint-config-prettier: 9.1.0(eslint@8.55.0) + eslint-plugin-promise: 6.1.1(eslint@8.55.0) + eslint-plugin-sonarjs: 0.23.0(eslint@8.55.0) + eslint-plugin-unicorn: 49.0.0(eslint@8.55.0) + eslint-plugin-vitest: 0.3.10(@typescript-eslint/eslint-plugin@6.13.2)(eslint@8.55.0)(typescript@5.3.2)(vitest@1.0.1) dev: true /@mcous/prettier-config@0.3.0(prettier@3.1.0): @@ -643,6 +865,14 @@ packages: dev: true optional: true + /@rollup/rollup-android-arm-eabi@4.6.1: + resolution: {integrity: sha512-0WQ0ouLejaUCRsL93GD4uft3rOmB8qoQMU05Kb8CmMtMBe7XUDLAltxVZI1q6byNqEtU7N1ZX1Vw5lIpgulLQA==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-android-arm64@4.5.0: resolution: {integrity: sha512-UdMf1pOQc4ZmUA/NTmKhgJTBimbSKnhPS2zJqucqFyBRFPnPDtwA8MzrGNTjDeQbIAWfpJVAlxejw+/lQyBK/w==} cpu: [arm64] @@ -651,6 +881,14 @@ packages: dev: true optional: true + /@rollup/rollup-android-arm64@4.6.1: + resolution: {integrity: sha512-1TKm25Rn20vr5aTGGZqo6E4mzPicCUD79k17EgTLAsXc1zysyi4xXKACfUbwyANEPAEIxkzwue6JZ+stYzWUTA==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-darwin-arm64@4.5.0: resolution: {integrity: sha512-L0/CA5p/idVKI+c9PcAPGorH6CwXn6+J0Ys7Gg1axCbTPgI8MeMlhA6fLM9fK+ssFhqogMHFC8HDvZuetOii7w==} cpu: [arm64] @@ -659,6 +897,14 @@ packages: dev: true optional: true + /@rollup/rollup-darwin-arm64@4.6.1: + resolution: {integrity: sha512-cEXJQY/ZqMACb+nxzDeX9IPLAg7S94xouJJCNVE5BJM8JUEP4HeTF+ti3cmxWeSJo+5D+o8Tc0UAWUkfENdeyw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-darwin-x64@4.5.0: resolution: {integrity: sha512-QZCbVqU26mNlLn8zi/XDDquNmvcr4ON5FYAHQQsyhrHx8q+sQi/6xduoznYXwk/KmKIXG5dLfR0CvY+NAWpFYQ==} cpu: [x64] @@ -667,6 +913,14 @@ packages: dev: true optional: true + /@rollup/rollup-darwin-x64@4.6.1: + resolution: {integrity: sha512-LoSU9Xu56isrkV2jLldcKspJ7sSXmZWkAxg7sW/RfF7GS4F5/v4EiqKSMCFbZtDu2Nc1gxxFdQdKwkKS4rwxNg==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm-gnueabihf@4.5.0: resolution: {integrity: sha512-VpSQ+xm93AeV33QbYslgf44wc5eJGYfYitlQzAi3OObu9iwrGXEnmu5S3ilkqE3Pr/FkgOiJKV/2p0ewf4Hrtg==} cpu: [arm] @@ -675,6 +929,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm-gnueabihf@4.6.1: + resolution: {integrity: sha512-EfI3hzYAy5vFNDqpXsNxXcgRDcFHUWSx5nnRSCKwXuQlI5J9dD84g2Usw81n3FLBNsGCegKGwwTVsSKK9cooSQ==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm64-gnu@4.5.0: resolution: {integrity: sha512-OrEyIfpxSsMal44JpEVx9AEcGpdBQG1ZuWISAanaQTSMeStBW+oHWwOkoqR54bw3x8heP8gBOyoJiGg+fLY8qQ==} cpu: [arm64] @@ -683,6 +945,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm64-gnu@4.6.1: + resolution: {integrity: sha512-9lhc4UZstsegbNLhH0Zu6TqvDfmhGzuCWtcTFXY10VjLLUe4Mr0Ye2L3rrtHaDd/J5+tFMEuo5LTCSCMXWfUKw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-arm64-musl@4.5.0: resolution: {integrity: sha512-1H7wBbQuE6igQdxMSTjtFfD+DGAudcYWhp106z/9zBA8OQhsJRnemO4XGavdzHpGhRtRxbgmUGdO3YQgrWf2RA==} cpu: [arm64] @@ -691,6 +961,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-arm64-musl@4.6.1: + resolution: {integrity: sha512-FfoOK1yP5ksX3wwZ4Zk1NgyGHZyuRhf99j64I5oEmirV8EFT7+OhUZEnP+x17lcP/QHJNWGsoJwrz4PJ9fBEXw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-x64-gnu@4.5.0: resolution: {integrity: sha512-FVyFI13tXw5aE65sZdBpNjPVIi4Q5mARnL/39UIkxvSgRAIqCo5sCpCELk0JtXHGee2owZz5aNLbWNfBHzr71Q==} cpu: [x64] @@ -699,6 +977,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-x64-gnu@4.6.1: + resolution: {integrity: sha512-DNGZvZDO5YF7jN5fX8ZqmGLjZEXIJRdJEdTFMhiyXqyXubBa0WVLDWSNlQ5JR2PNgDbEV1VQowhVRUh+74D+RA==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-linux-x64-musl@4.5.0: resolution: {integrity: sha512-eBPYl2sLpH/o8qbSz6vPwWlDyThnQjJfcDOGFbNjmjb44XKC1F5dQfakOsADRVrXCNzM6ZsSIPDG5dc6HHLNFg==} cpu: [x64] @@ -707,6 +993,14 @@ packages: dev: true optional: true + /@rollup/rollup-linux-x64-musl@4.6.1: + resolution: {integrity: sha512-RkJVNVRM+piYy87HrKmhbexCHg3A6Z6MU0W9GHnJwBQNBeyhCJG9KDce4SAMdicQnpURggSvtbGo9xAWOfSvIQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-arm64-msvc@4.5.0: resolution: {integrity: sha512-xaOHIfLOZypoQ5U2I6rEaugS4IYtTgP030xzvrBf5js7p9WI9wik07iHmsKaej8Z83ZDxN5GyypfoyKV5O5TJA==} cpu: [arm64] @@ -715,6 +1009,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-arm64-msvc@4.6.1: + resolution: {integrity: sha512-v2FVT6xfnnmTe3W9bJXl6r5KwJglMK/iRlkKiIFfO6ysKs0rDgz7Cwwf3tjldxQUrHL9INT/1r4VA0n9L/F1vQ==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-ia32-msvc@4.5.0: resolution: {integrity: sha512-Al6quztQUrHwcOoU2TuFblUQ5L+/AmPBXFR6dUvyo4nRj2yQRK0WIUaGMF/uwKulvRcXkpHe3k9A8Vf93VDktA==} cpu: [ia32] @@ -723,6 +1025,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-ia32-msvc@4.6.1: + resolution: {integrity: sha512-YEeOjxRyEjqcWphH9dyLbzgkF8wZSKAKUkldRY6dgNR5oKs2LZazqGB41cWJ4Iqqcy9/zqYgmzBkRoVz3Q9MLw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rollup/rollup-win32-x64-msvc@4.5.0: resolution: {integrity: sha512-8kdW+brNhI/NzJ4fxDufuJUjepzINqJKLGHuxyAtpPG9bMbn8P5mtaCcbOm0EzLJ+atg+kF9dwg8jpclkVqx5w==} cpu: [x64] @@ -731,6 +1041,14 @@ packages: dev: true optional: true + /@rollup/rollup-win32-x64-msvc@4.6.1: + resolution: {integrity: sha512-0zfTlFAIhgz8V2G8STq8toAjsYYA6eci1hnXuyOTUFnymrtJwnS6uGKiv3v5UrPZkBlamLvrLV2iiaeqCKzb0A==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -747,8 +1065,8 @@ packages: resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} dev: true - /@typescript-eslint/eslint-plugin@6.13.1(@typescript-eslint/parser@6.13.1)(eslint@8.54.0)(typescript@5.3.2): - resolution: {integrity: sha512-5bQDGkXaxD46bPvQt08BUz9YSaO4S0fB1LB5JHQuXTfkGPI3+UUeS387C/e9jRie5GqT8u5kFTrMvAjtX4O5kA==} + /@typescript-eslint/eslint-plugin@6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.2): + resolution: {integrity: sha512-3+9OGAWHhk4O1LlcwLBONbdXsAhLjyCFogJY/cWy2lxdVJ2JrcTF2pTGMaLl2AE7U1l31n8Py4a8bx5DLf/0dQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -759,13 +1077,13 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.13.1(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/scope-manager': 6.13.1 - '@typescript-eslint/type-utils': 6.13.1(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/utils': 6.13.1(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/visitor-keys': 6.13.1 + '@typescript-eslint/parser': 6.13.2(eslint@8.55.0)(typescript@5.3.2) + '@typescript-eslint/scope-manager': 6.13.2 + '@typescript-eslint/type-utils': 6.13.2(eslint@8.55.0)(typescript@5.3.2) + '@typescript-eslint/utils': 6.13.2(eslint@8.55.0)(typescript@5.3.2) + '@typescript-eslint/visitor-keys': 6.13.2 debug: 4.3.4 - eslint: 8.54.0 + eslint: 8.55.0 graphemer: 1.4.0 ignore: 5.3.0 natural-compare: 1.4.0 @@ -776,8 +1094,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.13.1(eslint@8.54.0)(typescript@5.3.2): - resolution: {integrity: sha512-fs2XOhWCzRhqMmQf0eicLa/CWSaYss2feXsy7xBD/pLyWke/jCIVc2s1ikEAtSW7ina1HNhv7kONoEfVNEcdDQ==} + /@typescript-eslint/parser@6.13.2(eslint@8.55.0)(typescript@5.3.2): + resolution: {integrity: sha512-MUkcC+7Wt/QOGeVlM8aGGJZy1XV5YKjTpq9jK6r6/iLsGXhBVaGP5N0UYvFsu9BFlSpwY9kMretzdBH01rkRXg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -786,27 +1104,27 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.13.1 - '@typescript-eslint/types': 6.13.1 - '@typescript-eslint/typescript-estree': 6.13.1(typescript@5.3.2) - '@typescript-eslint/visitor-keys': 6.13.1 + '@typescript-eslint/scope-manager': 6.13.2 + '@typescript-eslint/types': 6.13.2 + '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.2) + '@typescript-eslint/visitor-keys': 6.13.2 debug: 4.3.4 - eslint: 8.54.0 + eslint: 8.55.0 typescript: 5.3.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager@6.13.1: - resolution: {integrity: sha512-BW0kJ7ceiKi56GbT2KKzZzN+nDxzQK2DS6x0PiSMPjciPgd/JRQGMibyaN2cPt2cAvuoH0oNvn2fwonHI+4QUQ==} + /@typescript-eslint/scope-manager@6.13.2: + resolution: {integrity: sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.13.1 - '@typescript-eslint/visitor-keys': 6.13.1 + '@typescript-eslint/types': 6.13.2 + '@typescript-eslint/visitor-keys': 6.13.2 dev: true - /@typescript-eslint/type-utils@6.13.1(eslint@8.54.0)(typescript@5.3.2): - resolution: {integrity: sha512-A2qPlgpxx2v//3meMqQyB1qqTg1h1dJvzca7TugM3Yc2USDY+fsRBiojAEo92HO7f5hW5mjAUF6qobOPzlBCBQ==} + /@typescript-eslint/type-utils@6.13.2(eslint@8.55.0)(typescript@5.3.2): + resolution: {integrity: sha512-Qr6ssS1GFongzH2qfnWKkAQmMUyZSyOr0W54nZNU1MDfo+U4Mv3XveeLZzadc/yq8iYhQZHYT+eoXJqnACM1tw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -815,23 +1133,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.13.1(typescript@5.3.2) - '@typescript-eslint/utils': 6.13.1(eslint@8.54.0)(typescript@5.3.2) + '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.2) + '@typescript-eslint/utils': 6.13.2(eslint@8.55.0)(typescript@5.3.2) debug: 4.3.4 - eslint: 8.54.0 + eslint: 8.55.0 ts-api-utils: 1.0.3(typescript@5.3.2) typescript: 5.3.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@6.13.1: - resolution: {integrity: sha512-gjeEskSmiEKKFIbnhDXUyiqVma1gRCQNbVZ1C8q7Zjcxh3WZMbzWVfGE9rHfWd1msQtPS0BVD9Jz9jded44eKg==} + /@typescript-eslint/types@6.13.2: + resolution: {integrity: sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.13.1(typescript@5.3.2): - resolution: {integrity: sha512-sBLQsvOC0Q7LGcUHO5qpG1HxRgePbT6wwqOiGLpR8uOJvPJbfs0mW3jPA3ujsDvfiVwVlWUDESNXv44KtINkUQ==} + /@typescript-eslint/typescript-estree@6.13.2(typescript@5.3.2): + resolution: {integrity: sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -839,8 +1157,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.13.1 - '@typescript-eslint/visitor-keys': 6.13.1 + '@typescript-eslint/types': 6.13.2 + '@typescript-eslint/visitor-keys': 6.13.2 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -851,30 +1169,30 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.13.1(eslint@8.54.0)(typescript@5.3.2): - resolution: {integrity: sha512-ouPn/zVoan92JgAegesTXDB/oUp6BP1v8WpfYcqh649ejNc9Qv+B4FF2Ff626kO1xg0wWwwG48lAJ4JuesgdOw==} + /@typescript-eslint/utils@6.13.2(eslint@8.55.0)(typescript@5.3.2): + resolution: {integrity: sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 6.13.1 - '@typescript-eslint/types': 6.13.1 - '@typescript-eslint/typescript-estree': 6.13.1(typescript@5.3.2) - eslint: 8.54.0 + '@typescript-eslint/scope-manager': 6.13.2 + '@typescript-eslint/types': 6.13.2 + '@typescript-eslint/typescript-estree': 6.13.2(typescript@5.3.2) + eslint: 8.55.0 semver: 7.5.4 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys@6.13.1: - resolution: {integrity: sha512-NDhQUy2tg6XGNBGDRm1XybOHSia8mcXmlbKWoQP+nm1BIIMxa55shyJfZkHpEBN62KNPLrocSM2PdPcaLgDKMQ==} + /@typescript-eslint/visitor-keys@6.13.2: + resolution: {integrity: sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.13.1 + '@typescript-eslint/types': 6.13.2 eslint-visitor-keys: 3.4.3 dev: true @@ -882,11 +1200,12 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@vitest/coverage-istanbul@1.0.0-beta.6(vitest@1.0.0-beta.6): - resolution: {integrity: sha512-fGxwZv/k+wfiFXNChpaXeMrB+BqUPPRnjUTlOvOlwJgYtFzK1UrAyokDYRHCNWU1UkzdCBzAll+lHd/6H9aytA==} + /@vitest/coverage-istanbul@1.0.1(vitest@1.0.1): + resolution: {integrity: sha512-g2XAfl6DlYy37ycUuPtXYpOu9TcFN9wVGraxrKQJESeal7z9d0UMI/FcOqKifUPfjod+QnCl2+9CZe1elvAvMA==} peerDependencies: - vitest: ^1.0.0-0 + vitest: ^1.0.0 dependencies: + debug: 4.3.4 istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.1 istanbul-lib-report: 3.0.1 @@ -895,43 +1214,43 @@ packages: magicast: 0.3.2 picocolors: 1.0.0 test-exclude: 6.0.0 - vitest: 1.0.0-beta.6 + vitest: 1.0.1 transitivePeerDependencies: - supports-color dev: true - /@vitest/expect@1.0.0-beta.6: - resolution: {integrity: sha512-leCesYErICeBQEz0Tzaopad1cnCUBfR1gDk2nFxHCChv7gdYTezcC2YRlPCwA8TuWGCXs8cdyTFO5R6QhUfY9A==} + /@vitest/expect@1.0.1: + resolution: {integrity: sha512-3cdrb/eKD/0tygDX75YscuHEHMUJ70u3UoLSq2eqhWks57AyzvsDQbyn53IhZ0tBN7gA8Jj2VhXiOV2lef7thw==} dependencies: - '@vitest/spy': 1.0.0-beta.6 - '@vitest/utils': 1.0.0-beta.6 + '@vitest/spy': 1.0.1 + '@vitest/utils': 1.0.1 chai: 4.3.10 dev: true - /@vitest/runner@1.0.0-beta.6: - resolution: {integrity: sha512-pcFo7XRaALk44ck8LpcjtIsr2Ue4jFNfaq5MDlHupAekkJdDdFrAAfOmsE/LnIqeUsnd/6IaKvLX1oRnCkz6kg==} + /@vitest/runner@1.0.1: + resolution: {integrity: sha512-/+z0vhJ0MfRPT3AyTvAK6m57rzlew/ct8B2a4LMv7NhpPaiI2QLGyOBMB3lcioWdJHjRuLi9aYppfOv0B5aRQA==} dependencies: - '@vitest/utils': 1.0.0-beta.6 + '@vitest/utils': 1.0.1 p-limit: 5.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@1.0.0-beta.6: - resolution: {integrity: sha512-znkf7R67aanWHjAfx+/Yj5VwIdUHU1I1akJFL8lguiu5C6C12D4ICHeMjRBc7e7BrIguBWZFfqPx/ZUSxqMTfA==} + /@vitest/snapshot@1.0.1: + resolution: {integrity: sha512-wIPtPDGSxEZ+DpNMc94AsybX6LV6uN6sosf5TojyP1m2QbKwiRuLV/5RSsjt1oWViHsTj8mlcwrQQ1zHGO0fMw==} dependencies: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 dev: true - /@vitest/spy@1.0.0-beta.6: - resolution: {integrity: sha512-AaR9a/ecsJ4lMeC5ZdsTfXqBVxA7ZrmT3q/ooUGXYvAtSxETn39gWC6h7wxUCtKwTLClq+5FmA03Co5/zmGMBw==} + /@vitest/spy@1.0.1: + resolution: {integrity: sha512-yXwm1uKhBVr/5MhVeSmtNqK+0q2RXIchJt8kokEKdrWLtkPeDgdbZ6SjR1VQGZuNdWL6sSBnLayIyVvcS0qLfA==} dependencies: tinyspy: 2.2.0 dev: true - /@vitest/utils@1.0.0-beta.6: - resolution: {integrity: sha512-PyUf4dTFRLfq6YAdAab39i32O/qhpeCVM7cUpN1au7BrvYI/e43ZDhhHdwbt8zP14l06PNrXd5nTSZPFQwmsVw==} + /@vitest/utils@1.0.1: + resolution: {integrity: sha512-MGPCHkzXbbAyscrhwGzh8uP1HPrTYLWaj1WTDtWSGrpe2yJWLRN9mF9ooKawr6NMOg9vTBtg2JqWLfuLC7Dknw==} dependencies: diff-sequences: 29.6.3 loupe: 2.3.7 @@ -1038,15 +1357,15 @@ packages: fill-range: 7.0.1 dev: true - /browserslist@4.21.5: - resolution: {integrity: sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==} + /browserslist@4.22.2: + resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001486 - electron-to-chromium: 1.4.389 - node-releases: 2.0.10 - update-browserslist-db: 1.0.11(browserslist@4.21.5) + caniuse-lite: 1.0.30001566 + electron-to-chromium: 1.4.603 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.22.2) dev: true /builtin-modules@3.3.0: @@ -1074,8 +1393,8 @@ packages: engines: {node: '>=6'} dev: true - /caniuse-lite@1.0.30001486: - resolution: {integrity: sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==} + /caniuse-lite@1.0.30001566: + resolution: {integrity: sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==} dev: true /chai@4.3.10: @@ -1196,8 +1515,8 @@ packages: yargs: 17.7.2 dev: true - /convert-source-map@1.9.0: - resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} dev: true /cross-spawn@7.0.3: @@ -1258,8 +1577,8 @@ packages: esutils: 2.0.3 dev: true - /electron-to-chromium@1.4.389: - resolution: {integrity: sha512-WDgWUOK8ROR7sDFyYmxCUOoDc50lPgYAHAHwnnD1iN3SKO/mpqftb9iIPiEkMKmqYdkrR0j3N/O+YB/U7lSxwg==} + /electron-to-chromium@1.4.603: + resolution: {integrity: sha512-Dvo5OGjnl7AZTU632dFJtWj0uJK835eeOVQIuRcmBmsFsTNn3cL05FqOyHAfGQDIoHfLhyJ1Tya3PJ0ceMz54g==} dev: true /emoji-regex@8.0.0: @@ -1302,6 +1621,36 @@ packages: '@esbuild/win32-x64': 0.19.7 dev: true + /esbuild@0.19.8: + resolution: {integrity: sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.19.8 + '@esbuild/android-arm64': 0.19.8 + '@esbuild/android-x64': 0.19.8 + '@esbuild/darwin-arm64': 0.19.8 + '@esbuild/darwin-x64': 0.19.8 + '@esbuild/freebsd-arm64': 0.19.8 + '@esbuild/freebsd-x64': 0.19.8 + '@esbuild/linux-arm': 0.19.8 + '@esbuild/linux-arm64': 0.19.8 + '@esbuild/linux-ia32': 0.19.8 + '@esbuild/linux-loong64': 0.19.8 + '@esbuild/linux-mips64el': 0.19.8 + '@esbuild/linux-ppc64': 0.19.8 + '@esbuild/linux-riscv64': 0.19.8 + '@esbuild/linux-s390x': 0.19.8 + '@esbuild/linux-x64': 0.19.8 + '@esbuild/netbsd-x64': 0.19.8 + '@esbuild/openbsd-x64': 0.19.8 + '@esbuild/sunos-x64': 0.19.8 + '@esbuild/win32-arm64': 0.19.8 + '@esbuild/win32-ia32': 0.19.8 + '@esbuild/win32-x64': 0.19.8 + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -1317,44 +1666,44 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier@9.0.0(eslint@8.54.0): - resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==} + /eslint-config-prettier@9.1.0(eslint@8.55.0): + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.54.0 + eslint: 8.55.0 dev: true - /eslint-plugin-promise@6.1.1(eslint@8.54.0): + /eslint-plugin-promise@6.1.1(eslint@8.55.0): resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.54.0 + eslint: 8.55.0 dev: true - /eslint-plugin-sonarjs@0.23.0(eslint@8.54.0): + /eslint-plugin-sonarjs@0.23.0(eslint@8.55.0): resolution: {integrity: sha512-z44T3PBf9W7qQ/aR+NmofOTyg6HLhSEZOPD4zhStqBpLoMp8GYhFksuUBnCxbnf1nfISpKBVkQhiBLFI/F4Wlg==} engines: {node: '>=14'} peerDependencies: eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - eslint: 8.54.0 + eslint: 8.55.0 dev: true - /eslint-plugin-unicorn@49.0.0(eslint@8.54.0): + /eslint-plugin-unicorn@49.0.0(eslint@8.55.0): resolution: {integrity: sha512-0fHEa/8Pih5cmzFW5L7xMEfUTvI9WKeQtjmKpTUmY+BiFCDxkxrTdnURJOHKykhtwIeyYsxnecbGvDCml++z4Q==} engines: {node: '>=16'} peerDependencies: eslint: '>=8.52.0' dependencies: '@babel/helper-validator-identifier': 7.22.20 - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) ci-info: 3.9.0 clean-regexp: 1.0.0 - eslint: 8.54.0 + eslint: 8.55.0 esquery: 1.5.0 indent-string: 4.0.0 is-builtin-module: 3.2.1 @@ -1367,7 +1716,7 @@ packages: strip-indent: 3.0.0 dev: true - /eslint-plugin-vitest@0.3.10(@typescript-eslint/eslint-plugin@6.13.1)(eslint@8.54.0)(typescript@5.3.2)(vitest@1.0.0-beta.6): + /eslint-plugin-vitest@0.3.10(@typescript-eslint/eslint-plugin@6.13.2)(eslint@8.55.0)(typescript@5.3.2)(vitest@1.0.1): resolution: {integrity: sha512-08lj4rdhZHYyHk+Py2nJ7SlE6arP8GNfGXl9jVqhe9s5JoZIGiBpIkLGX+VNBiB6vXTn56H6Ant7Koc6XzRjtQ==} engines: {node: 14.x || >= 16} peerDependencies: @@ -1380,10 +1729,10 @@ packages: vitest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 6.13.1(@typescript-eslint/parser@6.13.1)(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/utils': 6.13.1(eslint@8.54.0)(typescript@5.3.2) - eslint: 8.54.0 - vitest: 1.0.0-beta.6 + '@typescript-eslint/eslint-plugin': 6.13.2(@typescript-eslint/parser@6.13.2)(eslint@8.55.0)(typescript@5.3.2) + '@typescript-eslint/utils': 6.13.2(eslint@8.55.0)(typescript@5.3.2) + eslint: 8.55.0 + vitest: 1.0.1 transitivePeerDependencies: - supports-color - typescript @@ -1402,15 +1751,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.54.0: - resolution: {integrity: sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==} + /eslint@8.55.0: + resolution: {integrity: sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.55.0) '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.3 - '@eslint/js': 8.54.0 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.55.0 '@humanwhocodes/config-array': 0.11.13 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -1831,8 +2180,8 @@ packages: resolution: {integrity: sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==} engines: {node: '>=10'} dependencies: - '@babel/core': 7.21.8 - '@babel/parser': 7.23.4 + '@babel/core': 7.23.5 + '@babel/parser': 7.23.5 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.2 semver: 7.5.4 @@ -2018,8 +2367,8 @@ packages: /magicast@0.3.2: resolution: {integrity: sha512-Fjwkl6a0syt9TFN0JSYpOybxiMCkYNEeOTnOTNRbjphirLakznZXAqrXgj/7GG3D1dvETONNwrBfinvAbpunDg==} dependencies: - '@babel/parser': 7.23.4 - '@babel/types': 7.23.4 + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 source-map-js: 1.0.2 dev: true @@ -2074,7 +2423,7 @@ packages: acorn: 8.11.2 pathe: 1.1.1 pkg-types: 1.0.3 - ufo: 1.3.1 + ufo: 1.3.2 dev: true /ms@2.1.2: @@ -2089,8 +2438,8 @@ packages: thenify-all: 1.6.0 dev: true - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -2099,8 +2448,8 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /node-releases@2.0.10: - resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==} + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true /normalize-package-data@2.5.0: @@ -2305,11 +2654,11 @@ packages: yaml: 2.3.4 dev: true - /postcss@8.4.31: - resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + /postcss@8.4.32: + resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true @@ -2445,6 +2794,26 @@ packages: fsevents: 2.3.3 dev: true + /rollup@4.6.1: + resolution: {integrity: sha512-jZHaZotEHQaHLgKr8JnQiDT1rmatjgKlMekyksz+yk9jt/8z9quNjnKNRoaM0wd9DC2QKXjmWWuDYtM3jfF8pQ==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.6.1 + '@rollup/rollup-android-arm64': 4.6.1 + '@rollup/rollup-darwin-arm64': 4.6.1 + '@rollup/rollup-darwin-x64': 4.6.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.6.1 + '@rollup/rollup-linux-arm64-gnu': 4.6.1 + '@rollup/rollup-linux-arm64-musl': 4.6.1 + '@rollup/rollup-linux-x64-gnu': 4.6.1 + '@rollup/rollup-linux-x64-musl': 4.6.1 + '@rollup/rollup-win32-arm64-msvc': 4.6.1 + '@rollup/rollup-win32-ia32-msvc': 4.6.1 + '@rollup/rollup-win32-x64-msvc': 4.6.1 + fsevents: 2.3.3 + dev: true + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -2462,8 +2831,8 @@ packages: hasBin: true dev: true - /semver@6.3.0: - resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true dev: true @@ -2556,8 +2925,8 @@ packages: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} dev: true - /std-env@3.5.0: - resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} + /std-env@3.6.0: + resolution: {integrity: sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg==} dev: true /string-width@4.2.3: @@ -2796,17 +3165,17 @@ packages: hasBin: true dev: true - /ufo@1.3.1: - resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} + /ufo@1.3.2: + resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} dev: true - /update-browserslist-db@1.0.11(browserslist@4.21.5): - resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==} + /update-browserslist-db@1.0.13(browserslist@4.22.2): + resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.21.5 + browserslist: 4.22.2 escalade: 3.1.1 picocolors: 1.0.0 dev: true @@ -2824,8 +3193,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@1.0.0-beta.6: - resolution: {integrity: sha512-cDRdVdirWxw8AODIGzdM0uI5J4Ts7evXzelFAQgngSyblaQG84PUsVHeMIhNWWM5L1K0hst+R2ecJzPUgI6tCw==} + /vite-node@1.0.1: + resolution: {integrity: sha512-Y2Jnz4cr2azsOMMYuVPrQkp3KMnS/0WV8ezZjCy4hU7O5mUHCAVOnFmoEvs1nvix/4mYm74Len8bYRWZJMNP6g==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: @@ -2833,7 +3202,7 @@ packages: debug: 4.3.4 pathe: 1.1.1 picocolors: 1.0.0 - vite: 5.0.2 + vite: 5.0.5 transitivePeerDependencies: - '@types/node' - less @@ -2845,8 +3214,8 @@ packages: - terser dev: true - /vite@5.0.2: - resolution: {integrity: sha512-6CCq1CAJCNM1ya2ZZA7+jS2KgnhbzvxakmlIjN24cF/PXhRMzpM/z8QgsVJA/Dm5fWUWnVEsmtBoMhmerPxT0g==} + /vite@5.0.5: + resolution: {integrity: sha512-OekeWqR9Ls56f3zd4CaxzbbS11gqYkEiBtnWFFgYR2WV8oPJRRKq0mpskYy/XaoCL3L7VINDhqqOMNDiYdGvGg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -2873,22 +3242,22 @@ packages: terser: optional: true dependencies: - esbuild: 0.19.7 - postcss: 8.4.31 - rollup: 4.5.0 + esbuild: 0.19.8 + postcss: 8.4.32 + rollup: 4.6.1 optionalDependencies: fsevents: 2.3.3 dev: true - /vitest@1.0.0-beta.6: - resolution: {integrity: sha512-yahr45sIcSq8SaY9FUcmWLrsDMAL3mCd/vC890uymiZhrZ5VQrqMmOT0FcB7vtC4kh327p6IXWqHHLr7B0hRug==} + /vitest@1.0.1: + resolution: {integrity: sha512-MHsOj079S28hDsvdDvyD1pRj4dcS51EC5Vbe0xvOYX+WryP8soiK2dm8oULi+oA/8Xa/h6GoJEMTmcmBy5YM+Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': '*' - '@vitest/ui': '*' + '@vitest/browser': ^1.0.0 + '@vitest/ui': ^1.0.0 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -2905,11 +3274,11 @@ packages: jsdom: optional: true dependencies: - '@vitest/expect': 1.0.0-beta.6 - '@vitest/runner': 1.0.0-beta.6 - '@vitest/snapshot': 1.0.0-beta.6 - '@vitest/spy': 1.0.0-beta.6 - '@vitest/utils': 1.0.0-beta.6 + '@vitest/expect': 1.0.1 + '@vitest/runner': 1.0.1 + '@vitest/snapshot': 1.0.1 + '@vitest/spy': 1.0.1 + '@vitest/utils': 1.0.1 acorn-walk: 8.3.0 cac: 6.7.14 chai: 4.3.10 @@ -2919,12 +3288,12 @@ packages: magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 - std-env: 3.5.0 + std-env: 3.6.0 strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.8.1 - vite: 5.0.2 - vite-node: 1.0.0-beta.6 + vite: 5.0.5 + vite-node: 1.0.1 why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/src/behaviors.ts b/src/behaviors.ts index 4ad8298..fcb3cfa 100644 --- a/src/behaviors.ts +++ b/src/behaviors.ts @@ -1,24 +1,25 @@ import { equals } from '@vitest/expect' import type { AnyFunction } from './types.ts' -export const ONCE = Symbol('ONCE') - -export type StubValue = TValue | typeof ONCE +export interface WhenOptions { + times?: number +} export interface BehaviorStack { use: (args: Parameters) => BehaviorEntry> | undefined bindArgs: >( args: TArgs, + options: WhenOptions, ) => BoundBehaviorStack> } export interface BoundBehaviorStack { - addReturn: (values: StubValue[]) => void - addResolve: (values: StubValue>[]) => void - addThrow: (values: StubValue[]) => void - addReject: (values: StubValue[]) => void - addDo: (values: StubValue[]) => void + addReturn: (values: TReturn[]) => void + addResolve: (values: Awaited[]) => void + addThrow: (values: unknown[]) => void + addReject: (values: unknown[]) => void + addDo: (values: AnyFunction[]) => void } export interface BehaviorEntry { @@ -52,10 +53,10 @@ export const createBehaviorStack = < return behavior }, - bindArgs: (args) => ({ + bindArgs: (args, options) => ({ addReturn: (values) => { behaviors.unshift( - ...getBehaviorOptions(values).map(({ value, times }) => ({ + ...getBehaviorOptions(values, options).map(({ value, times }) => ({ args, times, returnValue: value, @@ -64,7 +65,7 @@ export const createBehaviorStack = < }, addResolve: (values) => { behaviors.unshift( - ...getBehaviorOptions(values).map(({ value, times }) => ({ + ...getBehaviorOptions(values, options).map(({ value, times }) => ({ args, times, returnValue: Promise.resolve(value), @@ -73,7 +74,7 @@ export const createBehaviorStack = < }, addThrow: (values) => { behaviors.unshift( - ...getBehaviorOptions(values).map(({ value, times }) => ({ + ...getBehaviorOptions(values, options).map(({ value, times }) => ({ args, times, throwError: value, @@ -82,7 +83,7 @@ export const createBehaviorStack = < }, addReject: (values) => { behaviors.unshift( - ...getBehaviorOptions(values).map(({ value, times }) => ({ + ...getBehaviorOptions(values, options).map(({ value, times }) => ({ args, times, returnValue: Promise.reject(value), @@ -91,7 +92,7 @@ export const createBehaviorStack = < }, addDo: (values) => { behaviors.unshift( - ...getBehaviorOptions(values).map(({ value, times }) => ({ + ...getBehaviorOptions(values, options).map(({ value, times }) => ({ args, times, doCallback: value, @@ -103,18 +104,16 @@ export const createBehaviorStack = < } const getBehaviorOptions = ( - valuesAndOptions: StubValue[], + values: TValue[], + { times }: WhenOptions, ): BehaviorOptions[] => { - const once = valuesAndOptions.includes(ONCE) - let values = valuesAndOptions.filter((value) => value !== ONCE) as TValue[] - if (values.length === 0) { values = [undefined as TValue] } return values.map((value, index) => ({ value, - times: once || index < values.length - 1 ? 1 : undefined, + times: times ?? (index < values.length - 1 ? 1 : undefined), })) } diff --git a/src/errors.ts b/src/errors.ts index f096dec..e438a4b 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,6 +1,6 @@ export class NotAMockFunctionError extends TypeError { constructor(value: unknown) { - super(`when() must be given a Vite mock, but received ${String(value)}`) + super(`when() must be given a Vitest mock, but received ${String(value)}`) this.name = 'NotAMockFunctionError' } } diff --git a/src/vitest-when.ts b/src/vitest-when.ts index 5d163f4..a54a7db 100644 --- a/src/vitest-when.ts +++ b/src/vitest-when.ts @@ -1,8 +1,8 @@ import { configureStub } from './stubs.ts' -import type { StubValue } from './behaviors.ts' +import type { WhenOptions } from './behaviors.ts' import type { AnyFunction } from './types.ts' -export { ONCE, type StubValue } from './behaviors.ts' +export type { WhenOptions } from './behaviors.ts' export * from './errors.ts' export interface StubWrapper { @@ -12,28 +12,29 @@ export interface StubWrapper { } export interface Stub { - thenReturn: (...values: StubValue[]) => void - thenResolve: (...values: StubValue>[]) => void - thenThrow: (...errors: StubValue[]) => void - thenReject: (...errors: StubValue[]) => void - thenDo: (...callbacks: StubValue<(...args: TArgs) => TReturn>[]) => void + thenReturn: (...values: TReturn[]) => void + thenResolve: (...values: Awaited[]) => void + thenThrow: (...errors: unknown[]) => void + thenReject: (...errors: unknown[]) => void + thenDo: (...callbacks: ((...args: TArgs) => TReturn)[]) => void } export const when = ( spy: TFunc, + options: WhenOptions = {}, ): StubWrapper => { const behaviorStack = configureStub(spy) return { calledWith: (...args) => { - const boundBehaviors = behaviorStack.bindArgs(args) + const behaviors = behaviorStack.bindArgs(args, options) return { - thenReturn: (...values) => boundBehaviors.addReturn(values), - thenResolve: (...values) => boundBehaviors.addResolve(values), - thenThrow: (...errors) => boundBehaviors.addThrow(errors), - thenReject: (...errors) => boundBehaviors.addReject(errors), - thenDo: (...callbacks) => boundBehaviors.addDo(callbacks), + thenReturn: (...values) => behaviors.addReturn(values), + thenResolve: (...values) => behaviors.addResolve(values), + thenThrow: (...errors) => behaviors.addThrow(errors), + thenReject: (...errors) => behaviors.addReject(errors), + thenDo: (...callbacks) => behaviors.addDo(callbacks), } }, } diff --git a/test/vitest-when.test.ts b/test/vitest-when.test.ts index e534ac6..78d708e 100644 --- a/test/vitest-when.test.ts +++ b/test/vitest-when.test.ts @@ -55,11 +55,12 @@ describe('vitest-when', () => { expect(spy(1, 2, 3)).toEqual(undefined) }) - it('should return a value once', () => { + it('should return a number of times', () => { const spy = vi.fn() - subject.when(spy).calledWith(1, 2, 3).thenReturn(4, subject.ONCE) + subject.when(spy, { times: 2 }).calledWith(1, 2, 3).thenReturn(4) + expect(spy(1, 2, 3)).toEqual(4) expect(spy(1, 2, 3)).toEqual(4) expect(spy(1, 2, 3)).toEqual(undefined) }) @@ -154,14 +155,15 @@ describe('vitest-when', () => { await expect(spy(1, 2, 3)).rejects.toThrow('6') }) - it('should reject once', async () => { + it('should reject a number of times', async () => { const spy = vi.fn() subject - .when(spy) + .when(spy, { times: 2 }) .calledWith(1, 2, 3) - .thenReject(new Error('4'), subject.ONCE) + .thenReject(new Error('4')) + await expect(spy(1, 2, 3)).rejects.toThrow('4') await expect(spy(1, 2, 3)).rejects.toThrow('4') expect(spy(1, 2, 3)).toEqual(undefined) })