-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed copy files for broken symlink case (#13759)
* Fixed copy files for broken symlinks case * Added unit tests * Fixed typo * Moved find options to separate object * Skipping node downloading * Reverted make.js test changes * Added general timeout
- Loading branch information
Anatoly Bolshakov
authored
Oct 29, 2020
1 parent
c54a6bb
commit dc07aba
Showing
5 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs = require('fs'); | ||
import mockanswer = require('azure-pipelines-task-lib/mock-answer'); | ||
import mockrun = require('azure-pipelines-task-lib/mock-run'); | ||
import path = require('path'); | ||
|
||
let taskPath = path.join(__dirname, '..', 'copyfiles.js'); | ||
let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath); | ||
runner.setInput('Contents', '**'); | ||
runner.setInput('SourceFolder', path.normalize('/srcDir')); | ||
runner.setInput('TargetFolder', path.normalize('/destDir')); | ||
runner.setInput('CleanTargetFolder', 'false'); | ||
runner.setInput('Overwrite', 'false'); | ||
let answers = <mockanswer.TaskLibAnswers> { | ||
checkPath: { }, | ||
find: { }, | ||
}; | ||
answers.checkPath[path.normalize('/srcDir')] = true; | ||
runner.setAnswers(answers); | ||
|
||
|
||
runner.registerMockExport('find', (itemPath: string, options: any) => { | ||
if(!options.allowBrokenSymbolicLinks) { | ||
throw new Error(""); | ||
} | ||
|
||
return ['/srcDir/file1']; | ||
}); | ||
|
||
// as a precaution, disable fs.chmodSync. it should not be called during this scenario. | ||
fs.chmodSync = null; | ||
runner.registerMock('fs', fs); | ||
|
||
runner.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters