MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / prepareChunks

Method prepareChunks

lib/command/run-multiple/collection.js:80–109  ·  view source on GitHub ↗

* Expands runs via the `chunks` property to multiple runs. If config.chunks is a numeric * value the list of scenario files is divided by this number. If config.chunks is a function, * the function with the list of scenario files itself is called.

(config)

Source from the content-addressed store, hash-verified

78 * the function with the list of scenario files itself is called.
79 */
80 prepareChunks(config) {
81 this.runs.forEach((run) => {
82 const runName = run.getName();
83 const runConfig = run.getConfig();
84 const patterns = [];
85 patterns.push(run.tests || config.tests);
86
87 if (config.gherkin && config.gherkin.features) {
88 patterns.push(config.gherkin.features);
89 }
90
91 if (!runConfig.chunks || !patterns.length) {
92 return;
93 }
94
95 if (runConfig.gherkin && config.gherkin.features) {
96 patterns.push(runConfig.gherkin.features);
97 }
98
99 createChunks(runConfig, patterns).forEach((runChunkConfig, index) => {
100 const run = createRun(`${runName}:chunk${index + 1}`, runChunkConfig);
101 run.setOriginalName(runName);
102 this.addRun(run);
103 });
104
105 this.removeRun(runName);
106 });
107
108 return this;
109 }
110
111 /**
112 * Expands browser declared via `browsers` property to multiple

Callers 1

createRunsFunction · 0.80

Calls 8

addRunMethod · 0.95
removeRunMethod · 0.95
createChunksFunction · 0.90
createRunFunction · 0.90
getNameMethod · 0.80
pushMethod · 0.80
setOriginalNameMethod · 0.80
getConfigMethod · 0.45

Tested by

no test coverage detected