MCPcopy Create free account
hub / github.com/ReactiveX/rxjs / createNativeContractScript

Function createNativeContractScript

packages/rxjs/test/kernel/run.mjs:54–83  ·  view source on GitHub ↗
(bundle)

Source from the content-addressed store, hash-verified

52}
53
54function createNativeContractScript(bundle) {
55 return `
56const done = arguments[arguments.length - 1];
57const platformMap = globalThis.Observable.prototype.map;
58${bundle}
59const runContract = (${runExtensionKernelContract.toString()});
60const expectedCases = ${JSON.stringify(extensionKernelCaseNames)};
61
62void runContract({
63 ObservableCtor: globalThis.Observable,
64 platformMap,
65 symbols: globalThis.__rxjsExtensionKernelPilot,
66}).then(
67 (completedCases) => {
68 try {
69 if (globalThis.Observable[Symbol.for('rxjs.observable.polyfill.info.v1')] !== undefined) {
70 throw new Error('The native kernel mode selected an RxJS-marked fallback');
71 }
72 if (JSON.stringify(completedCases) !== JSON.stringify(expectedCases)) {
73 throw new Error('The native kernel mode did not complete every case');
74 }
75 done({ completedCases, constructorName: globalThis.Observable.name, markedAsRxjsFallback: false });
76 } catch (error) {
77 done({ error: error?.stack ?? String(error) });
78 }
79 },
80 (error) => done({ error: error?.stack ?? String(error) })
81);
82`;
83}
84
85async function runNativeContract() {
86 const [config, browserLock, bundle] = await Promise.all([readConfig(), readBrowserLock(), buildBrowserBundle()]);

Callers 1

runNativeContractFunction · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected