[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

perf: bundle vitest's own dependencies (#10685)

authored by

Vladimir and committed by
GitHub
(Jul 24, 2026, 9:45 AM +0200) c050842b d8b040c6

+238 -36
+15 -18
pnpm-lock.yaml
··· 1017 1017 '@vitest/mocker': 1018 1018 specifier: workspace:* 1019 1019 version: link:../mocker 1020 - '@vitest/pretty-format': 1021 - specifier: workspace:* 1022 - version: link:../pretty-format 1023 - '@vitest/spy': 1024 - specifier: workspace:* 1025 - version: link:../spy 1026 1020 '@vitest/ui': 1027 1021 specifier: workspace:* 1028 1022 version: link:../ui 1029 - '@vitest/utils': 1030 - specifier: workspace:* 1031 - version: link:../utils 1032 1023 chai: 1033 1024 specifier: 'catalog:' 1034 1025 version: 6.2.2 ··· 1044 1035 obug: 1045 1036 specifier: 'catalog:' 1046 1037 version: 2.1.1 1047 - pathe: 1048 - specifier: 'catalog:' 1049 - version: 2.0.3 1050 1038 picomatch: 1051 1039 specifier: ^4.0.3 1052 1040 version: 4.0.3 ··· 1062 1050 tinyglobby: 1063 1051 specifier: 'catalog:' 1064 1052 version: 0.2.15 1065 - tinyrainbow: 1066 - specifier: 'catalog:' 1067 - version: 3.1.0 1068 1053 why-is-node-running: 1069 1054 specifier: ^2.3.0 1070 1055 version: 2.3.0 ··· 1111 1096 '@vitest/expect': 1112 1097 specifier: workspace:* 1113 1098 version: link:../expect 1099 + '@vitest/pretty-format': 1100 + specifier: workspace:* 1101 + version: link:../pretty-format 1114 1102 '@vitest/snapshot': 1115 1103 specifier: workspace:* 1116 1104 version: link:../snapshot 1105 + '@vitest/spy': 1106 + specifier: workspace:* 1107 + version: link:../spy 1108 + '@vitest/utils': 1109 + specifier: workspace:* 1110 + version: link:../utils 1117 1111 acorn: 1118 1112 specifier: 8.11.3 1119 1113 version: 8.11.3(patch_hash=62f89b815dbd769c8a4d5b19b1f6852f28922ecb581d876c8a8377d05c2483c4) ··· 1141 1135 mime: 1142 1136 specifier: ^4.1.0 1143 1137 version: 4.1.0 1138 + pathe: 1139 + specifier: 'catalog:' 1140 + version: 2.0.3 1144 1141 prompts: 1145 1142 specifier: ^2.4.2 1146 1143 version: 2.4.2 ··· 1150 1147 tinyhighlight: 1151 1148 specifier: 'catalog:' 1152 1149 version: 0.3.2(picocolors@1.1.1) 1150 + tinyrainbow: 1151 + specifier: 'catalog:' 1152 + version: 3.1.0 1153 1153 vite: 1154 1154 specifier: 8.0.11 1155 1155 version: 8.0.11(@types/node@24.12.0)(esbuild@0.27.3)(jiti@2.6.1)(sass-embedded@1.97.3)(sass@1.97.3)(terser@5.48.0)(tsx@4.21.0)(yaml@2.8.2) ··· 1468 1468 tinyexec: 1469 1469 specifier: ^1.0.2 1470 1470 version: 1.0.2 1471 - tinyrainbow: 1472 - specifier: 'catalog:' 1473 - version: 3.1.0 1474 1471 vite: 1475 1472 specifier: 8.0.11 1476 1473 version: 8.0.11(@types/node@24.12.0)(esbuild@0.27.3)(jiti@2.6.1)(sass-embedded@1.97.3)(sass@1.97.3)(terser@5.48.0)(tsx@4.21.0)(yaml@2.8.2)
+2 -1
scripts/build-utils.js
··· 12 12 /** 13 13 * @returns {import('rollup').Plugin[]} plugins 14 14 */ 15 - isolatedDecl() { 15 + isolatedDecl(options = {}) { 16 16 return [ 17 17 isolatedDecl({ 18 18 transformer: 'oxc', ··· 20 20 // exclude direct imports to other package sources 21 21 include: path.join(process.cwd(), '**/*.ts'), 22 22 extraOutdir: isolatedDeclDir, 23 + ...options, 23 24 }), 24 25 { 25 26 name: 'isolated-decl-dts-extra',
+1
packages/utils/display.d.ts
··· 1 + export * from './dist/display.js'
+13 -1
packages/utils/package.json
··· 17 17 "sideEffects": false, 18 18 "exports": { 19 19 ".": { 20 + "__vitest_source__": "./src/index.ts", 20 21 "types": "./dist/index.d.ts", 21 22 "default": "./dist/index.js" 22 23 }, 23 24 "./diff": { 25 + "__vitest_source__": "./src/diff/index.ts", 24 26 "types": "./dist/diff.d.ts", 25 27 "default": "./dist/diff.js" 26 28 }, 27 29 "./resolver": { 30 + "__vitest_source__": "./src/resolver.ts", 28 31 "types": "./dist/resolver.d.ts", 29 32 "default": "./dist/resolver.js" 30 33 }, 31 34 "./error": { 35 + "__vitest_source__": "./src/error.ts", 32 36 "types": "./dist/error.d.ts", 33 37 "default": "./dist/error.js" 34 38 }, 35 39 "./helpers": { 40 + "__vitest_source__": "./src/helpers.ts", 36 41 "types": "./dist/helpers.d.ts", 37 42 "default": "./dist/helpers.js" 38 43 }, 39 44 "./offset": { 45 + "__vitest_source__": "./src/offset.ts", 40 46 "types": "./dist/offset.d.ts", 41 47 "default": "./dist/offset.js" 42 48 }, 43 49 "./constants": { 50 + "__vitest_source__": "./src/constants.ts", 44 51 "types": "./dist/constants.d.ts", 45 52 "default": "./dist/constants.js" 46 53 }, 47 54 "./timers": { 55 + "__vitest_source__": "./src/timers.ts", 48 56 "types": "./dist/timers.d.ts", 49 57 "default": "./dist/timers.js" 50 58 }, 51 59 "./display": { 60 + "__vitest_source__": "./src/display.ts", 52 61 "types": "./dist/display.d.ts", 53 62 "default": "./dist/display.js" 54 63 }, 55 64 "./source-map": { 65 + "__vitest_source__": "./src/source-map.ts", 56 66 "types": "./dist/source-map.d.ts", 57 67 "default": "./dist/source-map.js" 58 68 }, 59 69 "./source-map/node": { 70 + "__vitest_source__": "./src/source-map/node.ts", 60 71 "types": "./dist/source-map/node.d.ts", 61 72 "default": "./dist/source-map/node.js" 62 73 }, 63 74 "./serialize": { 75 + "__vitest_source__": "./src/serialize.ts", 64 76 "types": "./dist/serialize.d.ts", 65 77 "default": "./dist/serialize.js" 66 78 }, 67 - "./*": "./*" 79 + "./package.json": "./package.json" 68 80 }, 69 81 "main": "./dist/index.js", 70 82 "module": "./dist/index.js",
+1
packages/utils/timers.d.ts
··· 1 + export * from './dist/timers.js'
+164
packages/vitest/LICENSE.md
··· 316 316 317 317 --------------------------------------- 318 318 319 + ## convert-source-map 320 + License: MIT 321 + By: Thorsten Lorenz 322 + Repository: git://github.com/thlorenz/convert-source-map.git 323 + 324 + > Copyright 2013 Thorsten Lorenz. 325 + > All rights reserved. 326 + > 327 + > Permission is hereby granted, free of charge, to any person 328 + > obtaining a copy of this software and associated documentation 329 + > files (the "Software"), to deal in the Software without 330 + > restriction, including without limitation the rights to use, 331 + > copy, modify, merge, publish, distribute, sublicense, and/or sell 332 + > copies of the Software, and to permit persons to whom the 333 + > Software is furnished to do so, subject to the following 334 + > conditions: 335 + > 336 + > The above copyright notice and this permission notice shall be 337 + > included in all copies or substantial portions of the Software. 338 + > 339 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 340 + > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 341 + > OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 342 + > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 343 + > HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 344 + > WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 345 + > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 346 + > OTHER DEALINGS IN THE SOFTWARE. 347 + 348 + --------------------------------------- 349 + 350 + ## diff-sequences 351 + License: MIT 352 + Repository: https://github.com/jestjs/jest.git 353 + 354 + > MIT License 355 + > 356 + > Copyright (c) Meta Platforms, Inc. and affiliates. 357 + > 358 + > Permission is hereby granted, free of charge, to any person obtaining a copy 359 + > of this software and associated documentation files (the "Software"), to deal 360 + > in the Software without restriction, including without limitation the rights 361 + > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 362 + > copies of the Software, and to permit persons to whom the Software is 363 + > furnished to do so, subject to the following conditions: 364 + > 365 + > The above copyright notice and this permission notice shall be included in all 366 + > copies or substantial portions of the Software. 367 + > 368 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 369 + > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 370 + > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 371 + > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 372 + > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 373 + > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 374 + > SOFTWARE. 375 + 376 + --------------------------------------- 377 + 319 378 ## flatted 320 379 License: ISC 321 380 By: Andrea Giammarchi ··· 519 578 520 579 --------------------------------------- 521 580 581 + ## pathe 582 + License: MIT 583 + Repository: unjs/pathe 584 + 585 + > MIT License 586 + > 587 + > Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev> 588 + > 589 + > Permission is hereby granted, free of charge, to any person obtaining a copy 590 + > of this software and associated documentation files (the "Software"), to deal 591 + > in the Software without restriction, including without limitation the rights 592 + > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 593 + > copies of the Software, and to permit persons to whom the Software is 594 + > furnished to do so, subject to the following conditions: 595 + > 596 + > The above copyright notice and this permission notice shall be included in all 597 + > copies or substantial portions of the Software. 598 + > 599 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 600 + > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 601 + > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 602 + > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 603 + > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 604 + > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 605 + > SOFTWARE. 606 + > 607 + > --- 608 + > 609 + > Copyright Joyent, Inc. and other Node contributors. 610 + > 611 + > Permission is hereby granted, free of charge, to any person obtaining a 612 + > copy of this software and associated documentation files (the 613 + > "Software"), to deal in the Software without restriction, including 614 + > without limitation the rights to use, copy, modify, merge, publish, 615 + > distribute, sublicense, and/or sell copies of the Software, and to permit 616 + > persons to whom the Software is furnished to do so, subject to the 617 + > following conditions: 618 + > 619 + > The above copyright notice and this permission notice shall be included 620 + > in all copies or substantial portions of the Software. 621 + > 622 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 623 + > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 624 + > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 625 + > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 626 + > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 627 + > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 628 + > USE OR OTHER DEALINGS IN THE SOFTWARE. 629 + > 630 + > --- 631 + > 632 + > Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch) 633 + > 634 + > The MIT License (MIT) 635 + > 636 + > Copyright (c) 2023-present Fabio Spampinato 637 + > 638 + > Permission is hereby granted, free of charge, to any person obtaining a 639 + > copy of this software and associated documentation files (the "Software"), 640 + > to deal in the Software without restriction, including without limitation 641 + > the rights to use, copy, modify, merge, publish, distribute, sublicense, 642 + > and/or sell copies of the Software, and to permit persons to whom the 643 + > Software is furnished to do so, subject to the following conditions: 644 + > 645 + > The above copyright notice and this permission notice shall be included in 646 + > all copies or substantial portions of the Software. 647 + > 648 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 649 + > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 650 + > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 651 + > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 652 + > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 653 + > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 654 + > DEALINGS IN THE SOFTWARE. 655 + 656 + --------------------------------------- 657 + 522 658 ## prompts 523 659 License: MIT 524 660 By: Terkel Gjervig ··· 716 852 > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 717 853 > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 718 854 > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 855 + 856 + --------------------------------------- 857 + 858 + ## tinyrainbow 859 + License: MIT 860 + Repository: git+https://github.com/tinylibs/tinyrainbow.git 861 + 862 + > MIT License 863 + > 864 + > Copyright (c) 2022 Tinylibs 865 + > 866 + > Permission is hereby granted, free of charge, to any person obtaining a copy 867 + > of this software and associated documentation files (the "Software"), to deal 868 + > in the Software without restriction, including without limitation the rights 869 + > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 870 + > copies of the Software, and to permit persons to whom the Software is 871 + > furnished to do so, subject to the following conditions: 872 + > 873 + > The above copyright notice and this permission notice shall be included in all 874 + > copies or substantial portions of the Software. 875 + > 876 + > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 877 + > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 878 + > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 879 + > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 880 + > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 881 + > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 882 + > SOFTWARE. 719 883 720 884 --------------------------------------- 721 885
+5 -5
packages/vitest/package.json
··· 169 169 "dependencies": { 170 170 "@types/chai": "catalog:", 171 171 "@vitest/mocker": "workspace:*", 172 - "@vitest/pretty-format": "workspace:*", 173 - "@vitest/spy": "workspace:*", 174 - "@vitest/utils": "workspace:*", 175 172 "chai": "catalog:", 176 173 "es-module-lexer": "^2.0.0", 177 174 "expect-type": "^1.3.0", 178 175 "magic-string": "catalog:", 179 176 "obug": "catalog:", 180 - "pathe": "catalog:", 181 177 "picomatch": "^4.0.3", 182 178 "std-env": "catalog:", 183 179 "tinybench": "catalog:", 184 180 "tinyexec": "^1.0.2", 185 181 "tinyglobby": "catalog:", 186 - "tinyrainbow": "catalog:", 187 182 "why-is-node-running": "^2.3.0" 188 183 }, 189 184 "devDependencies": { ··· 201 196 "@types/picomatch": "^4.0.2", 202 197 "@types/prompts": "^2.4.9", 203 198 "@vitest/expect": "workspace:*", 199 + "@vitest/pretty-format": "workspace:*", 204 200 "@vitest/snapshot": "workspace:*", 201 + "@vitest/spy": "workspace:*", 202 + "@vitest/utils": "workspace:*", 205 203 "acorn": "8.11.3", 206 204 "acorn-walk": "catalog:", 207 205 "birpc": "catalog:", ··· 211 209 "jsdom": "^29.1.1", 212 210 "local-pkg": "^1.1.2", 213 211 "mime": "^4.1.0", 212 + "pathe": "catalog:", 214 213 "prompts": "^2.4.2", 215 214 "strip-literal": "catalog:", 216 215 "tinyhighlight": "catalog:", 216 + "tinyrainbow": "catalog:", 217 217 "vite": "^6.4.0 || ^7.0.0 || ^8.0.0", 218 218 "ws": "catalog:" 219 219 }
+22 -5
packages/vitest/rollup.config.js
··· 71 71 'vitest/optional-types.js', 72 72 'vitest/browser', 73 73 'vite/module-runner', 74 - '@vitest/utils/diff', 75 - '@vitest/utils/error', 76 - '@vitest/utils/source-map', 77 - /@vitest\/utils\/\w+/, 78 74 /@vitest\/mocker\/\w+/, 79 75 80 76 '#module-evaluator', ··· 116 112 dir: 'dist', 117 113 format: 'esm', 118 114 chunkFileNames: 'chunks/[name].[hash].js', 115 + manualChunks(id) { 116 + // `tinyrainbow`'s default export is a single mutable color object whose 117 + // `isColorSupported` flag and formatters are toggled at runtime (e.g. 118 + // `disableDefaultColors()`). If it is inlined into several chunks each 119 + // copy has its own object, so disabling colors on one no longer affects 120 + // the others. Pin it to ONE shared chunk so every consumer in a process 121 + // mutates the same instance. 122 + if (/[\\/]tinyrainbow[\\/]/.test(id)) { 123 + return 'tinyrainbow' 124 + } 125 + }, 119 126 }, 120 127 external, 121 128 moduleContext: (id) => { ··· 153 160 }, 154 161 watch: false, 155 162 external, 156 - plugins: dtsUtils.dts(), 163 + plugins: [ 164 + ...dtsUtils.dts(), 165 + { 166 + name: 'vitest-bundle-optional-types', 167 + resolveId(source) { 168 + if (source === '@vitest/spy/optional-types.js') { 169 + return 'vitest/optional-runtime-types.js' 170 + } 171 + }, 172 + }, 173 + ], 157 174 }, 158 175 ]) 159 176
+5 -4
test/test-utils/index.ts
··· 19 19 import { inspect, stripVTControlCharacters } from 'node:util' 20 20 import { dirname, relative, resolve } from 'pathe' 21 21 import { x } from 'tinyexec' 22 - import * as tinyrainbow from 'tinyrainbow' 23 22 import { afterEach, onTestFinished, TestRunner } from 'vitest' 24 - import { Logger, PluginHarness, resolveConfig, startVitest } from 'vitest/node' 23 + import { disableDefaultColors, Logger, PluginHarness, resolveConfig, startVitest } from 'vitest/node' 25 24 import { Cli } from './cli' 26 25 27 - // override default colors to disable them in tests 28 - Object.assign(tinyrainbow.default, tinyrainbow.getDefaultColors()) 26 + // Vitest bundles its own `tinyrainbow` instance (see rollup `manualChunks`), which 27 + // is a different object than the one imported above. Disable colors on it too so 28 + // reporter output captured in tests is deterministic regardless of `CI`/`FORCE_COLOR`. 29 + disableDefaultColors() 29 30 30 31 export interface VitestRunnerCLIOptions { 31 32 std?: 'inherit'
-1
test/test-utils/package.json
··· 8 8 }, 9 9 "devDependencies": { 10 10 "tinyexec": "^1.0.2", 11 - "tinyrainbow": "catalog:", 12 11 "vite": "latest", 13 12 "vitest": "workspace:*" 14 13 }
+1
test/unit/test/exports.test.ts
··· 110 110 "createViteLogger": "function", 111 111 "createViteServer": "function", 112 112 "createVitest": "function", 113 + "disableDefaultColors": "function", 113 114 "distDir": "string", 114 115 "esbuildVersion": "string", 115 116 "escapeTestName": "function",
+6
packages/vitest/src/public/node.ts
··· 191 191 RunnerTestSuite, 192 192 } from './index' 193 193 export type { SerializedError } from '@vitest/utils' 194 + // Re-exported from Vitest's own bundled `tinyrainbow` instance. Vitest inlines 195 + // `tinyrainbow` into its dist, so importing the package directly gives a different 196 + // object than the one the reporters use; this export lets programmatic consumers 197 + // (e.g. the test suite) disable ANSI colors on the instance Vitest actually renders 198 + // with. 199 + export { disableDefaultColors } from 'tinyrainbow' 194 200 195 201 export { 196 202 esbuildVersion,
+3 -1
packages/vitest/src/runtime/workers/base.ts
··· 7 7 import * as spyModule from '@vitest/spy' 8 8 import { setupChaiConfig } from '../../integrations/chai/config' 9 9 import { loadEnvironment } from '../../integrations/env/loader' 10 - import { NativeModuleRunner } from '../../utils/nativeModuleRunner' 11 10 import { Traces } from '../../utils/traces' 12 11 import { emitModuleRunner } from '../listeners' 13 12 import { listenForErrors } from '../moduleRunner/errorCatcher' ··· 55 54 spyModule, 56 55 }) 57 56 } 57 + // imported lazily (pulls in `local-pkg`) so it stays out of the default 58 + // worker startup graph; only the `viteModuleRunner: false` path needs it 59 + const { NativeModuleRunner } = await import('../../utils/nativeModuleRunner') 58 60 _moduleRunner = new NativeModuleRunner( 59 61 root, 60 62 mocker,