backend/e2e/reports/gerkhins.js (view raw)
1var fs = require('fs');
2const path = require('path');
3var walk = function (dir) {
4 var results = [];
5 var list = fs.readdirSync(dir);
6 list.forEach(function (file) {
7 var fileItem = dir + '/' + file;
8 var stat = fs.statSync(fileItem);
9 if (stat && stat.isDirectory()) {
10 /* Recurse into a subdirectory */
11 results = results.concat(walk(fileItem));
12 } else {
13 /* Is a file */
14 results.push(fileItem);
15 }
16 });
17 return results;
18};
19
20walk('./test/features').forEach(filePath => {
21 const targetDir = './reports/' + path.dirname(filePath);
22 fs.mkdirSync(targetDir, {recursive: true});
23
24 fs.copyFileSync(filePath, targetDir + '/' + path.basename(filePath) + '.txt');
25});