mdn-bcd-collector icon indicating copy to clipboard operation
mdn-bcd-collector copied to clipboard

Iterator constructor test doesn't work

Open foolip opened this issue 8 months ago • 0 comments

https://mdn-bcd-collector.gooborg.com/tests/javascript/builtins/Iterator/Iterator

As discussed in https://github.com/mdn/browser-compat-data/pull/26472 and linked issues, the Iterator constructor cannot be used directly, only as super() for a subclass.

The generated test for it is currently:

(function () {
  if (!("Iterator" in self)) {
    return { result: false, message: "Iterator is not defined" };
  }
  return bcd.testConstructor("Iterator", false);
})();

And that currently results in "Support Unknown" as invoking the constructor throws a TypeError, as it should.

A test for this would have to do something more like the example in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/Iterator#examples

foolip avatar Apr 11 '25 14:04 foolip