mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
remove unecessary patch
This commit is contained in:
parent
2eea1bf13c
commit
1876101cf5
@ -1,42 +0,0 @@
|
|||||||
diff --git a/dist/index.js b/dist/index.js
|
|
||||||
index 13af149aa3c44f52dd5c5a80db3bf5689dfe15ea..1d111032c3fdc104723e19dea49db62be8b79b94 100644
|
|
||||||
--- a/dist/index.js
|
|
||||||
+++ b/dist/index.js
|
|
||||||
@@ -6,26 +6,32 @@ import { processError } from '@vitest/utils/error';
|
|
||||||
import { util } from 'chai';
|
|
||||||
|
|
||||||
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
||||||
-const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
||||||
+// Patched this symbol for storybook, so that @storybook/test can be used in a jest environment as well.
|
|
||||||
+// Otherwise, vitest will override global jest matchers, and crash.
|
|
||||||
+const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object-storybook");
|
|
||||||
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
||||||
const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object");
|
|
||||||
|
|
||||||
if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
||||||
const globalState = /* @__PURE__ */ new WeakMap();
|
|
||||||
- const matchers = /* @__PURE__ */ Object.create(null);
|
|
||||||
- const customEqualityTesters = [];
|
|
||||||
- const assymetricMatchers = /* @__PURE__ */ Object.create(null);
|
|
||||||
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
||||||
get: () => globalState
|
|
||||||
});
|
|
||||||
+}
|
|
||||||
+if (!Object.prototype.hasOwnProperty.call(globalThis, JEST_MATCHERS_OBJECT)) {
|
|
||||||
+ const matchers = /* @__PURE__ */ Object.create(null);
|
|
||||||
+ const customEqualityTesters = [];
|
|
||||||
Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
|
|
||||||
configurable: true,
|
|
||||||
get: () => ({
|
|
||||||
- state: globalState.get(globalThis[GLOBAL_EXPECT]),
|
|
||||||
+ state: globalThis[MATCHERS_OBJECT].get(globalThis[GLOBAL_EXPECT]),
|
|
||||||
matchers,
|
|
||||||
customEqualityTesters
|
|
||||||
})
|
|
||||||
});
|
|
||||||
+}
|
|
||||||
+if (!Object.prototype.hasOwnProperty.call(globalThis, ASYMMETRIC_MATCHERS_OBJECT)) {
|
|
||||||
+ const assymetricMatchers = /* @__PURE__ */ Object.create(null);
|
|
||||||
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
||||||
get: () => assymetricMatchers
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user