Skip to content

test-runner configFilePath option makes incorrect assumption about directory structure #2982

Description

@wjhsf

const baseDir = group.configFilePath ? path.dirname(group.configFilePath) : process.cwd();
const testFilesForGroup = collectTestFiles(group.files, baseDir)

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions