-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(browser): improve error handling and don't rely on Node.js builti…
…n modules in browser mode (#4244)
- Loading branch information
1 parent
c05b11a
commit e7e8c3c
Showing
13 changed files
with
106 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,8 @@ | |
] | ||
}, | ||
"patchedDependencies": { | ||
"@types/[email protected]": "patches/@[email protected]" | ||
"@types/[email protected]": "patches/@[email protected]", | ||
"@sinonjs/[email protected]": "patches/@[email protected]" | ||
} | ||
}, | ||
"simple-git-hooks": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { startTests } from '@vitest/runner' | ||
export { startTests, processError } from '@vitest/runner' | ||
export { setupCommonEnv, loadDiffConfig } from './runtime/setup.common' | ||
export { takeCoverageInsideWorker, stopCoverageInsideWorker, getCoverageProvider, startCoverageInsideWorker } from './integrations/coverage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/src/fake-timers-src.js b/src/fake-timers-src.js | ||
index 607336d6a9c568a32b0cde4499c8fd56f06d424a..35187b0ee298df858118494b5a9b3e5efa8197b0 100644 | ||
--- a/src/fake-timers-src.js | ||
+++ b/src/fake-timers-src.js | ||
@@ -2,9 +2,9 @@ | ||
|
||
const globalObject = require("@sinonjs/commons").global; | ||
let timersModule; | ||
-if (typeof require === "function" && typeof module === "object") { | ||
+if (typeof __vitest_required__ !== 'undefined') { | ||
try { | ||
- timersModule = require("timers"); | ||
+ timersModule = __vitest_required__.timers; | ||
} catch (e) { | ||
// ignored | ||
} | ||
@@ -159,7 +159,7 @@ function withGlobal(_global) { | ||
hrtimePresent && typeof _global.process.hrtime.bigint === "function"; | ||
const nextTickPresent = | ||
_global.process && typeof _global.process.nextTick === "function"; | ||
- const utilPromisify = _global.process && require("util").promisify; | ||
+ const utilPromisify = _global.process && _global.__vitest_required__ && _global.__vitest_required__.util.promisify; | ||
const performancePresent = | ||
_global.performance && typeof _global.performance.now === "function"; | ||
const hasPerformancePrototype = |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.