MCPcopy
hub / github.com/jvilk/BrowserFS / generateTest

Function generateTest

test/harness/setup.ts:89–113  ·  view source on GitHub ↗
(testName: string, test: () => void, postCb: () => void = () => {})

Source from the content-addressed store, hash-verified

87
88 // Generates a Jasmine unit test from a CommonJS test.
89 function generateTest(testName: string, test: () => void, postCb: () => void = () => {}) {
90 it(testName, function (done: (e?: any) => void) {
91 // Reset the exit callback.
92 process.removeAllListeners('exit');
93 test();
94 waitsFor(() => {
95 return __numWaiting === 0;
96 }, "All callbacks should fire", timeout, (e?: Error) => {
97 if (e) {
98 postCb();
99 done(e);
100 } else {
101 // Run the exit callback, if any.
102 process.exit(0);
103 process.removeAllListeners('exit');
104 waitsFor(() => {
105 return __numWaiting === 0;
106 }, "All callbacks should fire", timeout, (e?: Error) => {
107 postCb();
108 done(e);
109 });
110 }
111 });
112 });
113 }
114
115 function generateEmscriptenTest(testName: string, test: (module: any) => void) {
116 // Only applicable to typed array-compatible browsers.

Callers 3

generateEmscriptenTestFunction · 0.85
generateBackendTestsFunction · 0.85
generateAllTestsFunction · 0.85

Calls 2

waitsForFunction · 0.85
doneFunction · 0.50

Tested by

no test coverage detected