Skip to content

Commit

Permalink
feat(2683): nodejs upgrade (#100)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Node 18 upgrade && eslint upgrade
  • Loading branch information
klu909 committed Dec 13, 2022
1 parent f780477 commit 3ad0673
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "screwdriver-executor-queue",
"version": "3.0.0",
"version": "4.0.0",
"description": "Executor plugin for Screwdriver using Resque",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -33,21 +33,21 @@
"Tiffany Kyi <tiffanykyi@gmail.com>"
],
"devDependencies": {
"chai": "^4.3.4",
"eslint": "^7.7.0",
"eslint-config-screwdriver": "^5.0.4",
"mocha": "^8.2.1",
"chai": "^4.3.7",
"eslint": "^8.28.0",
"eslint-config-screwdriver": "^7.0.0",
"mocha": "^10.1.0",
"mocha-multi-reporters": "^1.5.1",
"mocha-sonarqube-reporter": "^1.0.2",
"mockery": "^2.0.0",
"nyc": "^15.0.0",
"sinon": "^4.5.0"
"mockery": "^2.1.0",
"nyc": "^15.1.0",
"sinon": "^15.0.0"
},
"dependencies": {
"screwdriver-data-schema": "^21.0.0",
"screwdriver-executor-base": "^8.0.0",
"screwdriver-logger": "^1.0.0",
"screwdriver-request": "^1.0.3",
"screwdriver-data-schema": "^22.0.1",
"screwdriver-executor-base": "^9.0.0",
"screwdriver-logger": "^2.0.0",
"screwdriver-request": "^2.0.1",
"string-hash": "^1.1.3"
},
"release": {
Expand Down
2 changes: 1 addition & 1 deletion screwdriver.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared:
image: node:12
image: node:18

jobs:
main:
Expand Down
44 changes: 30 additions & 14 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,24 @@ describe('index test', () => {
});

describe('_stopTimer', done => {
let clock;
let dateNow;

beforeEach(() => {
dateNow = Date.now();
clock = sinon.useFakeTimers({
now: dateNow,
shouldAdvanceTime: true
});
});

afterEach(() => {
clock.restore();
});

it('Calls api to stop timer', () => {
mockRequest.resolves({ statusCode: 200 });
const dateNow = Date.now();
const isoTime = new Date(dateNow).toISOString();
const sandbox = sinon.sandbox.create({
useFakeTimers: false
});

const timerConfig = {
buildId: testConfig.buildId,
jobId: testConfig.jobId,
Expand All @@ -282,7 +292,6 @@ describe('index test', () => {
token: testConfig.token
};

sandbox.useFakeTimers(dateNow);
Object.assign(requestOptions, {
url: 'http://localhost/v1/queue/message?type=timer',
method: 'DELETE',
Expand All @@ -293,20 +302,29 @@ describe('index test', () => {
assert.calledWithArgs(mockRequest, timerConfig, requestOptions);
assert.isNull(err);
done();
sandbox.restore();
});
});
});

describe('_startTimer', done => {
let clock;
let dateNow;

beforeEach(() => {
dateNow = Date.now();
clock = sinon.useFakeTimers({
now: dateNow,
shouldAdvanceTime: true
});
});

afterEach(() => {
clock.restore();
});

it('Calls api to start timer', () => {
mockRequest.resolves({ statusCode: 200 });
const dateNow = Date.now();
const isoTime = new Date(dateNow).toISOString();
const sandbox = sinon.sandbox.create({
useFakeTimers: false
});

const timerConfig = {
buildId: testConfig.buildId,
jobId: testConfig.jobId,
Expand All @@ -317,7 +335,6 @@ describe('index test', () => {
token: testConfig.token
};

sandbox.useFakeTimers(dateNow);
Object.assign(requestOptions, {
url: 'http://localhost/v1/queue/message?type=timer',
method: 'POST',
Expand All @@ -328,7 +345,6 @@ describe('index test', () => {
assert.calledWithArgs(mockRequest, timerConfig, requestOptions);
assert.isNull(err);
done();
sandbox.restore();
});
});
});
Expand Down

0 comments on commit 3ad0673

Please sign in to comment.