Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADO | Upgrade Node Version to 20 (AST-72934) #633

Merged
merged 8 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down
78 changes: 7 additions & 71 deletions cxAstScan/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cxAstScan/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 3 additions & 3 deletions cxAstScan/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.0.0",
"minimumAgentVersion": "3.232.1",
OrShamirCM marked this conversation as resolved.
Show resolved Hide resolved
"groups": [
{
"name": "params",
Expand Down Expand Up @@ -67,12 +67,12 @@
}
],
"execution": {
"Node16": {
"Node20_1": {
"target": "./dist/index.js"
}
},
"postjobexecution": {
"Node16": {
"Node20_1": {
"target": "./dist/cleanup.js"
}
},
Expand Down
94 changes: 45 additions & 49 deletions cxAstScan/test/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
});
});