MCPcopy
hub / github.com/angular/angular / patchJasmineIt

Function patchJasmineIt

packages/platform-browser/test/testing_public_spec.ts:926–942  ·  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 let resolve: (result: any) => void;
928 let reject: (error: any) => void;
929 const promise = new Promise((res, rej) => {
930 resolve = res;
931 reject = rej;
932 });
933 const jasmineEnv = jasmine.getEnv() as any;
934 originalJasmineIt = jasmineEnv.it;
935 jasmineEnv.it = (description: string, fn: (done: DoneFn) => void): any => {
936 const done = <DoneFn>(() => resolve(null));
937 done.fail = (err) => reject(err);
938 fn(done);
939 return null;
940 };
941 return promise;
942 };
943
944 const restoreJasmineIt = () => ((jasmine.getEnv() as any).it = originalJasmineIt);
945

Callers 1

Calls 3

rejectFunction · 0.85
resolveFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…