60 Commits

Author SHA1 Message Date
Vladimir
fcd2df2c23
refactor: update errors (#2816)
* perf: bypass source map handling, when using "resolves"/"rejects"

* chore: revert snapshot improvements

* test: fix test

* chore: fix initialization

* chore: fix snapshot
2023-02-11 16:53:41 +01:00
Vladimir
a186a7e12f
fix: don't use ownKeys, when interoping a module (#2629) 2023-01-10 18:24:50 +01:00
Vladimir
6b3e36d4e9
fix: allow mocking CJS module with interoped default (#2598)
* fix: allow mocking CJS module with interoped default

* chore: cleanup

* chore: cleanup
2023-01-06 13:11:10 +01:00
Vladimir
c479d9c0d2
fix: don't hang when mocking module with circular dependency (#2572) 2022-12-28 14:52:25 +01:00
Vladimir
a431df80b3
fix: correctly automock nested interoped defaults (#2559)
* fix: correctly automock nested interoped defaults

* chore: cleanup

* chore: cleanup
2022-12-25 09:13:16 +01:00
Anthony Fu
853eeddba8
feat(mock): expose a importOriginal helper to the factory (#2551) 2022-12-22 14:26:05 +01:00
Vladimir
58ee8e9b63
feat!: rewrite how vite-node resolves id (#2463)
* feat!: rewrite how vite-node resolves id

* chore: try to fix global setup test

* fix: remove /@fs/ from filepath

* chore: cleanup

* fix: normalize id for callstack

* fix: don't append "/" before disk drive on windows

* chore: cleanup

* chore: add test that windows drive is not repeated

* fix: dirname uses \\, update windows paths tests

* refactor: rename variables

* fix: don't provide importer only for /@id/

* chore: remove null byte placeholder as part of unwrapRef

* chore: cleanup

* chore: variables renaming

* fix: don't hang on circular mock

* test: update c8 snapshot

* chore: add compatibility layer for users who don't provide resolveId

* test: fix url handling in web worker

* test: fix file tests on windows

* chore: remove unnecessary normalizations in mocker

* chore: use /@fs/ when fetching module, if possible
2022-12-16 15:32:34 +01:00
Vladimir
32cc1a66df
chore: improve error, when accessing undefined mocked key (#2388) 2022-12-05 15:30:13 +01:00
Vladimir
96d1267bcb
feat: give helpful message, when using vi.mock (#2047) 2022-09-18 11:01:13 +08:00
Vladimir
7ae53dcfcb
fix(mocker): correctly mock libraries with extension in their name (#2035) 2022-09-13 11:13:31 +03:00
Vladimir
b237e64b9a
test: fix cypress tests by deduping vue (#2036)
* test: fix cypress tests by deduping vue

* chore: add vue dependency to mocks

* chore: cleanup
2022-09-13 11:13:21 +03:00
Simon Abbott
9f887f3598
fix: automock getters and setters (#1903)
* fix: automock getters and setters

* refactor: do not mock getters/setters

Co-authored-by: Vladimir Sheremet <sleuths.slews0s@icloud.com>
2022-08-30 18:48:57 +03:00
Lioness100
f13e54f096
chore: fix typos (#1857)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-08-15 18:38:15 +00:00
Anthony Fu
b70593955f
chore: update deps (#1853) 2022-08-15 15:13:37 +08:00
jereklas
8eddd5a380
fix: handle undefined returns of module mocks, and update migration docs (#1763) (#1830)
* handle undefined returns of module mocks, and update migration docs

* correct docs
2022-08-11 09:18:43 +03:00
jereklas
7574759127
fix: add error message when mock is missing export (#1819) 2022-08-08 18:10:59 +03:00
Anthony Fu
49c67d2573
fix(vite-node): self circular reference (#1609) 2022-07-07 16:39:20 +08:00
Vladimir
235b9502f9
fix: can mock files with space in path (#1457)
* fix: can mock files with space in path

* test: testing files with spaces
2022-06-10 10:10:55 +03:00
Anthony Fu
51459c9ce8 chore: update deps 2022-05-27 13:26:48 +08:00
Anthony Fu
4a046df559 chore: lint 2022-05-14 16:36:12 +08:00
Vladimir
c491fb448a
fix: can mock non-existent paths and virtual modules via __mocks__ (#1298) 2022-05-13 13:47:30 +00:00
Vladimir
7459ff8a46
fix: clear mock from callstack, if mocked with factory (#1276)
* fix: clear mock from callstack, if mocked with factory

* test: fix test for zustand
2022-05-09 11:38:11 +03:00
Anthony Fu
29c8cee5c4 chore: update deps 2022-05-08 04:51:58 +08:00
Vladimir
110788a793
fix: resolve id before loading from vite (#1204)
* fix: resolve id before loading from vite

* fix: allow import actual modules inside a factory of __mocks__ file

* test: fix custom reporters test

* fix: invalidate mocks

* chore: fix compatability with node 14

* chore: fix callstack position

* chore: remove collect from worker.ts since entry doesn't export that function

* chore: fix pnpm-lock

* chore: slice "mock" from stacktrace

* chore: fix checking callstack for a function mock

* chore: add description to factory mock

* test: add test for importing itself inside __mocks__ folder
2022-05-08 04:41:05 +08:00
Anthony Fu
317766f70f chore: apply lint 2022-05-02 23:12:20 +08:00
Anthony Fu
f99e043ab4 chore: update lock 2022-04-25 20:14:27 +08:00
Anthony Fu
713c870a55 chore: lint 2022-04-25 19:44:30 +08:00
Anthony Fu
4b785138e1 chore: update deps 2022-04-25 19:43:45 +08:00
renovate[bot]
4d1e0a0ed1
fix(deps): update all non-major dependencies (#1159)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-21 22:25:34 +08:00
renovate[bot]
40c26ed3b8
chore(deps): update all non-major dependencies (#1137)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-13 07:53:43 +08:00
eleith
06faf8ad49
fix: make automocking aware of symbol indexed methods (#1119)
Co-authored-by: eleith <online-github@eleith.com>
2022-04-08 02:10:19 +08:00
renovate[bot]
16684b2ae2
chore(deps): update all non-major dependencies (#1094)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-04 10:56:54 +08:00
Vladimir
885b25d4f2
fix: automocking prototype fix (#1083) 2022-04-03 15:55:02 +08:00
Anthony Fu
43f681914a chore: update deps 2022-04-02 00:30:52 +08:00
renovate[bot]
ffa0228034
chore(deps): update all non-major dependencies (#1042)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-28 10:13:38 +08:00
renovate[bot]
a1cab8ee30
chore(deps): update all non-major dependencies (#995)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-21 18:50:28 +08:00
Anthony Fu
7386bbc9ef chore: update deps 2022-03-16 15:53:00 +08:00
Anthony Fu
20ef23fdbd chore: upgrade deps 2022-03-14 06:42:24 +08:00
Anthony Fu
621300d0a0 chore: lint for md and json 2022-03-08 03:30:59 +08:00
Anthony Fu
638fd6c081 chore: update deps 2022-03-07 20:25:45 +08:00
patak
1b6406368c
chore: stackblitz config in package.json (#883) 2022-03-03 00:06:37 +08:00
Janosh Riebesell
4858541f36
docs: add svelte-multiselect to projects using Vitest (#867)
* add svelte-multiselect to projects using Vitest

* fix typos

* Update docs/api/index.md

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-02-28 18:21:14 +08:00
Anthony Fu
03e31e4b90 chore: update deps 2022-02-28 04:14:20 +08:00
Vladimir
7014c2b155
chore: make mock assertion compatible with jest (#778) 2022-02-18 11:14:54 +08:00
Anthony Fu
6e65e368c5 chore: update deps 2022-02-14 20:02:42 +08:00
Ivan Demchuk
4add1ebf9b
fix: update tinyspy with a fix for class mocks (fix #645) (#646) 2022-01-28 06:20:58 +08:00
Anthony Fu
374f9890b4 chore: update deps 2022-01-27 08:16:21 +08:00
Ivan Demchuk
36e6207403
docs: use vitest run mode for coverage examples (fix #602) (#611) 2022-01-23 18:11:56 +08:00
Anthony Fu
1b2406c078 chore: update deps 2022-01-19 13:34:06 +08:00
Vladimir
4dbefb59cd
feat: vi.mock can be called inside external libraries (#560)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-01-19 04:39:41 +08:00