-
Notifications
You must be signed in to change notification settings - Fork 250
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
feat(InputfileResolver): exclude online files from globbing #194
Conversation
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! You may want to change the functionisWebUrl
@@ -7,13 +7,18 @@ const log = log4js.getLogger('InputFileResolver'); | |||
|
|||
const DEFAULT_INPUT_FILE_PROPERTIES = { mutated: false, included: true }; | |||
|
|||
function isWebUrl(pattern: string): boolean { | |||
return pattern.indexOf('http://') === 0 || pattern.indexOf('https://') === 0; |
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.
You could also use pattern.startsWith('http://')
👍
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.
Turns out this is a part of ES6, thanks for the heads-up @Kattoor
if (mutationArray) { | ||
mutationArray.forEach(mutation => { | ||
if (isWebUrl(mutation)) { | ||
throw new Error(`Cannot mutate web url "${mutation}".`) |
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.
You're missing a semicolon here: https://www.bithound.io/github/stryker-mutator/stryker/blob/869ee89d6fec2bf3ea98d36491e4efc7aaec8658/src/InputFileResolver.ts
This may not work when we copy the files to the sandbox because the file is not on the file system. It may be smart to move |
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.
@Kattoor you forgot to make changes to the Sandbox
. See fillSandbox
method.
The Sandbox
class represents an isolated test runner with its own copy of all the files, It should not contain copies of web url's, those can safely be shared across active test runners.
I'll fix this |
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, just one small thing.
if (isOnlineFile(file.path)) { | ||
this.fileMap[file.path] = file.path; | ||
return Promise.resolve(); | ||
} |
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.
Could you add an else here? That is a bit cleaner and safer IMHO.
This pull request fixed issue #90