(code, outputOptions, expectedExports)
| 137 | } |
| 138 | |
| 139 | function runTestsWithCode(code, outputOptions, expectedExports) { |
| 140 | let umdCodePromise; |
| 141 | |
| 142 | function getUmdCodePromise() { |
| 143 | if (umdCodePromise) { |
| 144 | return umdCodePromise; |
| 145 | } |
| 146 | return (umdCodePromise = getUmdCode(code, outputOptions)); |
| 147 | } |
| 148 | |
| 149 | for (const { environmentName, runTest } of [ |
| 150 | { |
| 151 | environmentName: 'node', |
| 152 | runTest: runNodeTest |
| 153 | }, |
| 154 | { |
| 155 | environmentName: 'amd', |
| 156 | runTest: runAmdTest |
| 157 | }, |
| 158 | { |
| 159 | environmentName: 'iife with this', |
| 160 | runTest: runIifeTestWithThis |
| 161 | }, |
| 162 | { |
| 163 | environmentName: 'strict mode iife with self', |
| 164 | runTest: runStrictIifeTestWithSelf |
| 165 | }, |
| 166 | { |
| 167 | environmentName: 'strict mode iife with globalThis', |
| 168 | runTest: runStrictIifeTestWithGlobalThis |
| 169 | }, |
| 170 | { |
| 171 | environmentName: 'iife with existing globals', |
| 172 | runTest: runIifeWithExistingValuesTest |
| 173 | } |
| 174 | ]) |
| 175 | it(`works in ${environmentName} environment`, async () => { |
| 176 | assert.deepEqual( |
| 177 | runTest(await getUmdCodePromise(), outputOptions), |
| 178 | expectedExports, |
| 179 | 'expected exports are returned' |
| 180 | ); |
| 181 | }); |
| 182 | } |
| 183 | |
| 184 | for (const name of ['bundle', 'my.@nested/value.bundle']) |
| 185 | for (const compact of [false, true]) { |
no test coverage detected