I have this hook in my cypress.config.ts
:
...
on('after:run', async () => {
console.log('override after:run')
await exec('touch ./cypress/reports/test.txt')
await exec(
'npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml'
)
await afterRunHook()
})
...
The touch
command works fine, but the jre
don't produce the junitreport.xml
file or any other output.
If I run npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml
on the command line it works just fine.
I have also tried with ./node_modules/.bin/jre
instead of npx jrm
as well as node ./node_modules/.bin/jre
but to no avail.
What am I missing here?
Using the execSync()
instead of exec()
works:
on('after:run', async () => {
console.log('override after:run')
await execSync(
'node ./node_modules/.bin/jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit/*.xml > ./cypress/reports/jrm-log.txt 2>&1'
)
await afterRunHook()
})