-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(stryker): #336 Configurable tmp folder location #475
Conversation
…used and replaced by TempFolder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I still have some remarks.
Also: how do we prevent a user from using an absolute path? Using an absolute path (for example /tmp/dir/
) breaks mocha tests, however it would not break karma tests.
Do we want to prevent users from configuring an absolute path? @simondel maybe you have an opion on this?
packages/stryker/README.md
Outdated
|
||
#### Temporary folder | ||
**Command line:** `--tempFolder .stryker-tmp` | ||
**Config file:** `logLevel: '.stryker-tmp'` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still refers to logLevel
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/stryker/src/StrykerCli.ts
Outdated
@@ -47,6 +47,7 @@ export default class StrykerCli { | |||
.option('--timeoutFactor <number>', 'Tweak the standard deviation relative to the normal test run of a mutated test', parseFloat) | |||
.option('--maxConcurrentTestRunners <n>', 'Set the number of max concurrent test runner to spawn (default: cpuCount)', parseInt) | |||
.option('--logLevel <level>', 'Set the log4js log level. Possible values: fatal, error, warn, info, debug, trace, all and off. Default is "info"') | |||
.option('--tempFolder <name>', 'Set name of the folder that contains temporary files') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call it tempFolder
or tempDir
(or tempDirectory
). I think tempDir
is more clear, we should always refer to directory
instead of folder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think tempDir
is better. But if we change it we should also change the TempFolder
class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to tempDir
@@ -15,6 +15,7 @@ export class TempFolder { | |||
initialize(tempDirName = '.stryker-tmp') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable tempDirName
should not have a default value, as this is a duplicate from the Config
class.
|
||
expect(fileUtils.deleteDir).to.have.been.calledWith( | ||
tempFolderInstance.baseTempFolder | ||
); | ||
|
||
result.then(data => expect(data).equals('delResolveStub')); | ||
expect(result).equals('delResolveStub'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better indeed 👍
packages/stryker/README.md
Outdated
**Default value:** `.stryker-tmp` | ||
**Mandatory**: no | ||
**Description:** | ||
Set name of the folder that contains temporary files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's smart to mention that stryker will attempt to delete this folder after it's done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
packages/stryker/src/StrykerCli.ts
Outdated
@@ -47,6 +47,7 @@ export default class StrykerCli { | |||
.option('--timeoutFactor <number>', 'Tweak the standard deviation relative to the normal test run of a mutated test', parseFloat) | |||
.option('--maxConcurrentTestRunners <n>', 'Set the number of max concurrent test runner to spawn (default: cpuCount)', parseInt) | |||
.option('--logLevel <level>', 'Set the log4js log level. Possible values: fatal, error, warn, info, debug, trace, all and off. Default is "info"') | |||
.option('--tempFolder <name>', 'Set name of the folder that contains temporary files') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think tempDir
is better. But if we change it we should also change the TempFolder
class.
@nicojs Why would an absolute path break mocha? |
@simondel Because mocha uses Require that search node_modules up in the directories of the application. When the temp folder is not within the root of the application is will fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small cosmetic remarks.
@@ -19,6 +19,7 @@ export default class Config implements StrykerOptions { | |||
mutator: string = 'es5'; | |||
transpilers: string[] = []; | |||
maxConcurrentTestRunners: number = Infinity; | |||
tempFolder: string = '.stryker-tmp'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be renamed to tempDir
@@ -1,74 +0,0 @@ | |||
import * as fs from 'mz/fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Removing code makes me happy
packages/stryker/README.md
Outdated
**Default value:** `.stryker-tmp` | ||
**Mandatory**: no | ||
**Description:** | ||
Set name of the folder that contains temporary files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a little more descriptive. Something like:
Set the name of the directory that is used by Stryker as a working directory. This directory is used to keep copies of your files that are used by Stryker to mutate your code safely. This directory will be cleaned after a successful run. Warning! If you configure an absolute path (for example /tmp/stryker
), node-based test runners like mocha will fail, because your node_modules
cannot be loaded. Use with caution.
packages/stryker/src/StrykerCli.ts
Outdated
@@ -47,6 +47,7 @@ export default class StrykerCli { | |||
.option('--timeoutFactor <number>', 'Tweak the standard deviation relative to the normal test run of a mutated test', parseFloat) | |||
.option('--maxConcurrentTestRunners <n>', 'Set the number of max concurrent test runner to spawn (default: cpuCount)', parseInt) | |||
.option('--logLevel <level>', 'Set the log4js log level. Possible values: fatal, error, warn, info, debug, trace, all and off. Default is "info"') | |||
.option('--tempDir <name>', 'Set name of the folder that contains temporary files. Stryker will try to remove the content when the tests ran') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also update this one. Something like:
"Set the name of the directory that is used by Stryker as a working directory. This directory will be cleaned after a successful run. "
|
Well... i could incidentally use |
@nicojs true, but what do you want to do about it? |
Well.. Maybe we could clean the directory first. Remove all sandbox sub directories. If the directory is empty after that, we can remove it safely. To remove all sandbox sub directories, we can just use rimraf and give it the pattern: I think we can safely remove that. |
This PR is stale. Closing for now, please create a new PR. |
any plans to implement the configurable tempFolder? @nicojs |
We've got lot of plans 😅 This is pretty easy to solve if we can simply give it another name. If you want support for it inside your OS temp folder it will take some more time. What would you prefer? |
I was thinking something similar with this PR where you just specify another name inside the project itself. Do you need help with it? |
Help is always welcome! The best solution would be to make If you need help setting up the dependency injection, please let me know. Inside the We should also rename |
i created a PR #1644, could you check if I am going in the right track regarding the DI. |
No description provided.