forked from graphql-hive/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest-jest.js
26 lines (25 loc) · 890 Bytes
/
vitest-jest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const { patchSymbols } = require('@whatwg-node/disposablestack');
patchSymbols();
module.exports = new Proxy(require('@jest/globals'), {
get(jestGlobals, prop, receiver) {
if (prop === 'vitest' || prop === 'vi') {
return jestGlobals.jest;
}
if (prop === 'describe') {
const describeFn = function describe(name, ...args) {
return jestGlobals.describe(name, ...args);
};
describeFn.skipIf = function describeSkipIf(condition) {
return condition ? describeFn.skip : describeFn;
};
describeFn.skip = function describeSkip(name, ...args) {
return jestGlobals.describe.skip(name, ...args);
};
describeFn.only = function describeOnly(name, ...args) {
return jestGlobals.describe.only(name, ...args);
};
return describeFn;
}
return Reflect.get(jestGlobals, prop, receiver);
},
});