Skip to content

Doesn't work with AVA tests in separate processes #41

Closed
@jedrichards

Description

I think this issue has already been noted here #4 (comment) but thought it would be worth making a dedicated issue, since it looks like no solution has been found?

The ava test runner runs each file under test in a new process, so I think this has the effect of adjusting the pwd to the folder of the current file and breaking this plugins ability to find the webpack config.

So a babel config that looks like,

{
  "presets": ["es2015"],
  "env": {
    "AVA": {
      "plugins": [
        [
          "babel-plugin-webpack-loaders",
          {
            "config": "./webpack.config.ava.js",
            "verbose": false
          }
        ]
      ]
    }
  }
}

breaks with an error,

Cannot find module '/Users/jed/work/project/components/text-control/webpack.config.ava.js'

If I change the config to the below it works perfectly, but obviously the absolute filepath is no good on a shared project ...

{
  "presets": ["es2015"],
  "env": {
    "AVA": {
      "plugins": [
        [
          "babel-plugin-webpack-loaders",
          {
            "config": "/Users/jed/work/project/webpack.config.ava.js",
            "verbose": false
          }
        ]
      ]
    }
  }
}

Any body got any ideas? I would be happy to try and prepare a PR ... but not sure what approach to take ...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions