-
Notifications
You must be signed in to change notification settings - Fork 379
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
chore: speed up serving-functions test by pre-generating oclif manifest #3517
Conversation
oclif spends a lot of time scanning the functions directory. this adds up if we do it for every test, so we pre-generate it for testing.
📊 Benchmark resultsComparing with 8b95a5c Package size: 357 MB(no change)
Legend
|
@@ -65,7 +66,8 @@ | |||
"test:ci:ava": "nyc -r json ava", | |||
"docs": "node ./site/scripts/docs.js", | |||
"watch": "nyc --reporter=lcov ava --watch", | |||
"prepack": "oclif-dev manifest && npm prune --prod", | |||
"build:manifest": "oclif-dev manifest", | |||
"prepack": "npm run build:manifest && npm prune --prod", | |||
"postpack": "rm -f oclif.manifest.json && npm i", |
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.
I see we currently try to only generate the manifest during the packing process. What's the idea behind that? Do we fear it becoming stale during development?
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.
Do we fear it becoming stale during development?
I'm not sure this was a very conscious choice, but yes - this can happen.
We could add another cleanup step to remove it (we'll need to propagate the exit code from the test run though).
(this PR is similar to #3508, but for speeding up local testing instead of CI) |
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.
Thanks @netlify-team-account-1, added a comment - I don't think it's a blocker.
Also, I think we can remove the change done in #3508, as this PR includes it
This reverts commit 0eea04d.
- Summary
oclif promises to only require the files that are neccessary for the command that is run. This is true if there's a
oclif.manifest.json
found - if it doesn't find it, it will require every single command synchronously. Sinceserving-functions.test.js
runsntl dev
once for every test (~25 at the moment), and there's no require caching since each test runs its own child process, this is a big time sink.By generating the
oclif.manifest.json
, we can speed up these tests.- Test plan
tests shall still pass
- A picture of a cute animal (not mandatory but encouraged)