pltod / test-with-tape-in-browser

Visualise tape test suite in the browser with ripple
MIT License
0 stars 0 forks source link

Command line tool? #1

Open ljharb opened 9 years ago

ljharb commented 9 years ago

I'd love to be able to do ripple path/to/tape/tests.js > output.html and produce a nice HTML file to display my tape output.

pltod commented 9 years ago

Your suggestion would be very useful. But with the current setup it is not possible to be achieved because ripple is a view layer that must run in the browser. Currently single html is used....when we add more suites the build.js is automatically regenerated (npm run build starts browserify in watch mode) and we see the new test results in the same html file each time.

Such command line tool could be made if we replace ripple with react though...

ljharb commented 9 years ago

Right - but your command line tool could use the same HTML file, regenerate build.js from the provided tape test entry point, and inline it in a script tag in a new HTML file that I could then run in the browser - I don't see why it wouldn't work as-is.

pltod commented 9 years ago

Initially I've thought to run the ripple formatter as command line tool but it requires DOM and can not be run outside the browser. Your suggestion is doable with invoking browserify with exec or spawn to generate build.js based on the provided test suite.....and then generate new HTML file each time that consume it.

However I am not sure how clean this would be because your 'tests.js' file must require in itself the code from formatter.js and tape createStream logic that will be later executed in the browser......I guess you need to have clean test suites without couple your tests with some formatting logic (even if it is in external file obtained with require)....that is why I was start thinking about doing it with react.

I will try to add different approaches in the repo soon.....I agree that command line tool will be useful addition....