Skip to content

build: bazel build & unit tests #1732

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

Merged
merged 1 commit into from
Aug 11, 2022
Merged

Conversation

gregmagolan
Copy link
Contributor

@gregmagolan gregmagolan commented Aug 3, 2022

Includes common, server, client & syntaxes tests

Test with,

yarn test:bazel

Watch mode using,

yarn test:bazel-watch

Debug a specific test target with yarn bazel test --config=debug //test:target

Testing on CI in new bazel-build-and-test step. Non-bazel CI builds are not touched yet. Cut-over will be in the future.

@gregmagolan gregmagolan force-pushed the migrate_to_bazel branch 12 times, most recently from 6eff8c6 to cdacdd2 Compare August 4, 2022 02:51
@gregmagolan gregmagolan force-pushed the migrate_to_bazel branch 13 times, most recently from cfba4f1 to 65f3825 Compare August 8, 2022 18:23
@gregmagolan gregmagolan changed the title Migrate to Bazel build: bazel build & unit tests Aug 8, 2022
@gregmagolan gregmagolan marked this pull request as ready for review August 8, 2022 18:24
@gregmagolan gregmagolan force-pushed the migrate_to_bazel branch 7 times, most recently from 3ae3462 to d26e336 Compare August 8, 2022 20:53
Comment on lines -216 to +218
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js",
"test:bazel": "yarn bazel test --test_tag_filters=unit_test //...",
"test:bazel-watch": "yarn ibazel test --test_tag_filters=unit_test //..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like yarn test only includes 2 specs now. I think this was actually a result of the previous change. I'm fine with just updating the existing scripts instead of creating new ones.

So test would be the bazel test and test:inspect would be bazel test with --config=debug

Copy link
Contributor Author

@gregmagolan gregmagolan Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could flip yarn test to use bazel in this PR, tho that would mean that CI would be using bazel as well since test.sh calls yarn run test. Might be preferable to run bazel CI in a parallel step to the legacy CI for some time before full cut over.

The --config=debug will only work if you are testing an individual target and the jasmine unit tests are now split across three //common/tests:test //server/src/tests:test and //client/src/tests:test.

So when setting --config=debug you have to pick which individual target you want to run.

For example bazel test --config=debug //server/src/tests:test:

$ bazel test --config=debug //server/src/tests:test
WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time
INFO: Analyzed target //server/src/tests:test (0 packages loaded, 2 targets configured).
INFO: Found 1 test target...
Debugger listening on ws://127.0.0.1:9229/1cf7a13b-7c85-4fb1-b892-b5c8d545d2ae
For help, see: https://nodejs.org/en/docs/inspector

This wouldn't fit in with the current single test:inspect script. Perhaps break it out into test:inspect-common test:inspect-server and test:inspect-client?

@gregmagolan gregmagolan force-pushed the migrate_to_bazel branch 3 times, most recently from 70f7a83 to dfe4211 Compare August 9, 2022 19:43
@atscott atscott added the target: patch This PR is targeted for the next patch release label Aug 9, 2022
@gregmagolan gregmagolan force-pushed the migrate_to_bazel branch 3 times, most recently from a5d121f to 85c5250 Compare August 10, 2022 20:40
includes common, server, client & syntaxes tests

test with,

`yarn test:bazel`

watch mode using,

`yarn test:bazel-watch`
@atscott atscott added the action: merge Ready to merge label Aug 11, 2022
@atscott atscott merged commit c50ff13 into angular:main Aug 11, 2022
atscott pushed a commit that referenced this pull request Aug 11, 2022
includes common, server, client & syntaxes tests

test with,

`yarn test:bazel`

watch mode using,

`yarn test:bazel-watch`

(cherry picked from commit c50ff13)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge Ready to merge target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants