MCPcopy Create free account
hub / github.com/rollup/rollup / runTestsWithCode

Function runTestsWithCode

test/misc/umd.js:139–182  ·  view source on GitHub ↗
(code, outputOptions, expectedExports)

Source from the content-addressed store, hash-verified

137}
138
139function 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
184for (const name of ['bundle', 'my.@nested/value.bundle'])
185 for (const compact of [false, true]) {

Callers 1

umd.jsFile · 0.70

Calls 2

runTestFunction · 0.85
getUmdCodePromiseFunction · 0.85

Tested by

no test coverage detected