Skip to content

Conversation

@tcobbs-bentley
Copy link
Member

@tcobbs-bentley tcobbs-bentley commented May 22, 2025

The HubMock class is used outside itwinjs-core, even though it is marked as internal and not exported (requiring a deep import to access it). This PR creates a new @itwin/backend-test-support package that contains HubMock in preparation for it being made public (or more likely beta in the short term). Classes that depend on HubMock were also put into backend-test-support.

Unfortunately, removing these items from core/backend/src/test would result in failed core-backend unit tests, since those tests rely on this functionality, and backend-test-support depends on @itwin/core-backend. I verified that everything outside core-backend is now using backend-test-support by temporarily deleting core/backend/src/test.

I have now created a new core/backend-tests directory that houses a new (unpublished) @itwin/core-backend-tests package. I moved everything from core/backend/test into there, removing the files that are now in test-support. All tests pass, both locally and on CI. Additionally the iOS simulator tests run in the pipeline were updated to use core/backend-tests instead of core/backend.

@tcobbs-bentley tcobbs-bentley changed the title WIP: Move some test functionality into new test-support package Move some test functionality into new test-support package Jun 6, 2025
@tcobbs-bentley tcobbs-bentley marked this pull request as ready for review June 6, 2025 17:01
@mergify
Copy link
Contributor

mergify bot commented Jun 6, 2025

This pull request is now in conflicts. Could you fix it @tcobbs-bentley? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@tcobbs-bentley tcobbs-bentley requested a review from a team as a code owner June 6, 2025 18:26
@tcobbs-bentley tcobbs-bentley requested review from a team and bbastings as code owners June 6, 2025 23:01
@pmconne
Copy link
Member

pmconne commented Jun 9, 2025

Why does this require a new package versus simply exporting relevant APIs from core-backend?

@tcobbs-bentley
Copy link
Member Author

Why does this require a new package versus simply exporting relevant APIs from core-backend?

I did this based on talks I had with Keith a few months ago, but I don't remember all of the exact details, so it could be that doing it this way is the wrong way to go.

The thought was that test-only functionality should be kept separate from core-backend, and in the future we will add things with (for example) mocha dependencies to the new package. Those would then not introduce mocha dependencies in core-backend. But looking at what is in there now, and looking at the package.json, I see that all it has are dev dependencies to chai, which already existed in core-backend. (As an aside, if this PR stands, then core-backend's dev dependencies to chai can be removed.)

@mergify
Copy link
Contributor

mergify bot commented Jun 10, 2025

This pull request is now in conflicts. Could you fix it @tcobbs-bentley? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@pmconne
Copy link
Member

pmconne commented Jun 11, 2025

I'll defer to others on the virtues of separate test packages. But if you do go that route, please rename the tools/test-support package to indicate it's only usable for backend tests - everything in it except for AdvancedEquals depends on core-backend.

@tcobbs-bentley
Copy link
Member Author

But if you do go that route, please rename the tools/test-support package to indicate it's only usable for backend tests - everything in it except for AdvancedEquals depends on core-backend.

The hope was to move other non-backend test support functionality in there as well. That obviously hasn't been done yet, and I guess it's possible that it won't work. I can rename it to backend-test-support.

@tcobbs-bentley tcobbs-bentley changed the title Move some test functionality into new test-support package Move some test functionality into new backend-test-support package Jun 11, 2025
@tcobbs-bentley
Copy link
Member Author

I renamed the package to @itwin/backend-test-support. I talked to @wgoehrig, and he agreed that while this new package isn't an ideal solution, it's the best one available.

@mergify
Copy link
Contributor

mergify bot commented Jun 11, 2025

This pull request is now in conflicts. Could you fix it @tcobbs-bentley? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@tcobbs-bentley
Copy link
Member Author

/azp run iTwin.js

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tcobbs-bentley tcobbs-bentley enabled auto-merge (squash) June 11, 2025 22:26
@mergify
Copy link
Contributor

mergify bot commented Jun 13, 2025

This pull request is now in conflicts. Could you fix it @tcobbs-bentley? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants