power-assert-js / power-assert-formatter

Power Assert output formatter
MIT License
6 stars 3 forks source link

Support yield statements #19

Closed jamestalmage closed 9 years ago

jamestalmage commented 9 years ago

From what I can tell, there is no way to get esprima to parse a yield statement that is not wrapped in a generator function.

To work around this, I do the following:

  1. Try to parse normally first
  2. Failing that, try parsing by wrapping code in a generator function. If it works, then unwrap the AST.

This will require additional modifications on the instrumentation side of things before the output looks correct (my test will need to be modified at that point). The result of the yield is not captured.

jamestalmage commented 9 years ago

@twada I'm going to bump to espower 1.1.0 in package.json. Unless you publish in the next few seconds my next push is going to fail CI. Just re-trigger via Travis web page once the release is cut and it should pass again.

Also, just FYI - I don't know if you are an Intellij user, but if so, I hope you find this useful: https://github.com/jamestalmage/intellij-code-to-string-js

twada commented 9 years ago

@jamestalmage I've released espower 1.1.0 and restarted Travis build.

Also, just FYI - I don't know if you are an Intellij user, but if so, I hope you find this useful: https://github.com/jamestalmage/intellij-code-to-string-js

Wow this is so useful for creating our tests! Yes, I'm using WebStorm (and yeah, Emacs :stuck_out_tongue_winking_eye:).

jamestalmage commented 9 years ago

woot! Green!

twada commented 9 years ago

@jamestalmage Thank you for your great contribution! I'm going to cut a new release (as 1.2.0) soon.

jamestalmage commented 9 years ago

awesome! Thanks!

twada commented 9 years ago

Just released power-assert-formatter 1.2.0. Thank you for your great contribution!