mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
30 lines
851 B
JavaScript
30 lines
851 B
JavaScript
module.exports = {
|
|
meta: {
|
|
messages: {
|
|
noPlaywrightToMatchSnapshotAssertion: '"toHaveScreenshot" assertions should be used in favor of "toMatchSnapshot". "toHaveScreenshot" brings file size reductions and anti-flake behaviors such as disabling animations by default.',
|
|
},
|
|
},
|
|
create(context) {
|
|
return {
|
|
ExpressionStatement(node) {
|
|
if (node.expression.callee === undefined) {
|
|
return;
|
|
}
|
|
|
|
const { property } = node.expression.callee;
|
|
|
|
/**
|
|
* Check to see if toMatchSnapshot is being used
|
|
*/
|
|
if (
|
|
property !== undefined &&
|
|
property.type === 'Identifier' &&
|
|
property.name === 'toMatchSnapshot'
|
|
) {
|
|
context.report({ node: node, messageId: 'noPlaywrightToMatchSnapshotAssertion' });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|