Skip to content

[native_assets_cli] Improve hook testing #2241

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

Open
dcharkes opened this issue Apr 25, 2025 · 2 comments
Open

[native_assets_cli] Improve hook testing #2241

dcharkes opened this issue Apr 25, 2025 · 2 comments

Comments

@dcharkes
Copy link
Collaborator

dcharkes commented Apr 25, 2025

We currently have a testBuildHook and testCodeBuildHook (added in #1377 and refactored afterwards).

These are intended for use in the same package as the hook, and to run the hooks in isolation.

Some things to add to this way of testing:

  • Use the correct working directory.
  • Use process invocation to be able to test exit codes? (The downside would be that you can't use the debugger to step through the code as easily.)
  • A way to provide user-defines.
  • A way to provide assets passed in from other build hooks (a.k.a. metadata).
  • Similar methods for link hooks.
  • Similar methods for data assets.

Note: If lots of hooks start building on top of other hooks, then possibly testing hooks in isolation might prove to be less useful than anticipated. This remains to be seen.

@dcharkes
Copy link
Collaborator Author

cc @mosuem Are you using these functions? (The initial one was added by you.)

Context: I'm trying to see

  1. what classes we typically need inside hooks,
  2. what classes we typically need inside tests for hooks, and
  3. what classes we typically need in hook-helper-packages.

This will hopefully inform how we should structure our libraries (#1805).

@mosuem
Copy link
Member

mosuem commented May 5, 2025

Are you using these functions? (The initial one was added by you.)

I don't - but I probably should. Currently, I just have end-to-end tests which run the build hooks by building, and then testing them by running the compiled program. This is not good practice IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants