Skip to content

Commit

Permalink
updating CI test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Sep 23, 2024
1 parent 2f3dc15 commit f6fbd44
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
node: ${{ matrix.node }}

- if: runner.os == 'macOS' || runner.os == 'Linux'
name: "Run .net core tests"
name: "Run macOS|Linux tests"
run: node tools/test.js CI
env:
EDGE_USE_CORECLR: 1
Expand Down
3 changes: 2 additions & 1 deletion test/configCI.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

},
"mochaJunitReporterReporterOptions": {
"mochaFile": "test-results-{id}.xml"
"mochaFile": "test-results-{id}.xml",
"includePending": true
}
}
25 changes: 22 additions & 3 deletions tools/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ function runOnSuccess(code, signal) {

process.env['EDGE_APP_ROOT'] = path.join(testDir, 'bin', 'Debug', 'net6.0');

if(runner === 'all')
{
if(fs.existsSync(`./test/mochawesome-report/mochawesome-net.json`) && !process.env.EDGE_USE_CORECLR){
fs.unlinkSync(`./test/mochawesome-report/mochawesome-net.json`)
}
if(fs.existsSync(`./test/mochawesome-report/mochawesome-coreclr.json`) && process.env.EDGE_USE_CORECLR){
fs.unlinkSync(`./test/mochawesome-report/mochawesome-coreclr.json`)
}
if(fs.existsSync(`./test/mochawesome-report/mochawesome.json`)){
fs.unlinkSync(`./test/mochawesome-report/mochawesome.json`)
}
if(fs.existsSync(`./test/mochawesome-report/mochawesome.html`)){
fs.unlinkSync(`./test/mochawesome-report/mochawesome.html`)
}
}

if(!runner)
{
spawn('node', [mocha, testDir, '-R', 'spec', '-t', '10000', '-n', 'expose-gc'], {
Expand Down Expand Up @@ -106,7 +122,7 @@ function runOnSuccess(code, signal) {
{
if(!process.env.EDGE_USE_CORECLR){
process.env.EDGE_USE_CORECLR = 1;
runOnSuccess(code, signal);
runOnSuccess(0, signal);
}
else{
mergeFiles();
Expand All @@ -117,7 +133,7 @@ function runOnSuccess(code, signal) {
}
}).on('error', function(err) {
console.log(err);
});;
});
}
}

Expand Down Expand Up @@ -164,6 +180,9 @@ function mergeFiles(){
var file = runner === 'all' ? './test/mochawesome-report/mochawesome.json' : 'mochawesome.json';
fs.writeFileSync(file, JSON.stringify(report, null, 2))
console.log(`Mochawesome json created: ${file}`);
marge.create(report, margeOptions).then(() => console.log(`Mochawesome report created: ${margeOptions.reportDir}/${margeOptions.reportFilename}`))
if(runner === 'all')
{
marge.create(report, margeOptions).then(() => console.log(`Mochawesome report created: ${margeOptions.reportDir}/${margeOptions.reportFilename}`))
}
})
}

0 comments on commit f6fbd44

Please sign in to comment.