Skip to content

Conversation

@staltz
Copy link
Member

@staltz staltz commented Nov 20, 2015

Build Jasmine helper that detects tests tagged with asDiagram() and runs a painter script to create
a PNG marble diagram out of them.

First attempt at resolving #697.

@kwonoj
Copy link
Member

kwonoj commented Nov 20, 2015

Seems travis is not happy with changes - is this PR work in progress?

@staltz staltz force-pushed the marble-diagram-generator branch 2 times, most recently from 82a349b to 7584ac4 Compare November 21, 2015 11:58
@staltz
Copy link
Member Author

staltz commented Nov 21, 2015

Now passing tests.

@kwonoj
Copy link
Member

kwonoj commented Nov 23, 2015

Does images supposed to be checked in, or to be generated on each local machine?

package.json Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remove ^ to stay with specific version as same as other libraries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@staltz
Copy link
Member Author

staltz commented Nov 23, 2015

Does images supposed to be checked in, or to be generated on each local machine?

I don't know, that's up to us. What do you suggest? They could be generated at the same time docs are generated. Primary reason why I checked them in is to show how the diagrams look like, for review. :)

@staltz
Copy link
Member Author

staltz commented Nov 23, 2015

This is now feature complete. It generates diagrams for the trickiest cases:

Cold observables that start emitting after a while has passed

concat

Observable of Observables as input

switch

Observable of Observables as output

groupby

When this is merged, all we need to do is add it.asDiagram(label) test cases to all operator spec files.

@kwonoj
Copy link
Member

kwonoj commented Nov 23, 2015

They could be generated at the same time docs are generated.

: Think this makes sense, doc could include this diagrams so doesn't require to generate it manually per each users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does it.asDiagram() serves as test case as well as diagram generator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, both. Only it.asDiagram specs are used for tests2png, but both it and it.asDiagram are used for npm test.

@benlesh
Copy link
Member

benlesh commented Nov 23, 2015

WOOO! That is some fancy work, @staltz

@staltz
Copy link
Member Author

staltz commented Nov 24, 2015

:)

@staltz
Copy link
Member Author

staltz commented Nov 24, 2015

@kwonoj images removed from git, and fixed that // commented line.

@kwonoj
Copy link
Member

kwonoj commented Nov 24, 2015

I'll try to look in detail around tomorrow, stuck in bed with flu all day.

@benlesh
Copy link
Member

benlesh commented Nov 24, 2015

I'll try to look in detail around tomorrow, stuck in bed with flu all day.

Yuck. Get better.

@benlesh
Copy link
Member

benlesh commented Nov 25, 2015

@staltz can you rebase?

Build Jasmine helper that detects tests tagged with asDiagram() and runs a painter script to create
a PNG marble diagram out of them.

First attempt at resolving ReactiveX#697.
Support drawing diagrams of cold observables with an offset in time to account for the time they get
subscribed to, specially important in diagrams such as for the concat operator.

For issue ReactiveX#697.
…rble

Improve the looks of the complete marker when it overlaps with a marble (both happen at the same
VirtualTimeScheduler frame, or are very close in time).

For issue ReactiveX#697.
Support diagrams for Observable of Observables, either as inputs or as outputs. Add example usage
for mergeAll, switch, and groupBy

For issue ReactiveX#697.
Create img folder before running image generation script, and use verbose output when debugging.

For issue ReactiveX#697.
@staltz staltz force-pushed the marble-diagram-generator branch from d240045 to 2f7fdf9 Compare November 25, 2015 21:30
@staltz
Copy link
Member Author

staltz commented Nov 25, 2015

@Blesh Rebased.

@benlesh
Copy link
Member

benlesh commented Nov 25, 2015

@staltz I've pulled it down and tried it out. It definitely works.

I ran into a few issues I think we should address in this PR though:

  1. I didn't know what "imagemagick", "graphicsmagick" or "ghostscript" were or how to install them. I figured it out eventually (used brew), but we'll need to have that part documented.
  2. I still don't really know how it decides which tests to make PNGs from. How is this configured? Can O do anything ad hoc with it?
  3. it wrote to img/ and that's fine, but it should probably be in .gitignore.

Overall a VERY COOL PR!

@staltz
Copy link
Member Author

staltz commented Nov 26, 2015

I still don't really know how it decides which tests to make PNGs from. How is this configured? Can O do anything ad hoc with it?

I can write down how to configure a test to be converted to a PNG. But the general case of ad hoc generating PNGs is not supported. If it would, it would make sense to make that a separate library.

@staltz
Copy link
Member Author

staltz commented Nov 26, 2015

@Blesh some few commits added to fix issues you mentioned.

@staltz
Copy link
Member Author

staltz commented Nov 26, 2015

Tests failing just because markdown-doctest doesn't recognize it() from Jasmine and prefers to blow up.

@staltz
Copy link
Member Author

staltz commented Nov 30, 2015

@Widdershin how do I configure .markdown-doctest-setup.js? Do I need to require Jasmine or can I somehow mock it() calls?

@Widdershin
Copy link
Contributor

@staltz You could probably do either, but my instinct is just to mock it out.

If you add something like this to .markdown-doctest-setup.js:

var it = {
  asDiagram: function (name) {
    return function (label, callback) {
      callback()
    }
  }
}

And then add it to the exported globals object:

  globals: {
    ...
    it: it
  },

That should do the trick. Does that make sense?

@staltz
Copy link
Member Author

staltz commented Nov 30, 2015

Hmm, I'll try that! Thanks!

@staltz
Copy link
Member Author

staltz commented Nov 30, 2015

@Blesh I fixed the markdown-doctest. Maybe now it's good to merge.

@benlesh
Copy link
Member

benlesh commented Nov 30, 2015

Awesome stuff @staltz! Merged with 30a6214

🎉🎉🎉

@benlesh benlesh closed this Nov 30, 2015
@staltz
Copy link
Member Author

staltz commented Nov 30, 2015

Woot!!!

I'll start going wild by making diagrams for all operators :)

@staltz staltz deleted the marble-diagram-generator branch November 30, 2015 17:37
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants