|
2 | 2 | const fs = require("fs"); |
3 | 3 |
|
4 | 4 | const archiver = require("archiver"), |
| 5 | + Constants = require('../helpers/constants'), |
5 | 6 | logger = require("./logger").winstonLogger; |
6 | 7 |
|
7 | | -const archiveSpecs = (runSettings, filePath) => { |
| 8 | +const archiveSpecs = (runSettings, filePath, excludeFiles) => { |
8 | 9 | return new Promise(function (resolve, reject) { |
9 | 10 | var output = fs.createWriteStream(filePath); |
10 | 11 |
|
@@ -36,9 +37,18 @@ const archiveSpecs = (runSettings, filePath) => { |
36 | 37 |
|
37 | 38 | archive.pipe(output); |
38 | 39 |
|
39 | | - let allowedFileTypes = [ 'js', 'json', 'txt', 'ts', 'feature', 'features', 'pdf', 'jpg', 'jpeg', 'png', 'zip' ]; |
40 | | - allowedFileTypes.forEach(fileType => { |
41 | | - archive.glob(`**/*.${fileType}`, { cwd: cypressFolderPath, matchBase: true, ignore: ['**/node_modules/**', './node_modules/**', 'package-lock.json', 'package.json', 'browserstack-package.json', 'tests.zip'] }); |
| 40 | + let ignoreFiles = Constants.filesToIgnoreWhileUploading; |
| 41 | + |
| 42 | + // exclude files asked by the user |
| 43 | + // args will take precedence over config file |
| 44 | + if (!Utils.isUndefined(excludeFiles)) { |
| 45 | + ignoreFiles = ignoreFile.concat(Utils.fixCommaSeparatedString(excludeFiles).split(',')); |
| 46 | + } else if (!Utils.isUndefined(runSettings.exclude)) { |
| 47 | + ignoreFiles = ignoreFile.concat(excludeFiles); |
| 48 | + } |
| 49 | + |
| 50 | + Constants.allowedFileTypes.forEach(fileType => { |
| 51 | + archive.glob(`**/*.${fileType}`, { cwd: cypressFolderPath, matchBase: true, ignore: ignoreFiles }); |
42 | 52 | }); |
43 | 53 |
|
44 | 54 | let packageJSON = {}; |
|
0 commit comments