Skip to content

fix(run-multiple): resolve config test patterns that are arrays or Windows paths - #5755

Open
luantaraschi wants to merge 1 commit into
codeceptjs:4.xfrom
luantaraschi:fix/run-multiple-config-patterns
Open

luantaraschi wants to merge 1 commit into
codeceptjs:4.xfrom
luantaraschi:fix/run-multiple-config-patterns

Conversation

@luantaraschi

Copy link
Copy Markdown
Contributor

Motivation/Description of the PR

Fixes #5358.

With -c, run-multiple runs path.resolve(testRoot, ...) on tests and gherkin.features. On Windows that gives backslashes, which glob reads as escapes, so 0 feature files match. On any OS, an array value makes path.resolve throw TypeError [ERR_INVALID_ARG_TYPE]. The patterns are now resolved one by one and joined with forward slashes. They stay absolute, since chunk.js globs them without a cwd.

With a project like the one in the issue (2 browsers, 2 feature files), run-multiple --all -c codecept.conf.js went from 0 to 2 passed per run, and the array form from a TypeError to 2 passed per run. Two unit tests (string and array) glob the sandbox features through the new helper. Both fail with the old path.resolve call.

Unit suite on Windows: same 11 path-related failures as 4.x, plus the two new tests passing. npm run lint is clean. I couldn't check the Linux side locally, where only the array case was broken.

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium

Applicable plugins:

  • aiTrace
  • autoDelay
  • autoLogin
  • customLocator
  • pause
  • coverage
  • heal
  • retryFailedStep
  • screenshot
  • selenoid
  • stepTimeout
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

With --config, run-multiple resolved config.tests and gherkin.features
with path.resolve. On Windows this produced backslash paths, which glob
treats as escapes, so no feature files were found. An array of patterns
made path.resolve throw a TypeError on every platform.

Resolve each pattern separately and use forward slashes.

Fixes codeceptjs#5358

This branch has not been deployed

No deployments
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.

run-multiple command picks 0 feature files when -c CLI option is specified

1 participant