Skip to content

Commit b1f5ae1

Browse files
committed
Upgrade pixelmatch to v7 and refactor imports
Upgrade pixelmatch to v7 and refactor imports Upgraded the 'pixelmatch' dependency to version 7.1.0 and removed '@types/pixelmatch' as types are now included. Refactored PixelmatchService to use dynamic import for pixelmatch, updated related tests to mock the new import pattern, and adjusted Jest configs to handle ESM modules. Also updated TypeScript configs to use 'NodeNext' module resolution and added 'isolatedModules'. Minor import type-only refactors were made for improved type safety.
1 parent a5da984 commit b1f5ae1

23 files changed

+113
-91
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM node:20-bookworm-slim AS builder
22
# Create app directory
33
WORKDIR /app
44

5-
COPY ./prisma/schema.prisma ./
5+
COPY ./prisma ./prisma
66

77
# A wildcard is used to ensure both package.json AND package-lock.json are copied
88
COPY package*.json ./

jest.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
module.exports = async () => {
33
return {
44
projects: [
5-
'./src/jest.config.ts',
6-
'./test/jest.config.ts',
7-
'./test_acceptance/jest.config.ts'
5+
'./src/jest.config.ts',
6+
'./test/jest.config.ts',
7+
'./test_acceptance/jest.config.ts',
8+
'./test_ldap/jest.config.ts'
89
],
910
roots: ['./'],
1011
testTimeout: 30000,

package-lock.json

Lines changed: 6 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"passport-local": "^1.0.0",
5858
"pg": "^8.16.3",
5959
"pg-hstore": "^2.3.4",
60-
"pixelmatch": "^5.3.0",
60+
"pixelmatch": "^7.1.0",
6161
"pngjs": "^7.0.0",
6262
"reflect-metadata": "^0.1.13",
6363
"rimraf": "^5.0.1",
@@ -79,7 +79,6 @@
7979
"@types/node": "^20.14.10",
8080
"@types/passport-jwt": "^3.0.9",
8181
"@types/passport-local": "^1.0.38",
82-
"@types/pixelmatch": "^5.2.6",
8382
"@types/pngjs": "^6.0.5",
8483
"@types/supertest": "^2.0.12",
8584
"@typescript-eslint/eslint-plugin": "^8.46.3",

prisma/Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ FROM node:20-bookworm-slim
22
ENV DEBIAN_FRONTEND=noninteractive
33
RUN apt update && apt install -y libssl3 && rm -rf /var/lib/apt/lists/*
44

5-
WORKDIR /app
5+
WORKDIR /workspace
66

7-
COPY . .
7+
COPY . ./prisma
88

9-
ENV NODE_TLS_REJECT_UNAUTHORIZED='0'
10-
RUN npm ci --verbose
9+
WORKDIR /workspace/prisma
1110

12-
RUN chmod +x /app/wait-for-it.sh
13-
RUN chmod +x /app/entrypoint.sh
11+
ENV NODE_TLS_REJECT_UNAUTHORIZED='0'
12+
RUN npm ci --verbose && \
13+
chmod +x /workspace/prisma/wait-for-it.sh && \
14+
chmod +x /workspace/prisma/entrypoint.sh
1415

15-
ENTRYPOINT ["/app/entrypoint.sh"]
16+
ENTRYPOINT ["/workspace/prisma/entrypoint.sh"]
1617

1718
CMD ["sh"]

prisma/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
set -e
33

4-
/app/wait-for-it.sh postgres:5432 -- echo Postgress is up!
4+
./wait-for-it.sh postgres:5432 -- echo Postgress is up!
55

66
echo Start applying migrations...
77

@@ -11,4 +11,4 @@ npx prisma migrate deploy
1111
echo Seeding data...
1212

1313
# seed data
14-
npx ts-node seed.ts
14+
npx ts-node seed.ts

prisma/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"private": true,
77
"license": "Apache-2.0",
88
"scripts": {
9+
"postinstall": "prisma generate",
910
"test": "jest"
1011
},
1112
"dependencies": {
@@ -22,4 +23,4 @@
2223
"ts-node": "^10.9.2",
2324
"typescript": "^5.9.3"
2425
}
25-
}
26+
}

prisma/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"incremental": true,
1212
"skipLibCheck": true,
1313
"esModuleInterop": true,
14+
"isolatedModules": true,
1415
// See: https://github.com/prisma/prisma/issues/10203
1516
"strictNullChecks": true
1617
},

src/builds/builds.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Build, Role } from '@prisma/client';
2323
import { BuildDto } from './dto/build.dto';
2424
import { MixedGuard } from '../auth/guards/mixed.guard';
2525
import { PaginatedBuildDto } from './dto/build-paginated.dto';
26-
import { ModifyBuildDto } from './dto/build-modify.dto';
26+
import type { ModifyBuildDto } from './dto/build-modify.dto';
2727
import { ProjectsService } from '../projects/projects.service';
2828
import { RoleGuard } from '../auth/guards/role.guard';
2929
import { Roles } from '../shared/roles.decorator';

src/builds/builds.service.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { BuildsService } from './builds.service';
33
import { PrismaService } from '../prisma/prisma.service';
44
import { TestRunsService } from '../test-runs/test-runs.service';
55
import { EventsGateway } from '../shared/events/events.gateway';
6-
import { Build, TestRun, TestStatus } from '@prisma/client';
6+
import { Build, Prisma, TestRun, TestStatus } from '@prisma/client';
77
import { mocked, MockedObject } from 'jest-mock';
88
import { BuildDto } from './dto/build.dto';
99
import { ProjectsService } from '../projects/projects.service';
1010
import { generateTestRun } from '../_data_';
11-
import { PrismaClientKnownRequestError } from '@prisma/client/runtime/library';
1211

1312
jest.mock('./dto/build.dto');
1413

@@ -387,7 +386,9 @@ describe('BuildsService', () => {
387386
it('create with retry', async () => {
388387
const buildUpsertMock = jest
389388
.fn()
390-
.mockRejectedValueOnce(new PrismaClientKnownRequestError('mock error', { code: 'P2002', clientVersion: '5' }));
389+
.mockRejectedValueOnce(
390+
new Prisma.PrismaClientKnownRequestError('mock error', { code: 'P2002', clientVersion: '5' })
391+
);
391392
const buildUpdateMock = jest.fn().mockResolvedValueOnce(build);
392393
service = await initService({ buildUpsertMock, buildUpdateMock });
393394
service.incrementBuildNumber = jest.fn().mockResolvedValueOnce(build);

0 commit comments

Comments
 (0)