brave/brave-browser

Ensure gn analyze can determine affected tests on ts changes

Closed this issue · 0 comments

This work is part of a long term goal to enable CI to only run tests affected by your changes.

To ensure gn analyze (npm run test -- --base=master.) can determine what tests need to run relative to the files changed we need to encode all file dependencies in gn.

However our webpack'ed targets only determine the dependency graph during build and the information is not avaialable.

Currently most webpacked assets are not considered by gn analyze for change detection and does not yield a list of tests to run.

This is because files are not explicitly declared as inputs. Whilst a list of assets could be manually maintained (and be more precise), we choose to simplify by just listing the folders that contain assets.

This change can be verified by using existing cli helper eg.:

CHANGED_FILES=components/ai_chat/resources/page/model_utils.ts

npm run list_affected_tests -- -C ../out/Static_arm64 --base HEAD --files $CHANGED_FILES
brave_components_unittests brave_browser_tests brave_installer_unittests brave_network_audit_tests brave_unit_tests browser_tests [...more tests]

On master this list is empty and only yields this list of testnames if the list of changed files includes an entry point file.

https://github.com/brave/brave-browser/wiki/Tests#experimental-run-affected-tests-only


Related issues and work: