Running Rely (test framework) in watch mode


#1

Hi

I am developing a native app, and I am using Rely as test framework. From using Jest I am being very fond of using it in watch-mode, but I can’t seem to find a way to that in Rely. Is this not built in or is it supposed to be used with existing tools?

I looked into dune, and found that it has a watch mode when running tests. And since I am using esy (created with pesy) I tried to use it this way: esy b dune runtest test/ -w. And this does start something that seems to reload when I am saving my tests, but it does not run my tests. And I couldn’t figure out how to actually run anything:

$ esy b dune runtest test/ -w
Success, waiting for filesystem changes...

So then I went for watchman-make (part of watchman), and that seems to do the trick:

$ watchman-make -p 'executable/**/*.re' 'library/**/*.re' 'test/**/*.re' --make=esy -t test --settle 1
# Relative to /Users/mikael/re-sample
# Changes to files matching executable/**/*.re library/**/*.re test/**/*.re will execute `esy test`
# waiting for changes
# Execute: `esy test`

re-sample@0.0.0

  Build Succeeded! To test a binary:

      esy x ReSampleApp.exe


Running 1 test suite
 PASS  my first test suite

Test Suites: 0 failed, 1 passed, 1 total
Tests:       0 failed, 1 passed, 1 total
Time:        < 1ms

# waiting for changes

(--make=esy -t test works because I added "test": "esy x TestReSample.exe" to scripts-section of package.json).

While watchman seems to work, it would be cool if this was part of the toolchain. Is it other ways to watch files while testing (preferably with Rely)? And is it possible to make dune’s watch mode to work with esy testing?


#2

There is probably a way to integrate running Rely tests from a dune runner, which would integrate with watch mode, and I’m glad you got the watchman mode working. We would also like to integrate fswatch with esy, or some other cross platform watcher. (https://github.com/emcrisostomo/fswatch)

We just need someone to package up fswatch as an esy package so that it can be added to dev dependencies.

Any other ideas?