Skip to content

Instantly share code, notes, and snippets.

@sveneisenschmidt
Created March 5, 2018 19:06
Show Gist options
  • Save sveneisenschmidt/9588bdac4e21d7e2c3ed63f8824bf258 to your computer and use it in GitHub Desktop.
Save sveneisenschmidt/9588bdac4e21d7e2c3ed63f8824bf258 to your computer and use it in GitHub Desktop.
function runSuite(suite, suiteConf, browser) {
// Start: New Code
// check chunks, if chunks are set, expand suite
if(suiteConf.chunks && Number.isFinite(suiteConf.chunks)) {
let pattern = config.tests || null;
if (pattern) {
let forks = [];
let files = findFiles(pattern);
let chunkSize = Math.ceil(files.length/suiteConf.chunks);
let chunks = createChunks(files, chunkSize);
let chunkConfig = { ...suiteConf };
delete chunkConfig.chunks;
chunks.map((chunk, index) => {
const tests = createGlob(chunk);
const name = `${suite}-${index}`;
const fork = runSuite(name , { ...chunkConfig, tests }, browser);
if (Array.isArray(fork)) {
forks.push(...fork);
} else {
forks.push(fork);
}
});
if (forks.length > 0) {
return forks;
}
}
}
// End: New Code
// ...
if (!browser) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment