From f6fbd44625131b4c278e1ef4b7dbcd8a649cbbcb Mon Sep 17 00:00:00 2001 From: agracio Date: Mon, 23 Sep 2024 20:16:35 +0100 Subject: [PATCH] updating CI test runner --- .github/workflows/main.yml | 2 +- test/configCI.json | 3 ++- tools/test.js | 25 ++++++++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81d5d80d..4394fe6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/test/configCI.json b/test/configCI.json index 5df6705b..a3974b45 100644 --- a/test/configCI.json +++ b/test/configCI.json @@ -8,6 +8,7 @@ }, "mochaJunitReporterReporterOptions": { - "mochaFile": "test-results-{id}.xml" + "mochaFile": "test-results-{id}.xml", + "includePending": true } } \ No newline at end of file diff --git a/tools/test.js b/tools/test.js index 1cc47c03..e14b1b81 100644 --- a/tools/test.js +++ b/tools/test.js @@ -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'], { @@ -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(); @@ -117,7 +133,7 @@ function runOnSuccess(code, signal) { } }).on('error', function(err) { console.log(err); - });; + }); } } @@ -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}`)) + } }) }