MCPcopy
hub / github.com/jestjs/jest / patchJasmine

Function patchJasmine

packages/jest-jasmine2/src/setup_jest_globals.ts:68–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66};
67
68const patchJasmine = () => {
69 // @ts-expect-error: jasmine doesn't exist on globalThis
70 globalThis.jasmine.Spec = (realSpec => {
71 class Spec extends realSpec {
72 constructor(attr: Attributes) {
73 const resultCallback = attr.resultCallback;
74 attr.resultCallback = function (result: SpecResult) {
75 addSuppressedErrors(result);
76 addAssertionErrors(result);
77 resultCallback.call(attr, result);
78 };
79 const onStart = attr.onStart;
80 attr.onStart = (context: JasmineSpec) => {
81 jestExpect.setState({currentTestName: context.getFullName()});
82 onStart?.call(attr, context);
83 };
84 super(attr);
85 }
86 }
87
88 return Spec;
89 // @ts-expect-error: jasmine doesn't exist on globalThis
90 })(globalThis.jasmine.Spec);
91};
92
93export default async function setupJestGlobals({
94 config,

Callers 1

setupJestGlobalsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected