-
Notifications
You must be signed in to change notification settings - Fork 352
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
fix: use watch strategy #236
Conversation
3bd35ea
to
1a8d7b7
Compare
@@ -2,6 +2,7 @@ | |||
|
|||
export default function adapterNodeTests() { | |||
it('should handle recording requests posting a Buffer', async function() { | |||
expect(false).to.equal(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is demonstrating that this test doesn’t appear to be running (even on master) (see merge blocker list)
I believe the quickest win is to disable testem's watcher option by default. I noticed awhile ago that the tests would re-execute midway through a test run and have long suspect it was because of This morning I found when When disabled, I see a noticeable speed improvement at the the cost of the developer experience in having to hit |
@jasonmit Hey Jason -- appreciate the response & detective work. I agree that in the very short term, looking at the watch behavior will make the development experience much more pleasant. However, I'm eager to clean up and merge this PR since using a watch strategy means that for repeated test runs (e.g. when you're TDDing) you only re-build the changed files, cutting even that ~22s down to a second or so. |
@agraves looking forward to seeing this land. Let me know if there's anything I can help with.
Looks like it's currently dead code. I don't see anything importing it so we'll need to look into resolving that. I'd be fine tackling this separately since it's an existing issue. |
@jasonmit ok thanks man! been away at a workshop but will be back on this next week -- excited to get it over the finish line |
Ok guys -- @jasonmit et al -- think this is ready for review. As mentioned elsewhere, this supports two workflows. There's the existing This now adds a second workflow, where you Personally I like the explicit nature of that workflow (and the simplicity of its implementation) but I'm open to adding other workflows as well. |
@agraves sounds good, I'll pull it down tomorrow and kick the tires. Thanks again! |
The build experience is much better! Some things I need we need are a helpful error message explaining to run a build ( I also think we need to add a section to the README or contributor section explaining this setup before merging. |
Yay! Thanks @jasonmit, glad you liked it. It's a big improvement on our end as well. I'll go ahead and update the documentation, though I probably won't finish it until early next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- README/docs update documenting new test flow
- Add a message in suggesting to
yarn watch
if no build exists when executingyarn test
@jasonmit Ok, pushing out some fixes for this now. Here are the key changes:
|
* in one tab, run `yarn watch` and wait for it to settle * run `yarn test` in another tab * watch should correctly watch all of the packages and tests and re-run as needed
* NB: aliased test:ci to test * NB: moved testem runner to test:watch * remove invalid watch spec for rollup files * remove specialized watch commands since watch covers everything now * added a script to ensure server, app and tests are built before running testem * updated persister-in-memory to support new (required) yarn commands
Think this is all set from my perspective! 🚀 |
Thanks for taking this on @agraves 🥂 |
NB: Fixes #232
NB: submitting this for a gut-check / as a proof of concept. There's a lot of style / cleanup work that needs to be done before this is ready for a line-by-line.
Motivation and Context
Let's say you're a new developer working on Polly. You check out the repo, install deps and run
$ yarn test
. This kicks off the following steps:yarn clean
yarn build
for server & utilsyarn build
andtest:build
for ~12 sundry sub-packagesyarn testem
, which kicks off the test runner.This is a development pain point for the following reasons:
testem
, which makes the testing ui unresponsive for the ~2m it take to run the build.testem
ui re-triggers the hooks, which can saturate your CPU if you're impatient.Description
While this required a lot of trial and error, the changes are actually fairly contained:
testem
no longer runs any hooks. Running long tasks makes the UI unstable.testem
now only re-runs on changes to build artifacts (code and tests) instead of the sourceyarn watch
command that triggers a watch on its code and testspackage.json
now has ayarn watch
command that runs all of the sub-packages' watch commands in parallel.Testing instructions
yarn watch
and wait for it to settleyarn test
in another tabexpect(false).to.equal(true)
" line 6 oftests/integration/adapter-browser-tests.js
Tradeoffs, deficiencies and future work
General concerns
process.cwd
among other things).Developer workflow
As implemented, this requires developers to manually kick off watch, see when it settles and then start testem. I personally prefer this approach, but I suspect something more streamlined will be required. So, I'd propose the following:
yarn test
should runyarn clean && yarn build && yarn testem
and then launchyarn watch
in the background. I'm not exactly sure how this would be implemented, but quitting testem would have to terminate the watchers.yarn test:watch
andyarn build:watch
to use the workflow I'm submitting with -- i.e. complete separation of test running and build, which imo is preferable if for example you are booting testem and know that an incremental build is sufficient. (As an aside, an incremental build is actually always sufficient since it can build from scratch -- the problem is that there's no obvious way to block testem until the incremental build has finished, aside from writing something to block that process until every artifact is present).Merge blockers
test/integration/adapter-node-tests.js
seems to not be properly run on master?Types of Changes
Checklist