concordancejs / concordance

Compare, format, diff and serialize any JavaScript value

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update well-known-symbols

novemberborn opened this issue · comments

https://github.com/novemberborn/well-known-symbols/releases/tag/v3.0.0 adds Symbol.matchAll. I need to assess what that means for existing AVA snapshots that already include that symbol.

@novemberborn sorry to nag, but might it make sense to resolve this before AVA@4.0.0?

It looks to me like declaring a symbol well-known might be a breaking change for AVA. It would cause existing snapshot assertions containing the symbol to start failing.

Have you considered dynamically determining whether a symbol is well-known, with something like:

const wellKnownSymbols = new Set(
  Reflect.ownKeys(Symbol)
    .filter(key => typeof Symbol[key] === 'symbol')
    .map(key => Symbol[key])
);

function isWellKnown(symbol) {
  return wellKnownSymbols.has(symbol);
}

@novemberborn sorry to nag, but might it make sense to resolve this before AVA@4.0.0?

No worries, it's a good point!

Have you considered dynamically determining whether a symbol is well-known

That could be interesting. I need to see how these symbols are serialized and how compatibility across JS versions is dealt with. Perhaps the logic can be adjusted so we can add well-known symbols without causing compatibility issues.

@ninevra I've decided not to tackle this for AVA 4. I'm hoping I can do some work on this package to modernize it and if need be that'll be AVA 5.