Karma test files missing when basePath changes between local and CI
0 reputation · 03 Sept 2022, 16:53 UTC
Karma test files missing when basePath changes between local and CI
The goal is to make Karma load the same set of test files defined in `files` on a developer workstation and in a Linux-based CI container. Assuming current Karma versions, `files` glob patterns resolve relative to `basePath`, which defaults to the current working directory. When that directory changes, or when path separators differ between Windows and Unix, the same configuration can omit or duplicate files without an obvious failure in the browser launcher.
It is unclear whether the production config should pin `basePath` explicitly, normalize glob patterns for the container filesystem, or adjust the working directory before Karma starts. The behavior may also depend on whether files are copied into the container before or after the Karma process initializes.
Which `basePath` value should be used so that `files` globs resolve identically across local and CI environments? Should the configuration use absolute paths or environment-relative paths to avoid working-directory drift? What is the best way to compare the resolved file list between environments without changing the test suite?