MCPcopy Create free account
hub / github.com/angular/components / splitBrowsersIntoInstances

Function splitBrowsersIntoInstances

test/karma.conf.js:139–150  ·  view source on GitHub ↗

* Splits the specified browsers into a maximum amount of chunks. The chunk of browsers * are being created deterministically and therefore we get reproducible tests when executing * the same CircleCI instance multiple times.

(browsers, maxInstances)

Source from the content-addressed store, hash-verified

137 * the same CircleCI instance multiple times.
138 */
139function splitBrowsersIntoInstances(browsers, maxInstances) {
140 let chunks = [];
141 let assignedBrowsers = 0;
142
143 for (let i = 0; i < maxInstances; i++) {
144 const chunkSize = Math.floor((browsers.length - assignedBrowsers) / (maxInstances - i));
145 chunks[i] = browsers.slice(assignedBrowsers, assignedBrowsers + chunkSize);
146 assignedBrowsers += chunkSize;
147 }
148
149 return chunks;
150}

Callers 1

karma.conf.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected