MithrilJS / ospec

Noiseless testing framework
MIT License
48 stars 13 forks source link

Adapt the `lock()` mechanism as a core part of o.spy() #54

Open pygy opened 1 year ago

pygy commented 1 year ago

In the Mithril test suite, @dead-claudia uses a lock utility that tracks stray calls to functions after a test is finished. This should be a core functionality of o.spy()

The groundwork I'm doing to fix #50 should make the default case easy (spies defined during a test should not run when it's done. Spies defined at test-definition time shouldn't expire though.

It may be possible to have spies defined in before/beforeEach hooks to last until the matching after/afterEach hook.