jasmine / jasmine-browser-runner

Serve and run your Jasmine specs in a browser
49 stars 23 forks source link

Add a watch mode? #35

Closed DamienCassou closed 1 year ago

DamienCassou commented 1 year ago

When in "serve" mode, I would like my tests to be executed again when my code is updated.

In my scenario, the option specFiles is set to an array with just 1 webpack bundled file. Any update to that file should trigger a refresh so tests are executed again.

sgravrock commented 1 year ago

Would something like node --watch-path=mySpecBundle.js ./node_modules/.bin/jasmine-browser-runner runSpecs (requires at least Node 18.11.0) work for you? Aside from showing the results in the terminal rather than in the browser I think it achieves the same outcome as what you're asking for.

I'm reluctant to build watch functionality into jasmine-browser-runner itself. Much of the complexity and flakiness that I disliked in Karma resulted directly from that feature. As a user, I had to pay a price for all that even though I didn't need the watch functionality myself. File watching itself is notoriously hard to do in a way that works correctly and scales to large numbers of files/directories across all major OSes. (I'll admit to being a bit out of touch with the state of the art here, but a quick look at the Chokidar issue tracker suggests that it's still a hard problem.) This feature has also proven to be something of a bug factory in other testing tools.

DamienCassou commented 1 year ago

Thank you very much for your detailed answer. I understand the scope of your project is narrower than what I would like and I don't think it's worth adding the complexity.

The workaround you give isn't good enough for me because I really would like to debug in the browser.

Thank you for your project. Feel free to close the issue whenever you want.

sgravrock commented 1 year ago

Thanks for understanding.

I understand that the ecosystem is a little unbalanced right now. My hope is that once Jasmine support is added to Web Test Runner, we'll be back to having good options for both people who want something more feature-full and people who want something lightweight and simple.