move to standard linter for simpler configuration

This commit is contained in:
JFH
2021-12-28 11:02:29 -03:00
parent 258e2bd6a1
commit fdcfc8a253
251 changed files with 19760 additions and 19935 deletions

View File

@@ -23,9 +23,9 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
/* globals Cypress */
// remove the style attributes that is causing differences in snapshots
const ngAttributes = [ 'style' ];
const ngAttributes = ['style']
Cypress.Commands.add(
'cleanSnapshot',
@@ -33,16 +33,16 @@ Cypress.Commands.add(
prevSubject: true
},
(subject, _snapshotOptions) => {
let html = subject[0].outerHTML;
let html = subject[0].outerHTML
for (const attribute of ngAttributes) {
const expression = new RegExp(`${attribute}[^= ]*="[^"]*"`, 'g');
html = html.replace(expression, '');
const expression = new RegExp(`${attribute}[^= ]*="[^"]*"`, 'g')
html = html.replace(expression, '')
}
html = html.replace(/<!--[\s\S]*?-->/g, '');
html = html.replace(/<!--[\s\S]*?-->/g, '')
const sanitisedBody = new DOMParser().parseFromString(html, 'text/html').querySelector('body');
const sanitisedBody = new DOMParser().parseFromString(html, 'text/html').querySelector('body')
return cy.wrap(sanitisedBody.firstChild).toMatchSnapshot();
return cy.wrap(sanitisedBody.firstChild).toMatchSnapshot()
}
);
)