Skip to content

Conversation

@idavidrein
Copy link

Fix for Issue stdlib-js#2096

Problem

The test workflow was not running tests located in nested directories within package test folders. This was happening because the run_affected_tests script was using the -maxdepth 2 parameter with find, which limited the search depth and prevented finding test files in subdirectories of the test folder.

Solution

Removed the -maxdepth 2 restriction from the find command in the run_affected_tests script. Now the test runner will properly discover and run all test files, including those in nested directories.

Test Results

To verify this fix works:

  1. Create a test structure with nested test files:
mkdir -p lib/node_modules/test-pkg/test/nested
echo "console.log(\"Test in nested directory\")" > lib/node_modules/test-pkg/test/nested/test.js
  1. Run the find command with the old restriction:
find lib -maxdepth 2 -wholename "**/test/test*.js"
# No results
  1. Run the find command with our fix:
find lib -wholename "**/test/test*.js"
# Output: lib/node_modules/test-pkg/test/nested/test.js

This demonstrates that the fix correctly finds test files in nested directories.

Testing Instructions

  1. Clone this repository
  2. Create a test structure with nested test files:
mkdir -p lib/node_modules/test-pkg/test/nested
echo "console.log(\"Test in nested directory\")" > lib/node_modules/test-pkg/test/nested/test.js
  1. Run the following commands to verify the behavior:
# This command should find the nested test file
find lib -wholename "**/test/test*.js"
  1. Alternatively, in a real-world package with nested tests, the workflow would now properly discover and run those tests.

The output of the tests above is as follows:

lib/node_modules/test-pkg/test/nested/test.js

This fix ensures that the CI workflow will now catch issues in tests located in nested directories, which was the problem identified in issue stdlib-js#2096.

@mentatbot
Copy link

mentatbot bot commented Apr 9, 2025

If you would like me to review this PR, either tag me in a comment or check this box:

  • Review PR

You can disable automatic comments on my settings page

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.

2 participants