-
Notifications
You must be signed in to change notification settings - Fork 12k
test: run e2e tests on pre-compiled packages #23753
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
141a25a
to
c7a0cb8
Compare
f21bbb5
to
777cbfc
Compare
8000b07
to
5edbae8
Compare
e7fff1e
to
30bac2c
Compare
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.
LGTM
tests/legacy-cli/e2e/utils/tar.ts
Outdated
*/ | ||
export async function extractFile(tarball: string, filePath: string): Promise<Buffer> { | ||
return new Promise((resolve, reject) => { | ||
let chunks: Buffer[] | null = null; |
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 there a reason that the chunks need defined in this block? Since its only referenced inside of the onentry
closure, you should be able to just define it there correct?
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.
It was probably just me learning the fs/parse API. Updated 👍
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.
LGTM
return updateJsonFile('package.json', (json) => { | ||
json['dependencies'] ??= {}; | ||
json['devDependencies'] ??= {}; | ||
|
||
for (const packageName of Object.keys(packages)) { | ||
if (packageName in json['dependencies']) { | ||
json['dependencies'][packageName] = packages[packageName].version; | ||
json['dependencies'][packageName] = packages[packageName]; |
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.
Since we have access to the version in findPackageTars
can we keep using the version instead?
@@ -49,6 +53,7 @@ const argv = yargsParser(process.argv.slice(2), { | |||
], | |||
string: ['devkit', 'glob', 'ignore', 'reuse', 'ng-tag', 'tmpdir', 'ng-version'], | |||
number: ['nb-shards', 'shard'], | |||
array: ['package'], |
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.
For the time being can we default this to ./dist/_*.tgz
? The command itself is already a bit long and having to write --package=/dist/_*.tgz
multiple times a day seems a bit unnecessary.
For context here's an example of the command now.
node tests/legacy-cli/run_e2e.js tests/legacy-cli/e2e/tests/build/library/lib-consumption-full-aot.ts --package=/dist/_*.tgz
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.
Can you please update the developers guide?
https://github.com/angular/angular-cli/blob/main/docs/DEVELOPER.md#end-to-end-tests
9f911a6
to
02e0412
Compare
@@ -220,8 +221,12 @@ export async function useCIChrome(projectDir: string = ''): Promise<void> { | |||
} | |||
} | |||
|
|||
export const NgCLIVersion = new SemVer(packages['@angular/cli'].version); |
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.
Since packages
is now computed from the package tars passed on the CLI there's no guarantee that it has been put into the "global variable"s when this file is first loading, so I've moved it into a method.
Previously in this PR I had this doing require(../../../....../package.json).version
instead of reading it from the loaded packages. However a) that is not the same as before this PR and b) the git repo version might not be the same as the packages being tested.
|
f54f169
to
7b4e421
Compare
Updated and squashed, see diff |
docs/DEVELOPER.md
Outdated
@@ -84,6 +84,7 @@ You can find more info about debugging [tests with Bazel in the docs.](https://g | |||
|
|||
- Run: `node tests/legacy-cli/run_e2e.js` |
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.
Can you add a line here that now running yarn build
needs to be ran prior to node tests/legacy-cli/run_e2e.js
as the latter will not build the packages.
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.
Updated
The NPM packages being tested must be pre-compiled and the tar packages specified via --package. This way the real packages such as snapshots, release artifacts or cached packages can be tested. Previously the e2e tests compiled and packaged during test execution.
7b4e421
to
684170c
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The NPM packages to test must be specified via --package instead of invoking the build from within the e2e tests
This means the packages must be built before tested. This will align with bazel which will pass the bazel built (and cached) tgz files. The packages being tested could be the real npm packages before being published, although CI will probably test snapshot-like packages.