Skip to content

Commit ef5c02c

Browse files
author
Anatoly Bolshakov
authored
[Release m181] Reverted changes for CopyFilesV2 to 1.178.0 (#14269)
* Revert "Migration of CopyFilesV2 task to Node 10 (#13966)" This reverts commit e3b749b. * Bumped task version
1 parent 35188f7 commit ef5c02c

File tree

15 files changed

+3987
-400
lines changed

15 files changed

+3987
-400
lines changed

Tasks/CopyFilesV2/Tests/L0.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('CopyFiles L0 Suite', function () {
1010

1111
after(() => { });
1212

13-
it('copy files from srcdir to destdir', (done: Mocha.Done) => {
13+
it('copy files from srcdir to destdir', (done: MochaDone) => {
1414
this.timeout(1000);
1515

1616
let testPath = path.join(__dirname, 'L0copyAllFiles.js');
@@ -50,7 +50,7 @@ describe('CopyFiles L0 Suite', function () {
5050
done();
5151
});
5252

53-
it('copy files from srcdir to destdir with brackets in src path', (done: Mocha.Done) => {
53+
it('copy files from srcdir to destdir with brackets in src path', (done: MochaDone) => {
5454
this.timeout(1000);
5555

5656
let testPath = path.join(__dirname, 'L0copyAllFilesWithBracketsInSrcPath.js');
@@ -90,7 +90,7 @@ describe('CopyFiles L0 Suite', function () {
9090
done();
9191
});
9292

93-
it('copy files and subtract based on exclude pattern', (done: Mocha.Done) => {
93+
it('copy files and subtract based on exclude pattern', (done: MochaDone) => {
9494
this.timeout(1000);
9595

9696
let testPath = path.join(__dirname, 'L0copySubtractExclude.js');
@@ -121,7 +121,7 @@ describe('CopyFiles L0 Suite', function () {
121121
done();
122122
});
123123

124-
it('fails if Contents not set', (done: Mocha.Done) => {
124+
it('fails if Contents not set', (done: MochaDone) => {
125125
this.timeout(1000);
126126

127127
let testPath = path.join(__dirname, 'L0failsIfContentsNotSet.js');
@@ -133,7 +133,7 @@ describe('CopyFiles L0 Suite', function () {
133133
done();
134134
});
135135

136-
it('fails if SourceFolder not set', (done: Mocha.Done) => {
136+
it('fails if SourceFolder not set', (done: MochaDone) => {
137137
this.timeout(1000);
138138

139139
let testPath = path.join(__dirname, 'L0failsIfSourceFolderNotSet.js');
@@ -145,7 +145,7 @@ describe('CopyFiles L0 Suite', function () {
145145
done();
146146
});
147147

148-
it('fails if TargetFolder not set', (done: Mocha.Done) => {
148+
it('fails if TargetFolder not set', (done: MochaDone) => {
149149
this.timeout(1000);
150150

151151
let testPath = path.join(__dirname, 'L0failsIfTargetFolderNotSet.js');
@@ -157,7 +157,7 @@ describe('CopyFiles L0 Suite', function () {
157157
done();
158158
});
159159

160-
it('fails if SourceFolder not found', (done: Mocha.Done) => {
160+
it('fails if SourceFolder not found', (done: MochaDone) => {
161161
this.timeout(1000);
162162

163163
let testPath = path.join(__dirname, 'L0failsIfSourceFolderNotFound.js');
@@ -169,7 +169,7 @@ describe('CopyFiles L0 Suite', function () {
169169
done();
170170
});
171171

172-
it('fails if target file is a directory', (done: Mocha.Done) => {
172+
it('fails if target file is a directory', (done: MochaDone) => {
173173
this.timeout(1000);
174174

175175
let testPath = path.join(__dirname, 'L0failsIfTargetFileIsDir.js');
@@ -206,7 +206,7 @@ describe('CopyFiles L0 Suite', function () {
206206
done();
207207
});
208208

209-
it('overwrites if specified', (done: Mocha.Done) => {
209+
it('overwrites if specified', (done: MochaDone) => {
210210
this.timeout(1000);
211211

212212
let testPath = path.join(__dirname, 'L0overwritesIfSpecified.js');
@@ -231,7 +231,7 @@ describe('CopyFiles L0 Suite', function () {
231231
done();
232232
});
233233

234-
it('preserves timestamp if specified', (done: Mocha.Done) => {
234+
it('preserves timestamp if specified', (done: MochaDone) => {
235235
this.timeout(1000);
236236

237237
let testPath = path.join(__dirname, 'L0preservesTimestampIfSpecified.js');
@@ -259,7 +259,7 @@ describe('CopyFiles L0 Suite', function () {
259259
done();
260260
});
261261

262-
it('cleans if specified', (done: Mocha.Done) => {
262+
it('cleans if specified', (done: MochaDone) => {
263263
this.timeout(1000);
264264

265265
let testPath = path.join(__dirname, 'L0cleansIfSpecified.js');
@@ -290,7 +290,7 @@ describe('CopyFiles L0 Suite', function () {
290290
done();
291291
});
292292

293-
it('cleans if specified and target is file', (done: Mocha.Done) => {
293+
it('cleans if specified and target is file', (done: MochaDone) => {
294294
this.timeout(1000);
295295

296296
let testPath = path.join(__dirname, 'L0cleansIfSpecifiedAndTargetIsFile.js');
@@ -318,7 +318,7 @@ describe('CopyFiles L0 Suite', function () {
318318
done();
319319
});
320320

321-
it('roots patterns', (done: Mocha.Done) => {
321+
it('roots patterns', (done: MochaDone) => {
322322
this.timeout(1000);
323323

324324
let testPath = path.join(__dirname, 'L0rootsPatterns.js');
@@ -341,7 +341,7 @@ describe('CopyFiles L0 Suite', function () {
341341
});
342342

343343
if (process.platform == 'win32') {
344-
it('overwrites readonly', (done: Mocha.Done) => {
344+
it('overwrites readonly', (done: MochaDone) => {
345345
this.timeout(1000);
346346

347347
let testPath = path.join(__dirname, 'L0overwritesReadonly.js');

Tasks/CopyFilesV2/Tests/L0cleansIfSpecified.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ runner.registerMockExport('stats', (itemPath: string) => {
4141
}
4242
});
4343
let origReaddirSync = fs.readdirSync;
44-
45-
fs.readdirSync = (p) => {
44+
fs.readdirSync = (p: string | Buffer) => {
4645
console.log('HERE path ' + p);
47-
let result;
46+
let result: string[];
4847
if (p == path.normalize('/destDir')) {
4948
result = [ 'clean-subDir', 'clean-file.txt' ];
5049
}

Tasks/CopyFilesV2/Tests/L0preservesTimestampIfSpecified.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import fs = require('fs');
22
import mockanswer = require('azure-pipelines-task-lib/mock-answer');
33
import mockrun = require('azure-pipelines-task-lib/mock-run');
44
import path = require('path');
5-
const { promisify } = require('util')
65

76
let taskPath = path.join(__dirname, '..', 'copyfiles.js');
87
let runner: mockrun.TaskMockRunner = new mockrun.TaskMockRunner(taskPath);
@@ -47,9 +46,9 @@ runner.registerMockExport('stats', (itemPath: string) => {
4746
}
4847
});
4948

50-
fs.utimes = promisify(function (targetPath, atime, mtime, err) {
49+
fs.utimes = function (targetPath, atime, mtime, err) {
5150
console.log('Calling fs.utimes on', targetPath);
52-
});
51+
}
5352
runner.registerMock('fs', fs);
5453

5554
runner.run();

0 commit comments

Comments
 (0)