web icon indicating copy to clipboard operation
web copied to clipboard

fix: do not swallow failing test results in the default reporter

Open mokimo opened this issue 2 years ago • 5 comments

What I did

Fix an issue that leads to failing tests to be potentially swallowed from the defaultReporter import { defaultReporter } from '@web/test-runner';

It's a very tedious issue to debug and might fail tests to fail on CI systems as well as locally.

Reproduceable test

import { readFile } from '@web/test-runner-commands';
import { expect } from '@esm-bundle/chai';

describe('minimal reproducible example', () => {
  it('this test works', async () => {
    document.body.innerHTML = await readFile({ path: './mocks/just-return-empty-body.html' });
    expect(true).to.be.true;
  });

  describe('this describe fails', async () => {
    document.body.innerHTML = await readFile({ path: './mocks/just-return-empty-body-2.html' });

    it('failing test', () => {
      expect(true).to.be.true;
    });
  });
});

Output before

Test fails without any logging Screenshot 2023-05-16 at 20 16 55

Output after

Provide context which test is failing for further debugging Screenshot 2023-05-16 at 20 19 03

mokimo avatar May 16 '23 18:05 mokimo

🦋 Changeset detected

Latest commit: 2c8127be2b4257d85a4d471b9819c65a3becbd9a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@web/test-runner Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 16 '23 18:05 changeset-bot[bot]