MCPcopy Create free account
hub / github.com/angular/angular / patchJasmineIt

Function patchJasmineIt

packages/platform-browser/test/testing_public_spec.ts:926–937  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

924 let originalJasmineIt: (description: string, func: () => void) => jasmine.Spec;
925
926 const patchJasmineIt = () => {
927 const {promise, resolve, reject} = Promise.withResolvers<any>();
928 const jasmineEnv = jasmine.getEnv() as any;
929 originalJasmineIt = jasmineEnv.it;
930 jasmineEnv.it = (description: string, fn: (done: DoneFn) => void): any => {
931 const done = <DoneFn>(() => resolve(null));
932 done.fail = (err) => reject(err);
933 fn(done);
934 return null;
935 };
936 return promise;
937 };
938
939 const restoreJasmineIt = () => ((jasmine.getEnv() as any).it = originalJasmineIt);
940

Callers 1

Calls 4

rejectFunction · 0.85
withResolversMethod · 0.65
resolveFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected