playwright/packages/playwright-test/src
Ross Wollman dadb5cbc30
fix(html reporter): fix too much strikethrough in diffs (#11115)
Textual snapshot diffs were previously broken in the HTML Report. The strikethrough'd text extended beyond the intended region.

HTML Report Before: 
<img width="693" alt="Screen Shot 2021-12-27 at 4 43 35 PM" src="https://user-images.githubusercontent.com/11915034/147518750-a60f9002-6eed-48a1-a412-20fabd076fa6.png">

HTML Report After:
<img width="206" alt="Screen Shot 2021-12-27 at 4 48 37 PM" src="https://user-images.githubusercontent.com/11915034/147518762-19a4c8f9-ccc3-4a3c-a962-5a42edc6fc5d.png">

This now matches what's expected and shown in the terminal (which has always been correct):

<img width="1384" alt="Screen Shot 2021-12-27 at 4 36 29 PM" src="https://user-images.githubusercontent.com/11915034/147518799-f538259e-5a45-4d6f-916c-a12ccb620c5b.png">

NB: This MR is a workaround, but not a root cause fix. It works, but I never fully got to the root cause so a bug upstream may be required. It's unclear whether it's (1) in [`colors`](https://www.npmjs.com/package/colors), (2) in [`ansi-to-html`](https://www.npmjs.com/package/ansi-to-html), or (3) Playwright's use of the two. Since the terminal output is correct, I suspect it is in `ansi-to-html`. For example:

```js
const colors = require("colors");
const Convert = require('ansi-to-html');
const convert = new Convert();

// original (strike incorrectly wraps everything in the HTML)
console.log(convert.toHtml(colors.strikethrough("crossed out") + ' ' + colors.red("red")))
// prints: <strike>crossed out <span style="color:#A00">red<span style="color:#FFF"></span></span></strike>

// workaround
console.log(convert.toHtml(colors.reset(colors.strikethrough("crossed out")) + ' ' + colors.red("red")))
// prints: <strike>crossed out</strike> <span style="color:#A00">red<span style="color:#FFF"></span></span>
```

Fixes #11116
2021-12-28 09:56:34 -08:00
..
matchers fix(html reporter): fix too much strikethrough in diffs (#11115) 2021-12-28 09:56:34 -08:00
reporters feat(reporters): show retry #x when running a test (#11003) 2021-12-17 21:07:04 -08:00
third_party chore: add blink-diff third party library (#10984) 2021-12-17 15:53:37 -08:00
cli.ts chore: minor code rearrangement (#10650) 2021-12-01 09:18:16 -08:00
dispatcher.ts feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923) 2021-12-15 10:39:49 -08:00
expect.ts feat(expext): toBeOK for APIResponse (#10596) 2021-11-30 18:12:19 -08:00
experimentalLoader.ts chore: parse tsx tests (#10917) 2021-12-14 19:25:07 -08:00
fixtures.ts chore(test runner): minor improvements (#11067) 2021-12-22 09:59:58 -08:00
globals.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
index.ts fix(test runner): disable expect, action and navigation timeouts on debug (#10958) 2021-12-16 18:32:46 -08:00
ipc.ts chore(test runner): create TestResult instances lazily in dispatcher (#10921) 2021-12-14 14:10:56 -08:00
loader.ts chore: parse tsx tests (#10917) 2021-12-14 19:25:07 -08:00
profiler.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
project.ts feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923) 2021-12-15 10:39:49 -08:00
runner.ts chore(test runner): minor improvements (#11067) 2021-12-22 09:59:58 -08:00
test.ts feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923) 2021-12-15 10:39:49 -08:00
testType.ts feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923) 2021-12-15 10:39:49 -08:00
transform.ts chore: parse tsx tests (#10917) 2021-12-14 19:25:07 -08:00
types.ts feat(test runner): show beforeAll/afterAll hooks similar to tests (#10923) 2021-12-15 10:39:49 -08:00
util.ts fix(test runner): show the location of afterAll timeout (#11007) 2021-12-18 09:32:41 -08:00
webServer.ts fix(test-runner): webServer port detection on Node.js 17 (#10538) 2021-11-29 19:36:35 +01:00
worker.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
workerRunner.ts chore(test runner): minor improvements (#11067) 2021-12-22 09:59:58 -08:00