diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed5e9f4..2892120 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 14 + - name: Use Node.js 20 uses: actions/setup-node@v4.0.3 env: INPUT_TOKEN: ${{ secrets.NPM_TOKEN }} with: - node-version: 14 + node-version: 20 - name: Authenticate with GitHub package registry run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc - name: npm install diff --git a/cxAstScan/package-lock.json b/cxAstScan/package-lock.json index fd59517..d13105d 100644 --- a/cxAstScan/package-lock.json +++ b/cxAstScan/package-lock.json @@ -6,7 +6,7 @@ "": { "dependencies": { "@checkmarxdev/ast-cli-javascript-wrapper-runtime-cli": "1.0.3", - "azure-pipelines-task-lib": "4.10.1" + "azure-pipelines-task-lib": "4.13.0" } }, "node_modules/@checkmarxdev/ast-cli-javascript-wrapper-runtime-cli": { @@ -133,13 +133,12 @@ } }, "node_modules/azure-pipelines-task-lib": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.10.1.tgz", - "integrity": "sha512-tehYJhA0FY48rQunic8FGYnUPNAkoCAkXUmbueW2k7fhIC+ujWJB8pwEodZ7w5r5jRgkYasr0mRFIT1cZZ20VQ==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.13.0.tgz", + "integrity": "sha512-KVguui31If98vgokNepHUxE3/D8UFB4FHV1U6XxjGOkgxxwKxbupC3knVnEiZA/hNl7X+vmj9KrYOx79iwmezQ==", "license": "MIT", "dependencies": { "adm-zip": "^0.5.10", - "deasync": "^0.1.28", "minimatch": "3.0.5", "nodejs-file-downloader": "^4.11.1", "q": "^1.5.1", @@ -153,15 +152,6 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "license": "MIT", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -258,20 +248,6 @@ "node": ">=4.0" } }, - "node_modules/deasync": { - "version": "0.1.30", - "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.30.tgz", - "integrity": "sha512-OaAjvEQuQ9tJsKG4oHO9nV1UHTwb2Qc2+fadB0VeVtD0Z9wiG1XPGLJ4W3aLhAoQSYTaLROFRbd5X20Dkzf7MQ==", - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "bindings": "^1.5.0", - "node-addon-api": "^1.7.1" - }, - "engines": { - "node": ">=0.11.0" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -341,12 +317,6 @@ "node": "^12.20 || >= 14.13" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "license": "MIT" - }, "node_modules/flatted": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", @@ -664,12 +634,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/node-addon-api": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "license": "MIT" - }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -1428,12 +1392,11 @@ } }, "azure-pipelines-task-lib": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.10.1.tgz", - "integrity": "sha512-tehYJhA0FY48rQunic8FGYnUPNAkoCAkXUmbueW2k7fhIC+ujWJB8pwEodZ7w5r5jRgkYasr0mRFIT1cZZ20VQ==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.13.0.tgz", + "integrity": "sha512-KVguui31If98vgokNepHUxE3/D8UFB4FHV1U6XxjGOkgxxwKxbupC3knVnEiZA/hNl7X+vmj9KrYOx79iwmezQ==", "requires": { "adm-zip": "^0.5.10", - "deasync": "^0.1.28", "minimatch": "3.0.5", "nodejs-file-downloader": "^4.11.1", "q": "^1.5.1", @@ -1447,14 +1410,6 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -1525,15 +1480,6 @@ "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==" }, - "deasync": { - "version": "0.1.30", - "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.30.tgz", - "integrity": "sha512-OaAjvEQuQ9tJsKG4oHO9nV1UHTwb2Qc2+fadB0VeVtD0Z9wiG1XPGLJ4W3aLhAoQSYTaLROFRbd5X20Dkzf7MQ==", - "requires": { - "bindings": "^1.5.0", - "node-addon-api": "^1.7.1" - } - }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1574,11 +1520,6 @@ "web-streams-polyfill": "^3.0.3" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "flatted": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", @@ -1802,11 +1743,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node-addon-api": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" - }, "node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", diff --git a/cxAstScan/package.json b/cxAstScan/package.json index 3e4aad0..0824f70 100644 --- a/cxAstScan/package.json +++ b/cxAstScan/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "azure-pipelines-task-lib": "4.10.1", + "azure-pipelines-task-lib": "4.13.0", "@checkmarxdev/ast-cli-javascript-wrapper-runtime-cli": "1.0.3" } } diff --git a/cxAstScan/task.json b/cxAstScan/task.json index ea75e75..6aa725c 100644 --- a/cxAstScan/task.json +++ b/cxAstScan/task.json @@ -15,7 +15,7 @@ "Patch": 0 }, "demands": [], - "minimumAgentVersion": "1.0.0", + "minimumAgentVersion": "3.232.1", "groups": [ { "name": "params", @@ -67,12 +67,12 @@ } ], "execution": { - "Node16": { + "Node20_1": { "target": "./dist/index.js" } }, "postjobexecution": { - "Node16": { + "Node20_1": { "target": "./dist/cleanup.js" } }, diff --git a/cxAstScan/test/_suite.ts b/cxAstScan/test/_suite.ts index d76ad20..47d9253 100644 --- a/cxAstScan/test/_suite.ts +++ b/cxAstScan/test/_suite.ts @@ -2,111 +2,107 @@ import * as path from 'path'; import * as ttm from 'azure-pipelines-task-lib/mock-test'; import * as assert from 'assert'; -const nodeVersion = 16; +const nodeVersion = 20; describe('Task runner test', function () { - - it('should be success with api key', function (done) { + it('should be success with api key', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'success_api_key.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); - console.log(tr.stdout) - console.log(tr.stderr) + console.log(tr.stdout); + console.log(tr.stderr); assert.ok(tr.succeeded); - done(); }); - - it('should be success wait mode', function (done) { + + it('should be success wait mode', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'success_waitmode.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); - console.log(tr.stdout) - console.log(tr.stderr) + console.log(tr.stdout); + console.log(tr.stderr); assert.ok(tr.succeeded); - done(); }); - it('should be success no wait mode', function (done) { + it('should be success no wait mode', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'success_nowait.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); - console.log(tr.stdout) - console.log(tr.stderr) + console.log(tr.stdout); + console.log(tr.stderr); assert.ok(tr.succeeded); - done(); }); - it('should be failure additional params', function (done) { + it('should be failure additional params', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'failure_additional_params.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); - console.log(tr.stdout) - console.log(tr.stderr) + await tr.runAsync(nodeVersion); + + console.log(tr.stdout); + console.log(tr.stderr); assert.ok(tr.failed); - done(); }); - it('should be failure preset', function (done) { + it('should be failure preset', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'failure_wrong_preset.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); - console.log(tr.stdout) - console.log(tr.stderr) + console.log(tr.stdout); + console.log(tr.stderr); assert.ok(tr.failed); - done(); }); - it('should be success no cancel scan', function (done) { + it('should be success no cancel scan', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'success_no_cancel.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); + console.log(tr.succeeded); assert.strictEqual(tr.succeeded, true, 'should have succeeded'); console.log(tr.stdout); - assert.strictEqual(tr.stdout.indexOf('Pipeline not cancelled, nothing to do.') >= 0, - true, - "should display cleanup message: Pipeline not cancelled, nothing to do."); - done(); + assert.strictEqual(tr.stdout.indexOf('Pipeline not cancelled, nothing to do.') >= 0, + true, + "should display cleanup message: Pipeline not cancelled, nothing to do."); }); - it('should be success cancel scan', function (done) { + it('should be success cancel scan', async function () { this.timeout(3000000); const scan = path.join(__dirname, 'success_nowait.js'); const scanTestRunner: ttm.MockTestRunner = new ttm.MockTestRunner(scan); - scanTestRunner.run(nodeVersion); - console.log(scanTestRunner.stdout) - console.log(scanTestRunner.stderr) + await scanTestRunner.runAsync(nodeVersion); + + console.log(scanTestRunner.stdout); + console.log(scanTestRunner.stderr); assert.ok(scanTestRunner.succeeded); - + const tp = path.join(__dirname, 'success_cancel.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); + console.log(tr.stdout); - assert.strictEqual(tr.stdout.indexOf('Canceling scan with ID') >= 0, - true, - "should display cleanup message: Canceling scan with ID"); - done(); + assert.strictEqual(tr.stdout.indexOf('Canceling scan with ID') >= 0, + true, + "should display cleanup message: Canceling scan with ID"); }); - it('should be success cancel before scan start', function (done) { + it('should be success cancel before scan start', async function () { this.timeout(3000000); const tp = path.join(__dirname, 'success_cancel.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); - tr.run(nodeVersion); + await tr.runAsync(nodeVersion); + console.log(tr.stdout); assert.strictEqual(tr.stdout.indexOf('Log file not created. Task ended successfully') >= 0, - true, - "should display cleanup message: Log file not created. Task ended successfully."); - done(); + true, + "should display cleanup message: Log file not created. Task ended successfully."); }); });