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

Function finish

lib/command/init.js:205–330  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203 }
204
205 const finish = async () => {
206 const stepFile = `./steps_file.${extension}`
207 fs.writeFileSync(path.join(testsPath, stepFile), extension === 'ts' ? defaultActorTs : defaultActor)
208
209 config.include = { I: isTypeScript ? './steps_file.ts' : stepFile }
210
211 print(`Steps file created at ${stepFile}`)
212
213 let configSource
214 const hasConfigure = isLocal && !initPath
215
216 if (isTypeScript) {
217 configSource = beautify(`export const config : CodeceptJS.MainConfig = ${inspect(config, false, 4, false)}`)
218
219 if (hasConfigure) configSource = importCodeceptConfigure + configHeader + configSource
220
221 fs.writeFileSync(typeScriptconfigFile, configSource, 'utf-8')
222 print(`Config created at ${typeScriptconfigFile}`)
223 } else {
224 configSource = beautify(`/** @type {CodeceptJS.MainConfig} */\nexport const config = ${inspect(config, false, 4, false)}`)
225
226 if (hasConfigure) configSource = importCodeceptConfigure + configHeader + configSource
227
228 fs.writeFileSync(configFile, configSource, 'utf-8')
229 print(`Config created at ${configFile}`)
230 }
231
232 if (config.output) {
233 if (!fileExists(config.output)) {
234 mkdirp.sync(path.join(testsPath, config.output))
235 print(`Directory for temporary output files created at '${config.output}'`)
236 } else {
237 print(`Directory for temporary output files is already created at '${config.output}'`)
238 }
239 }
240
241 const jsconfig = {
242 compilerOptions: {
243 allowJs: true,
244 },
245 }
246
247 const tsconfig = {
248 compilerOptions: {
249 target: 'ES2022',
250 lib: ['ES2022', 'DOM'],
251 esModuleInterop: true,
252 module: 'ESNext',
253 moduleResolution: 'bundler',
254 strictNullChecks: false,
255 types: ['codeceptjs', 'node'],
256 declaration: true,
257 skipLibCheck: true,
258 },
259 exclude: ['node_modules'],
260 }
261
262 if (isTypeScript) {

Callers 3

init.jsFile · 0.70
onTestFinishedFunction · 0.50
parseInputFunction · 0.50

Calls 6

beautifyFunction · 0.90
fileExistsFunction · 0.90
installFunction · 0.85
successFunction · 0.85
printFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected