-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Big Epic Rewrite Issue #263
Comments
This was referenced Jun 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starting with the setup work in #255, I've been undergoing an in-place rewrite of testdouble.js that essentially dogfoods both the library & Discovery Testing by replacing the library bit-by-bit.
This has been incredibly challenging for a variety of reasons, among them: keeping oneself unanchored by existing implementation when trying to think of a better design, coming up with useful names for (relative to most JS libs) very meta concepts, and resisting the urge to fix problems and incongruities in the existing implementation as I go. If this rewrite also substantially changes the public-facing behavior of the library, it's going to be like tuning two knobs on a radio at once, making everything more difficult.
Therefore, this thread will maintain 3 to-do lists for tracking progress of the rewrite. First: the actual progress so far incorporating the new implmentation. Second: the future work to undertake to "fix" what I identify as broken with the library after we call the rewrite "done". Third: internal improvements that should be tracked and made as part of the rewrite.
Progress so far.
testdouble.js has a pretty straightforward public-API:
captor
andcallback
which enable other behaviorCallLog
)StubbingRegister
)*being labeled complete here does not mean they are wired up in the deployed library, yet. They'll sit in the repo as inert code until they can go end-to-end. For instance,
td.func()
can't be replaced until its calls go in the same call log thattd.verify()
is looking at, otherwise the library wouldn't work. It truly is a big epic rewrite as a result, since almost everything depends on everything else because of how stateful a library this is.Room to improve
Here's what I've identified as things to improve while working through everything. Some of these feel urgent enough that I'll incorporate them into the current implementation to avoid rewriting a bad thing.
td.explain
to accept any fake object/function/constructor and give you a way to navigate to its parents and children if it was a property of a fake thingInternal improvements
There are some things that can be improved/refactored without affecting public-facing behavior. Tracking those here:
td.func
Double
value that knows a lot of metadata about the concept of a double (like thereal
thing its masking)name
of each test double function to concatenate all the names of its parents sotd.explain
and error messages make it clear which test double is whichtd.function
takes a second__optionalName
argument due to a quirk in how node-module replacement was written. This can be fixed by makingtd.replace
.default
which means they all look the same. the name should include the module path + the export nameThe text was updated successfully, but these errors were encountered: