Closed hooman-mirghasemi closed 10 months ago
Can you please create a small repo with your configuration and all settings, otherwise I cannot debug it.
I found the problem when move cypressSplit(on, config); to end of function before return config; it works correctly but now the problem is this part of my code doesn't work any more:
on( 'after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => { if (results && results.video) {
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
)
if (!failures) {
fs.unlinkSync(results.video)
}
}
}
)
I think cypressSplit(on, config); some where rewrite the after:spec
Just need to add
on( 'after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => { console.log("ddd"); } )
after
cypressSplit(on, config);
config file will be like this:
`import { defineConfig } from 'cypress' import cypressSplit from 'cypress-split'
module.exports = defineConfig({ e2e: { // baseUrl, etc supportFile: false, fixturesFolder: false, video: false, setupNodeEvents(on, config) { cypressSplit(on, config);
on(
'after:spec',
(spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
console.log("ddd");
}
)
// IMPORTANT: return the config object
return config
},
}, })`
then you see:
cypress-split: here are passing spec timings { "durations": [] } cypress-split: spec timings unchanged
durations is empty in the console.
I test it with your repo: cypress-split-timings-example
Do you see the problem? how can I solve it? I want to use both of after:spec and cypressSplit(on, config); in my config file
Yeah, I think because this plugin and your code register on('after:spec'
callbacks, Cypress has a bug. Luckily I have a fix: https://github.com/bahmutov/cypress-on-fix
Thank you, it works Do you ever report this bug to the Cypress team?
yes
when I use CucumberPreprocessorPlugin my config is like this:
`
`
then timing.json does not update and also console log timing duration dose not show