-
Notifications
You must be signed in to change notification settings - Fork 74
chore(integ-tests): decouple CLI and Library sources, improve documentation #425
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
Conversation
7c3c3d6 to
9ecb5c8
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 79.18% 79.25% +0.06%
==========================================
Files 54 54
Lines 6895 6897 +2
Branches 772 772
==========================================
+ Hits 5460 5466 +6
+ Misses 1417 1413 -4
Partials 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9ecb5c8 to
a01be6a
Compare
|
Total lines changed 1043 is greater than 1000. Please consider breaking this PR down. |
| statements: 25, | ||
| lines: 25, |
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.
Not loving this. Can you at least explain why these are lowered?
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.
Yeah. There's a bunch of new code that involves calling NPM and making symlinks on disk, that doesn't have unit tests because it's either awkward to test or introduces sources of network calls and latency that we don't really want in unit tests (imo).
I figured since this is for the integ tests, it is basically tested as part of every PR already.
| if (args['use-source'] || args['auto-source']) { | ||
| if (args['framework-version']) { | ||
| throw new Error('Cannot use --framework-version with --use-source'); | ||
| for (const flagAlias of ['cli-source', 'use-source'] as const) { |
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 think this gives --use-source precedence over --cli-source if both are defined.
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.
cliSource is of type UniqueOption<T> which will throw an error if it's set more than once.
| import { findUp } from '../files'; | ||
|
|
||
| /** | ||
| * Find the root directory of the repo from the current directory |
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.
Might help explaining why you are looking for release.json
| /** | ||
| * Find the root directory of the repo from the current directory | ||
| */ | ||
| export async function autoFindRoot() { |
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.
Maybe this? Because it could also be package root.
| export async function autoFindRoot() { | |
| export async function autoFindRepoRoot() { |
| } | ||
|
|
||
| public assertJsiiPackagesAvailable(): void { | ||
| // FIXME: Always a no-op. |
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.
Is this a FIXME then if it's always a no-op?
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.
Why is this test removed?
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.
Because the test started with
if (fixture.packages.majorVersion() !== '1') {
return; // Nothing to do
}And so it was always a no-op. We haven't run this test for 2 years.
…tation We used to make assumptions in the integ tests that the CLI and library versions were the same unless specified otherwise, and that they both would come from the same repo. These assumptions are no longer true: the CLI and the library have their own version numbers, and only the CLI can come from a source repo (or at least, that's how it works in practice). Tear apart `ReleasePackageSource` and `RepoPackageSource` into (currently): - `CliNpmSource` / `CliRepoSource` - `LibraryNpmSource` Make a more clear naming distinction between the part that runs in the runner and the part that runs in the test. Explain in documentation what the options are, and how the use of the given component is achieved at runtime. Make the argument names and default values a little more sensible given the new source locations. CHANGES: - Add `--cli-version` to mirror `--framework-version`. - Default to `--auto-source` if no CLI version given. - Add `-F` alias to specify a single test file. - Resolve the framework version immediately. - Deprecate `--use-source` and replace with `--cli-source`. - Deprecate `--auto-source` and replace with `--cli-source=auto`. Signed-off-by: github-actions <github-actions@github.com>
198dcf9 to
257f7ce
Compare
We used to make assumptions in the integ tests that the CLI and library versions were the same unless specified otherwise, and that they both would come from the same repo.
These assumptions are no longer true: the CLI and the library have their own version numbers, and only the CLI can come from a source repo (or at least, that's how it works in practice).
Tear apart
ReleasePackageSourceandRepoPackageSourceinto (currently):CliNpmSource/CliRepoSourceLibraryNpmSourceMake a more clear naming distinction between the part that runs in the runner and the part that runs in the test.
Explain in documentation what the options are, and how the use of the given component is achieved at runtime.
Make the argument names and default values a little more sensible given the new source locations.
CHANGES:
--cli-versionto mirror--framework-version.--auto-sourceif no CLI version given.-Falias to specify a single test file.--use-sourceand replace with--cli-source.--auto-sourceand replace with--cli-source=auto.yargsversion and twiddle all the options slightly differently to enable strict parsing mode.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license