264 Commits

Author SHA1 Message Date
Vladimir
5b760b0b00
fix: define default exports properties as named exports for ESM compatibility (#1979) 2022-09-05 11:13:02 +03:00
Vladimir
4131a52e1e
feat!: improve interchangeability with cjs (#1944) 2022-09-04 10:54:33 +03:00
Anthony Fu
456079ea73
feat: introduce retry option for tests (#1929) 2022-09-04 10:53:43 +03:00
Vladimir
51b5d8037e
fix: matcher toHaveProperty actually tests value (#1958) 2022-09-04 10:14:54 +03:00
cyly
03f7450957
fix: delete mock in moduleCache when unmock (#1947) 2022-09-02 14:08:38 +00:00
Vladimir
55049f4a4e
fix: make globalThis more compatible with jest (#1956)
* fix: make globalThis more compatible with jest

* chore: oops

* chore: cleanup

* chore: cleanup
2022-09-02 14:52:13 +03:00
Tony Trinh
51824896ba
fix(env-replacer): don't modify string literals (#1943)
* fix(env-replacer): don't modify string literals

fix #1941

* test(env-replacer): verify string literals are ignored

* chore: fix typo envRelacer.ts -> envReplacer.ts

* chore: fix typo envRelacer.ts -> envReplacer.ts

* chore: move strip-literal to correct package
2022-09-01 13:32:37 +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
renovate[bot]
a5d1ef498b
chore(deps): update all non-major dependencies (#1895)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-08-29 05:21:53 +00:00
Vladimir
5b190e8490
fix: improve error serialization (#1921) 2022-08-26 11:43:42 +03:00
Simon Abbott
285ac7c24e
fix: allow referring to first seen value while automocking (#1879) 2022-08-19 08:27:18 +03:00
Lioness100
f13e54f096
chore: fix typos (#1857)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-08-15 18:38:15 +00:00
Ari Perkkiö
265fdbe665
feat: support istanbul coverage provider (#1676)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-08-16 02:21:02 +08:00
Vladimir
95c1d34368
fix: Symbol.toStringTag on Module is non-enumerable (#1808) 2022-08-06 13:52:22 +03:00
Tanimodori
426503cb19
feat(types): better local test context support (#1805)
* feat(types): better local test context support

* feat(types): fix beforeEach and afterEach

* test: add unit test for local context
2022-08-06 13:43:51 +03:00
Vladimir
5141e0b9ba
feat: allow using todo/skip/concurrent with each (#1802) 2022-08-05 19:07:58 +03:00
Simon Abbott
b1cd7e71e0
fix: gracefully handle unsettable keys during automocking (#1786)
Sometimes while automocking we will encounter a property that, for some
unknown reason, throws an error when you try to define it. Unfortunately
I can't figure out _why_ it errors, so instead I have opted to quietly
skip these unsettable properties. If that becomes a problem in the
future this can be revisited, but I don't forsee it being an issue since
these keys are mostly deeply internal prototype stuff that 99.999% of
people don't even know exists, let alone want to mock. Plus, if you
_really_ need to have this behavior you can always use `__mocks__` or
just shim it inline yourself.
2022-08-05 18:52:13 +03:00
cyly
4a6aeb6c36
fix: toHaveProperty should judge object own property (#1795)
* fix: toHaveProperty should judge object own property

* test: add test
2022-08-05 08:34:25 +03:00
Vladimir
6ed32dd382
fix: better bundling of types (#1785)
* fix: better bundling of types

* chore: fix types clash
2022-08-04 14:18:17 +03:00
Vladimir
90f4995c84
fix: correctly restore globals in env teardown (#1774)
* fix: correctly restore globals in env teardown

* test: more tests
2022-08-02 18:37:09 +03:00
jfrs
c18f0af542
feat(types): add partial flag to mocked TypeScript helper (#1739) (#1742)
Co-authored-by: jfrs <jfrs@jfrs.me>
2022-08-02 10:11:55 +03:00
Vladimir
021aca2c60
fix(jsdom): use jsdom ArrayBuffer instead of Node, if jsdom is enabled (#1727)
* chore: cleanup lockfile

* fix: use jsdom ArrayBuffer instead of Node, if jsdom is enabled
2022-07-27 10:15:04 +03:00
Vladimir
68951e047f
fix: don't clear mocks with vi.resetModules, cache normalised mock paths (#1726)
* fix: don't reset mocks with vi.resetModules

* chore: reset mocks with --no-threads

* fix: normalize path when caching mocks
2022-07-27 10:14:53 +03:00
Vladimir
8247ed9fc0
feat: add mock snapshot serializer (#1717)
* feat: add mock snapshot serializer

* chore: cleanup
2022-07-25 13:07:44 +00:00
skarab42
35112e33d2
fix: toHaveProperty with expect.any (fix: #1675) (#1682)
* fix: toHaveProperty with expect.any (fix: #1675)

* refactor: use jestEquals and chai.util.getPathInfo

* refactor: use existing chai api
2022-07-24 09:48:46 +03:00
Vladimir
7c2138f2b0
feat: add alias option (#1634)
* chore: fix typeof check in error

* feat: add alias option

* Update test/core/vitest.config.ts
2022-07-19 17:44:21 +03:00
Simon Abbott
4aeeee092e
fix: mock properties of classes/functions (fix #1523) (#1648) 2022-07-16 23:08:10 +08:00
Ivan Demchuk
daf9886a5e
fix(types): fix test.each and describe.each types (#1653) 2022-07-16 23:06:30 +08:00
Joaquín Sánchez
ffa358517e
fix(reporter)!: move ctx.log to ctx.logger.log, improve log flicking (#1166)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-07-09 16:05:28 +08:00
Anthony Fu
695a7a2660 fix: move cache state to ctx.cache 2022-07-09 15:20:06 +08:00
Vladimir
5d0dfe9c6d
feat: make sequencer public, add option to run tests in random order (#1582)
* feat: make sequencer public, add random option

* test: cleanup

* chore: add random option to suite

* chore: cleanup

* chore: cleanup

* chore: cleanup

* chore: cleanup

* chore: cleanup

* chore: rename random -> shuffle

* Apply suggestions from code review

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>

* Update docs/config/index.md

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-07-06 10:08:22 +00:00
Vladimir
9c60757280
feat: add caching to run failed and longer tests first (#1541)
* feat: add caching to run failed and longer tests first

* chore: cleanup

* chore: add clearCache

* chore: update lockfile

* chore: add filesCache

* refactor: add sequelizer

* chore: lockfile

* refactor: renaming

* chore: dont override version

* chore: fix clearCache

* chore: guard slice

* chore: cleanup

* docs: cleanup

* chore: cleanup

* chore: remove command for now

* refactor: cleanup
2022-07-03 15:18:39 +03:00
Vladimir
7ad8e3fd20
fix: correctly create snapshot for rejected errors (#1567) 2022-07-01 14:33:18 +03:00
Kento Moriwaki
34b06dba59
fix: toFilePath with abs path in root (#1538) 2022-06-24 16:24:45 +03:00
Vladimir
b523120229
fix: return types for vi.mocked are now equal to MaybeMocked (#1511)
* fix: return types for vi.mocked are now equal to MaybeMocked

* chore: cleanup
2022-06-21 11:33:55 +03:00
Yuyao Nie
ebda666c75
fix: calculate label of graph node (#1431)
* fix: show full name for external mod at graph

* fix: calculate label of external mod
2022-06-17 13:04:30 +03:00
Vladimir Sheremet
58818f2d9a fix: parent is defined on global, closes #1489 2022-06-14 20:55:23 +03:00
Vladimir
0b639b1333
feat: introduce VITEST_POOL_ID (#1473)
* feat: introduce VITEST_POOL_ID

* fix: always increment worker id, pool id is always 1 in `--no-threads`
2022-06-13 18:39:29 +03:00
Vladimir
35ab058bac
feat: bind expect state to context (#1468)
* feat: bind expect state to context

This fixes calling expect.assertions inside concurrent

* refactor: cleanup

* chore: fix types

* chore: allow not passing expect to getMatcherContext
2022-06-13 10:21:21 +03:00
Vladimir
1660b59080
fix: null inside test.each is not turned into an empty array (#1462) 2022-06-11 04:35:05 +08:00
Vladimir
95ded47a13
fix: allow accessing Audio, Option and private jsdom props on global (#1443)
* fix: allow accessing Audio, Option on global

* chore: allow private jsdom properties on globalThis
2022-06-09 18:44:31 +02:00
Tommy Dew
842e0489f7
feat: improve deep equality check failing message for toBe (#1383) 2022-06-07 05:32:57 +08:00
Yuyao Nie
8452a7ded5
fix: resolve circular ref when cloning object (#1444) 2022-06-07 05:32:31 +08:00
Anthony Fu
a52d421187 chore: update 2022-06-05 23:18:44 +08:00
Vladimir
c5b7a72d25
fix: don't escape $ in snapshots, when not needed (#1401)
* fix: don't replace $ in snapshots, when not needed

* test: remove \ in test
2022-05-31 08:56:00 +03:00
Anthony Fu
c9a8fb04ca chore: clean up eslint 2022-05-29 23:13:48 +08:00
Anthony Fu
27be36554b chore: skip dynamicImportSettled test for now 2022-05-29 15:35:44 +08:00
Anthony Fu
90c11b2532 chore: try fix ci 2022-05-29 13:12:38 +08:00
Vladimir
17939379ed
feat: add dynamicImportSettled utility function (#1359) 2022-05-29 12:58:27 +08:00
Vladimir
89353aeb8e
fix: birpc using safe timers (#1379) 2022-05-27 11:36:57 +08:00