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

Function heal

lib/command/generate.js:275–305  ·  view source on GitHub ↗
(genPath)

Source from the content-addressed store, hash-verified

273const healTemplate = fs.readFileSync(path.join(__dirname, '../template/heal.js'), 'utf8').toString()
274
275export async function heal(genPath) {
276 const testsPath = getTestRoot(genPath)
277
278 let configFile = path.join(testsPath, `codecept.conf.${extension}`)
279
280 if (!fileExists(configFile)) {
281 configFile = path.join(testsPath, `codecept.conf.${extension}`)
282 if (fileExists(configFile)) extension = 'ts'
283 }
284
285 output.print('Creating basic heal recipes')
286 output.print(`Add your own custom recipes to ./heal.${extension} file`)
287 output.print('Require this file in the config file and enable heal plugin:')
288 output.print('--------------------------')
289 output.print(`
290import './heal.js'
291
292export const config = {
293 // ...
294 plugins: {
295 heal: {
296 enabled: true
297 }
298 }
299}
300 `)
301
302 const healFile = path.join(testsPath, `heal.${extension}`)
303 if (!safeFileWrite(healFile, healTemplate)) return
304 output.success(`Heal recipes were created in ${healFile}`)
305}
306
307export async function prompt(promptName, genPath) {
308 if (!promptName) {

Callers

nothing calls this directly

Calls 3

getTestRootFunction · 0.90
fileExistsFunction · 0.90
safeFileWriteFunction · 0.90

Tested by

no test coverage detected