(testName: string, test: () => void, postCb: () => void = () => {})
| 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. |
no test coverage detected