forked from salto-io/salesforce-ci-cd-org-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsePR.js
26 lines (20 loc) · 749 Bytes
/
parsePR.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs');
const readline = require('readline')
async function extractTests(){
//by default we specify that all tests should run
let testsFile = __dirname+'/testsToRun.txt';
await fs.promises.writeFile(testsFile,'all');
const lines = readline.createInterface({
input: fs.createReadStream(__dirname+'/pr_body.txt'),
crlfDelay: Infinity
});
for await (const line of lines) {
//special delimeter for apex tests
if(line.includes('Apex::[') && line.includes(']::Apex')){
let tests = line.substring(8,line.length-7);
await fs.promises.writeFile(testsFile,tests);
await fs.promises.appendFile(testsFile,'\n');
}
}
}
extractTests();