yamadapc / jsdoctest

Run jsdoc examples as doctests.
https://yamadapc.github.io/jsdoctest
MIT License
92 stars 9 forks source link

Semicolon insertion breaks complex examples #28

Closed ianwremmel closed 7 years ago

ianwremmel commented 8 years ago

I'm trying to write a test that does an async action and makes some assertions about a non-deterministic result

createResource()
  .then(function(resource) {
    assert(typeof resource.id !== 'undefined')
    return 'success';
  });
  // async => 'success'

This fails because jsdoctest seems to add a semicolon to the end of each line and therefore produces invalid javascript.

yamadapc commented 8 years ago

Mm... Could you send the full block that you're using?

yamadapc commented 8 years ago

I'll fix it this week. For now if you move .then to the createResource line you should be fine.

EDIT Perhaps using a more principled approach would be better.

yamadapc commented 8 years ago

Pushed preliminary fix, going to try a more principled approach to getting this to properly work.

ianwremmel commented 8 years ago

awesome, thanks for the quick response!