Skip to content

feat: log all tasks using custom messages #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions support.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,21 @@ const registerHooks = () => {
// we need to reset the coverage when running
// in the interactive mode, otherwise the counters will
// keep increasing every time we rerun the tests
// @ts-ignore
cy.task('resetCoverage', { isInteractive: Cypress.config('isInteractive') })
const logInstance = Cypress.log({
name: 'Coverage',
message: ['Reset [@cypress/code-coverage]']
})

cy.task(
'resetCoverage',
{
// @ts-ignore
isInteractive: Cypress.config('isInteractive')
},
{ log: false }
).then(() => {
logInstance.end()
})
})

beforeEach(() => {
Expand Down Expand Up @@ -105,7 +118,7 @@ const registerHooks = () => {
cy.on('window:load', saveCoverageObject)

// save reference if visiting a page inside a before() hook
cy.window().then(saveCoverageObject)
cy.window({ log: false }).then(saveCoverageObject)
})

afterEach(() => {
Expand Down Expand Up @@ -187,8 +200,19 @@ const registerHooks = () => {

after(function generateReport() {
// when all tests finish, lets generate the coverage report
cy.task('coverageReport', {
timeout: Cypress.moment.duration(3, 'minutes').asMilliseconds()
const logInstance = Cypress.log({
name: 'Coverage',
message: ['Generating report [@cypress/code-coverage]']
})
cy.task('coverageReport', null, {
timeout: Cypress.moment.duration(3, 'minutes').asMilliseconds(),
log: false
}).then(coverageReportFolder => {
logInstance.set('consoleProps', () => ({
'coverage report folder': coverageReportFolder
}))
logInstance.end()
return coverageReportFolder
})
})
}
Expand Down