From e295eea45059778e28f968be8b608b7f57134ab4 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 14 Sep 2022 09:16:41 -0700 Subject: [PATCH] fix(ignoreSnapshots): print a notice when ignoreSnapshots option is on (#17317) image --- packages/playwright-test/src/runner.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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();