-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
:closes: #143 add process to rename and push test files to git
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 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,39 @@ | ||
import fs from 'fs'; | ||
import path from "path"; | ||
import {exec} from "child_process"; | ||
|
||
|
||
const testResults = path.join(__dirname, 'test-results'); | ||
|
||
const args = process.argv.slice(2); | ||
if(args.length < 1) { | ||
console.error('Please provide the new naming for test folder') | ||
} | ||
const newTestDir = args[0]; | ||
|
||
const gitCommands = `git add . && git commit -m "Add test report" && git push origin test`; | ||
|
||
// Rename test folder and push | ||
fs.rename(testResults, newTestDir, (err) => { | ||
if (err) { | ||
console.error('Error renaming/moving file:', err); | ||
} else { | ||
exec(gitCommands, { cwd: newTestDir }, (err, stdout, stderr) => { | ||
if (err) { | ||
console.error('Error executing git commands:', err); | ||
} | ||
|
||
if (stderr) { | ||
console.error('Git stderr output:', stderr); | ||
return; | ||
} | ||
|
||
//Revert the renaming of test folder to avoid tracking it in e2e | ||
fs.rename(newTestDir, testResults, (err) => { | ||
if (err) { | ||
console.error('Error reverting the directory name:', err); | ||
} | ||
}); | ||
}); | ||
} | ||
}); |