web icon indicating copy to clipboard operation
web copied to clipboard

test-runner `configFilePath` option makes incorrect assumption about directory structure

Open wjhsf opened this issue 3 months ago • 1 comments

https://github.com/modernweb-dev/web/blob/9942e84d48ce75224dd9d09f70c72a41f374c377/packages/test-runner-core/src/runner/createSessionGroups.ts#L68-L69

There is an assumption, in the code above, that tests are contained in the same directory as the configs. That is not the case for my project, which has this file structure:

configs
├── foo.js
└── bar.js
tests
├── foo
└── bar
web-test-runner.config.js

This is the configuration in web-test-runner.config.js

export default {
  // ...base config
  groups: [
    {
      name: 'foo',
      files: 'test/foo/*.spec.js'
      configFilePath: 'configs/foo.js'
    },
    {
      name: 'bar',
      files: 'test/bar/*spec.js'
      configFilePath: 'configs/foo.js'
    }
  ]
}

Because I am defining the files glob in web-test-runner.config.js, I would expect it to be relative to that file (or cwd), rather than relative to the configFilePath file.

wjhsf avatar Sep 02 '25 21:09 wjhsf

From the top of my head I don't know why it was relative to the config path, it's logical to me what you suggest. Can you make a PR fixing this please?

bashmish avatar Sep 04 '25 13:09 bashmish