@revoloo/cypress6
Version:
Cypress.io end to end testing tool
23 lines (20 loc) • 683 B
JavaScript
const execa = require('execa-wrap')
const snapshot = require('snap-shot-it')
function normalize (s) {
// assuming the test command tests this spec file
// and the command is hardcoded in package.json
// using forward slashes
return s.replace(process.cwd(), '<folder path>')
.replace(/passing \(\d+ms\)/, 'passing (<time>ms)')
.replace(/cypress@(\d+\.\d+\.\d+)/, 'cypress@x.y.z')
.replace(/✓/g, 'Y') // Mocha check on Mac
.replace(/√/g, 'Y') // Mocha check on Windows
}
/* eslint-env mocha */
describe('mocha snapshot', () => {
it('captures mocha output', () => {
return execa('npm', ['run', 'test-mocha'])
.then(normalize)
.then(snapshot)
})
})