(runName, runConfig)
| 115 | } |
| 116 | |
| 117 | function executeRun(runName, runConfig) { |
| 118 | // clone config |
| 119 | let overriddenConfig = { ...config } |
| 120 | |
| 121 | // get configuration |
| 122 | const browserConfig = runConfig.browser |
| 123 | const browserName = browserConfig.browser |
| 124 | |
| 125 | for (const key in browserConfig) { |
| 126 | overriddenConfig.helpers = replaceValueDeep(overriddenConfig.helpers, key, browserConfig[key]) |
| 127 | } |
| 128 | |
| 129 | let outputDir = `${runName}_` |
| 130 | if (browserConfig.outputName) { |
| 131 | outputDir += typeof browserConfig.outputName === 'function' ? browserConfig.outputName() : browserConfig.outputName |
| 132 | } else { |
| 133 | const hash = crypto.createHash('sha256') |
| 134 | hash.update(JSON.stringify(browserConfig)) |
| 135 | outputDir += hash.digest('hex') |
| 136 | } |
| 137 | outputDir += `_${runId}` |
| 138 | |
| 139 | outputDir = clearString(outputDir) |
| 140 | |
| 141 | // tweaking default output directories |
| 142 | overriddenConfig = replaceValueDeep(overriddenConfig, 'output', path.join(config.output, outputDir)) |
| 143 | overriddenConfig = replaceValueDeep(overriddenConfig, 'reportDir', path.join(config.output, outputDir)) |
| 144 | overriddenConfig = replaceValueDeep(overriddenConfig, 'mochaFile', path.join(config.output, outputDir, `${browserName}_report.xml`)) |
| 145 | |
| 146 | // override tests configuration |
| 147 | if (overriddenConfig.tests) { |
| 148 | overriddenConfig.tests = runConfig.tests |
| 149 | } |
| 150 | |
| 151 | if (overriddenConfig.gherkin && runConfig.gherkin && runConfig.gherkin.features) { |
| 152 | overriddenConfig.gherkin.features = runConfig.gherkin.features |
| 153 | } |
| 154 | |
| 155 | // override grep param and collect all params |
| 156 | const params = ['run', '--child', `${runId++}.${runName}:${browserName}`, '--override', JSON.stringify(overriddenConfig)] |
| 157 | |
| 158 | Object.keys(childOpts).forEach(key => { |
| 159 | params.push(`--${key}`) |
| 160 | if (childOpts[key] !== true) params.push(childOpts[key]) |
| 161 | }) |
| 162 | |
| 163 | if (runConfig.grep) { |
| 164 | params.push('--grep') |
| 165 | params.push(runConfig.grep) |
| 166 | } |
| 167 | |
| 168 | const onProcessEnd = errorCode => { |
| 169 | if (errorCode !== 0) { |
| 170 | process.exitCode = errorCode |
| 171 | } |
| 172 | subprocessCount += 1 |
| 173 | if (subprocessCount === totalSubprocessCount) { |
| 174 | processesDone() |
no test coverage detected