Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved fix for #12, extends pullreq #16: fix babel support issues #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GerHobbelt
Copy link

Works for babel 7. Augments #16, fixes #12.

See fork https://github.com/GerHobbelt/better-assert for npm test tests including babel transpiled runs.

The key problem was when using a modern import assert from ... statement in your code, which is then transpiled by babel, which replaces the assert(...) calls which something like (0, _.default)(...) when you transpile to ES5 or similar old targets, resulting in the /assert\(.../ line regex in better-assert to crash.

See also the pullreqqed code changes and commit message.

erossignon and others added 2 commits April 23, 2018 15:56
…when babel has transpiled all `assert(...)` calls to something else (`(0, _.default)(...)` for example), we look for that transpiled code instead. (assuming Babel 7)

  Defensive coding ensures no crash when these assumptions don't match reality: instead of the function arguments, '???' is reported instead.
- Completely removed obsolete callsite references in the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

does not work with babel
2 participants