From b3c2c9f16a91642865a717ec5a40c7ce9e24160f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:34:53 +0000 Subject: [PATCH 1/2] chore(deps): update dependency jest-date-mock to v1.0.9 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 836e2e31a3..c332ad1f3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31917,9 +31917,9 @@ __metadata: linkType: hard "jest-date-mock@npm:^1.0.8": - version: 1.0.8 - resolution: "jest-date-mock@npm:1.0.8" - checksum: 7b012870440b0df742d0b651435b91625dbbf02d916633a0c70c7deb5d5087f9aadc59847602312368826325909e70e95cd412896a0c9ee1d5ac382000bf5ef9 + version: 1.0.9 + resolution: "jest-date-mock@npm:1.0.9" + checksum: 4f8c4914348c59c4b3951577276dfea6f714fa24d032a774225f41288da1a191cfe14f95e1ba59dcc0db8cf1c9f7d3a1581b18ade6fc7b63118b04166a127c0a languageName: node linkType: hard From 56ce1b0a81182ce46c864a645c74c1be15d0e149 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 13 Apr 2024 16:51:30 +0200 Subject: [PATCH 2/2] scaffolder-backend-module-gitlap: remove use of jest-date-mock Signed-off-by: Patrik Oldsberg --- plugins/scaffolder-backend-module-gitlab/package.json | 3 +-- .../src/actions/createGitlabIssueAction.test.ts | 7 ++++--- yarn.lock | 8 -------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/plugins/scaffolder-backend-module-gitlab/package.json b/plugins/scaffolder-backend-module-gitlab/package.json index ff23e39a9e..38f94193ea 100644 --- a/plugins/scaffolder-backend-module-gitlab/package.json +++ b/plugins/scaffolder-backend-module-gitlab/package.json @@ -60,7 +60,6 @@ "@backstage/backend-test-utils": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/core-app-api": "workspace:^", - "@backstage/plugin-scaffolder-node-test-utils": "workspace:^", - "jest-date-mock": "^1.0.8" + "@backstage/plugin-scaffolder-node-test-utils": "workspace:^" } } diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/createGitlabIssueAction.test.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/createGitlabIssueAction.test.ts index 7298a502b6..feea436a1e 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/createGitlabIssueAction.test.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/createGitlabIssueAction.test.ts @@ -18,7 +18,6 @@ import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test- import { createGitlabIssueAction, IssueType } from './createGitlabIssueAction'; import { ConfigReader } from '@backstage/core-app-api'; import { ScmIntegrations } from '@backstage/integration'; -import { advanceTo, clear } from 'jest-date-mock'; const mockGitlabClient = { Issues: { @@ -36,11 +35,13 @@ jest.mock('@gitbeaker/rest', () => ({ describe('gitlab:issues:create', () => { beforeEach(() => { jest.clearAllMocks(); - advanceTo(new Date(1988, 5, 3, 12, 0, 0)); // Set the desired date and time + jest.useFakeTimers({ + now: new Date(1988, 5, 3, 12, 0, 0), + }); }); afterEach(() => { - clear(); // Reset the date mock after each test + jest.useRealTimers(); }); const config = new ConfigReader({ diff --git a/yarn.lock b/yarn.lock index c332ad1f3e..b03d2d78ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8661,7 +8661,6 @@ __metadata: "@gitbeaker/core": ^35.8.0 "@gitbeaker/node": ^35.8.0 "@gitbeaker/rest": ^39.25.0 - jest-date-mock: ^1.0.8 luxon: ^3.0.0 yaml: ^2.0.0 zod: ^3.22.4 @@ -31916,13 +31915,6 @@ __metadata: languageName: node linkType: hard -"jest-date-mock@npm:^1.0.8": - version: 1.0.9 - resolution: "jest-date-mock@npm:1.0.9" - checksum: 4f8c4914348c59c4b3951577276dfea6f714fa24d032a774225f41288da1a191cfe14f95e1ba59dcc0db8cf1c9f7d3a1581b18ade6fc7b63118b04166a127c0a - languageName: node - linkType: hard - "jest-diff@npm:^29.2.0, jest-diff@npm:^29.7.0": version: 29.7.0 resolution: "jest-diff@npm:29.7.0"