Skip to content

test: fill `DOMException` names

DOMException.name is preferable over DOMException.code. Also this makes affected tests a bit more self-documented.

Note that instead of numbers we can use legacy constants exposed as DOMException properties. And for testing compatibility with Web APIs we can explicitly check that error is not Node.js-specific by asserting its constructor.

  throws(
    () => AbortSignal.abort().throwIfAborted(),
    {
      constructor: DOMException,
      code: DOMException.ABORT_ERR,
      name: 'AbortError',
    }
  );

Merge request reports

Loading