Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(ignoreSnapshots): print a notice when ignoreSnapshots option is on (#17317)

Andrey Lushnikove295eea45059
diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts
index 6cd71b5016..144c188cb7 100644
--- a/packages/playwright-test/src/runner.ts
+++ b/packages/playwright-test/src/runner.ts
@@ -29,6 +29,7 @@ import { Loader } from './loader';
import type { FullResult, Reporter, TestError } from '../types/testReporter';
import { Multiplexer } from './reporters/multiplexer';
import { formatError } from './reporters/base';
+import { colors } from 'playwright-core/lib/utilsBundle';
import DotReporter from './reporters/dot';
import GitHubReporter from './reporters/github';
import LineReporter from './reporters/line';
@@ -401,6 +402,15 @@ export class Runner {
if (result.status !== 'passed')
return result;
+ if (config._ignoreSnapshots) {
+ this._reporter.onStdOut?.(colors.dim([
+ 'NOTE: running with "ignoreSnapshots" option. All of the following asserts are silently ignored:',
+ '- expect().toMatchSnapshot()',
+ '- expect().toHaveScreenshot()',
+ '',
+ ].join('\n')));
+ }
+
// 14. Run tests.
try {
const sigintWatcher = new SigIntWatcher();