Stryker: Projectroot in stryker configuration object

Created on 9 Mar 2018  路  6Comments  路  Source: stryker-mutator/stryker

Currently we are using process.cwd() in a lot of plugins to resolve the current working directory in some of our stryker packages. This is undesirable in tests we sometimes want to mock the current working directory to "pretend" we're somewhere else. The only way to do this at the moment is to mock process.cwd() which can cause side effects. It would be better to define a projectRoot or base property on the Stryker config object that points to the current working directory. This way we can make our own Stryker config with a projectRoot or base that points somewhere else without harming process.cwd().

馃殌 Feature request

All 6 comments

How about basePath? (same as Karma)

A list of components that should use this property:

  • stryker: input file resolver and mutate property
  • karma-runner: use to locate karma configuration
  • typescript-transpiler: locate the tsconfig file
  • babel-transpiler: use to locate babelrc
  • webpack-transpiler: use to locate wepack config file.
  • mocha-runner: locate mocha.opts file

Let's first finish #589

How about basePath? (same as Karma)

Sounds good

OK, the way it should work:

basePath will always be set by stryker and defaults to . (current directory).

If basePath is set in stryker.conf.js: that basePath is used, relative to the stryker.conf.js file. For example: path.resolve(path.dirname('path/to/stryker.conf.js'), options.basePath)

This should also solve #245

I think this also solves #137

I'll get to work on this 馃憤

As discussed we won't do this right now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rabomarnix picture rabomarnix  路  5Comments

CheshireSwift picture CheshireSwift  路  5Comments

belmirofss picture belmirofss  路  4Comments

simondel picture simondel  路  6Comments

rbadr picture rbadr  路  4Comments