Live data from Hacker News

Show HN: I built a tool to get instant test results

github.com

31–40 of 68 posts

Re: Show HN: I built a tool to get instant test results

#31
post #24
post #9

Earlier quoted context omitted.

Well, I would say the biggest difference is while the watch mode you described runs all the tests for every change. hypertest only runs the tests the were impacted by the changed code. Resulting is blazing fast performance. I’d say it’s even fast than apples alt+tab animation most of the time.

> hypertest only runs the tests the were impacted by the changed code with all due respect, this is also a solved problem with test watchers. unless you mean this is smart enough to not just run unit tests that are directly related to the file changed, but also understands code changes from the perspective of downstream dependencies?

The second part is the aim here.

This is more of a code watcher than a test watcher specifically.

Re: Show HN: I built a tool to get instant test results

#33
I do something similar using entr [0][1]. I use it instead of `watch` because I would rather not re-run things if no relevant files have changed.

For example, I run:

  fd -e j2 -e py | entr -c python3 build.py
To rebuild a static site every time the build script[2] (py) or a Jinja2 template (j2) changes.

[0]: https://github.com/eradman/entr

[1]: https://jvns.ca/blog/2020/06/28/entr/

[2]: https://gist.github.com/polyrand/3bed83897658806bd490e1d44df...

Re: Show HN: I built a tool to get instant test results

#34
post #15
post #13

Slow is smooth, smooth is fast. Though I understand the intent, I think it has the risk to run into a run-hack-run-hack programming style. I'm currently reading Code Complete which advises against this practice. Instead, one should strive to write code that works from the start instead of hoping it to work eventually.

Love that mantra! Dont really agree, it’s not intended for that. I use it as I would run tests through a terminal normally. Built this because I hate running tests.

Got it.

Very much like the idea to check the code coverage to find out which tests you should run. First time I saw it. Is it common in other tools?

Re: Show HN: I built a tool to get instant test results

#35
post #19

1. Does this mean I have to disable IDE autosave so it doesn't attempt to run tests when the project is in an intermediate, invalid state? 2. How does it detect what tests need to be re-run when a given file changes?

1. No, if build fails hypertest will just discard the result. autosave is even prefered. 2. The first run and every subsequent one collects code coverage which is saved in an sqlite db. Every file change is compared to the code coverage. Although this approach isnt perfect, The idea here is being fast. I always rerun the entire suite just before committing the code.

That's very clever, thanks for this!

Re: Show HN: I built a tool to get instant test results

#36

This is a great idea! Even better: write a Playwright/Codegen[1] test and have that execute continuously (or put a button in the IDE to trigger it). That way you can iterate on multiple code files but see how it impacts one end-to-end test in real time! (I'm developing a feature right now where I'm doing that manually and it would be nice to automate) [1] https://playwright.dev/docs/codegen-intro

We have built something along these lines, Crusher [1] (demo [2]) is an e2e framework, you can trigger test with click of a button. It's built on top of playwright.

We’re thinking of adding watch mode in the coming months - running tests continuously in real-time. Sending you an email to exchange ideas.

P.S.- there might be few typos. It’s work in progress.

[1] https://www.youtube.com/watch?v=Nc-TlgeKBSE [2] https://github.com/crusherdev/crusher

Re: Show HN: I built a tool to get instant test results

#38
This sounds a lot like a couple of old JUnit test runners:

InfiniTest - https://infinitest.github.io/ an dhttps://infinitest.github.io/doc/intellij#how-it-works

JUnit Max - https://web.archive.org/web/20090206151635/http://www.threer... partially surviving as https://junit.org/junit4/javadoc/4.12/org/junit/experimental...

Ruby has something similar:

autotest - https://github.com/grosser/autotest

I think it's a good idea, and i'm surprised it hasn't become a standard feature of IDEs and test runners.

Re: Show HN: I built a tool to get instant test results

#39
post #31
post #24

Earlier quoted context omitted.

> hypertest only runs the tests the were impacted by the changed code with all due respect, this is also a solved problem with test watchers. unless you mean this is smart enough to not just run unit tests that are directly related to the file changed, but also understands code changes from the perspective of downstream dependencies?

The second part is the aim here. This is more of a code watcher than a test watcher specifically.

very cool!

Re: Show HN: I built a tool to get instant test results

#40
post #11
post #8

For folks using bazel, there is also [bazel-watcher][1]. Also worth checking out [watchman][2] for this style of workflow in general. [1]: https://github.com/bazelbuild/bazel-watcher [2]: https://facebook.github.io/watchman/

Bazel is awesome, it just runs way too many tests to be fast enough

--test_filter?
Post reply on HN