ava: regression: array.includes no longer working.

Reference: https://github.com/sindresorhus/serialize-error/pull/3#discussion_r45643804

The following no longer works:

test(t => {
  var keys = Object.keys(obj);
  var hasName = keys.includes('name');
  t.true(hasName);
  t.end();
});

I get the following error:

TypeError: keys.includes is not a function

We are using the runtime plugin, to avoid any polyfills, so it makes sense that Array.prototype.includes does not actually exist. I would have thought the runtime plugin would have picked this up and provided it via some helper function.

We are still on Babel 5, so I am punting until we land Babel 6 support before digging in.

// @sebmck @thejameskyle

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Late to this party but I just wanted to affirm the decision to have AVA not add polyfills by default (global polluting or no). Jest took a different route (and includes babel-polyfill by default) which led to tests passing code which broke in production. BAD BAD BAD!

Closing, this is not something we can fix when transpiling test files. Users could add a --require for babel-polyfill but AVA shouldn’t do that by default.