465 Commits

Author SHA1 Message Date
Vladimir
f00a1ac228
docs: add information about benchmarking (#2001) 2022-09-10 15:54:55 +08:00
Vladimir
209ea6ba87
fix: correctly normalize mocked path, if file is named like the folder (#1973)
* fix: correctly normalize mocked path, if file is named like the folder

* chore: cleanup
2022-09-05 11:13:51 +03:00
Vladimir
5b760b0b00
fix: define default exports properties as named exports for ESM compatibility (#1979) 2022-09-05 11:13:02 +03:00
yoho
43ba8723a6
feat: benchmark (#1029)
* feat: benchmark

* feat: console result

* chore: lockfile

* chore: rebase

* chore: lock.yaml

* chore: pnpm lock yaml

* chore: update

* feat: collect benchmark

* chore: benchmark use suite collect bench

* chore: run

* chore: lock.yaml?

* feat: render

* chore: revert lock.yml

* chore: update

* feat: options.reports

* chore: update

* chore: async

* chore: defer

* chore: add options

* feat: warn

* chore: update

* feat: sort render

* chore: update

* chore: pnpm lock

* fix: import

* fix: types

* fix: types

* chore: build location

* fix: lint

* fix: lint

* feat: tinybench@2.1.3

* chore: update lock

* chore: reduce benchmark test time

* fix: render

* chore: rename

* feat: dynamic import tinybench

* chore: update

* chore: update sort rules

* feat: bench test

* chore: update test

* chore: update

* feat!: run mode

* feat: throw error on wrong mode

* chore: lint

* chore: cleanup

* chore: update output

* chore: remove options.benchmark is not used in viteConfig.test when command is not benchmark

* chore: update ops/sec

* feat: json reporter

* chore: ignore sample output on terminal

* chore: update

* chore: update

* fix: actually run tests

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
Co-authored-by: Vladimir Sheremet <sleuths.slews0s@icloud.com>
2022-09-04 14:55:44 +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
f32383a3ef
feat!: if not processed, CSS Modules return a proxy, scope class names by filename (#1803) 2022-09-04 10:53:09 +03:00
Ari Perkkiö
5bfd3c9a40
feat(coverage-istanbul): add "all" option (#1880) 2022-09-04 10:41:54 +03:00
Vladimir
51b5d8037e
fix: matcher toHaveProperty actually tests value (#1958) 2022-09-04 10:14:54 +03:00
Vladimir
e393be3414
feat: allow custom environments (#1963)
* feat: allow custom environments

* chore: linting

* chore: cleanup

Co-authored-by: Ivan Demchuk <ivan.demchuk@gmail.com>

* chore: cleanup

Co-authored-by: Ivan Demchuk <ivan.demchuk@gmail.com>

* chore: cleanup

* docs: cleanup

* docs: cleanup

* Update docs/guide/environment.md

Co-authored-by: Ivan Demchuk <ivan.demchuk@gmail.com>

Co-authored-by: Ivan Demchuk <ivan.demchuk@gmail.com>
2022-09-04 09:37:11 +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
azaleta
44b7fce994
fix(reporter): correct error source position in json report (#1909)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-08-29 22:06:32 +08: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
sun0day
88d5764894
fix: invalidate new worker and its dependencies (#1896) 2022-08-23 15:50:20 +03:00
Chris Towles
b35f42dbce
fix(reporter-junit): escape XML when in error message (fix: #1823) (#1890) 2022-08-23 16:14:21 +08: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
Anthony Fu
1d15efa9c1 chore: revert test file changes 2022-08-16 00:48:46 +08:00
Anthony Fu
1a429ed110 test: try bypass windows error 2022-08-16 00:21:02 +08:00
Anthony Fu
f34f2c1977 test: skip custom reporters on macOS 2022-08-15 17:54:28 +08:00
Anthony Fu
5adbf4b9a5 test: fix fs.rm 2022-08-15 17:53:14 +08:00
Anthony Fu
e6eb09abee chore: update fetch url 2022-08-15 17:01:53 +08:00
Anthony Fu
9917bb4814 chore: fix windows test 2022-08-15 16:55:41 +08:00
Anthony Fu
b70593955f
chore: update deps (#1853) 2022-08-15 15:13:37 +08:00
Anthony Fu
5ca2e16ebb test: improve reporter tests 2022-08-15 14:43:28 +08:00
Yuyao Nie
fbc9394329
fix(reporter-junit): remove trailing zeros in duration (#1842) 2022-08-15 14:05:14 +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
Vladimir
155943c5b6
feat: treat pseudo ESM as ESM with custom loader, disable custom Node Loader by default (#1778)
* feat: treat pseudo ESM as ESM

* chore: remove empty main fields

* chore: cleanup

* chore: disable node loader by default

* chore: cleanup

* chore: register loader for esm test

* chore: don't disable loader for now

* chore: revert

* chore: cleanup

* chore disable node loader by default

* chore: disable Node Loader tests
2022-08-05 18:43:42 +03:00
Vladimir
1a0d34bd8c
feat: allow timeout in test.each (#1787) 2022-08-05 08:34:39 +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 Sheremet
a59cefc146 chore: extend vite-node timeout 2022-08-04 13:45:28 +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
0e62002982
refactor: update Enzym example, upgrade Vue plugin (#1755) 2022-08-02 15:07:32 +08: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
06090cc815
revert: use importModule to load env, revert #1667
* fix: don't resolve test env import when transforming files

* chore: add happy-dom to dependencies to coverage test

* revert: use importModule to load env, revert #1667
2022-07-25 16:27:36 +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
Anthony Fu
88033bca99
feat: init @vitest/browser package (#1302)
Co-authored-by: Joaquín Sánchez Jiménez <joaquin.sanchez@fi2net.es>
Co-authored-by: userquin <userquin@gmail.com>
Co-authored-by: M. Bagher Abiat <zorofight94@gmail.com>
2022-07-20 03:37:45 +08: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