Skip to content
Open
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
2,318 changes: 1,162 additions & 1,156 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-html-parser": "^2.0.2",
"react-router-dom": "6.30.3",
"react-router-dom": "^6.30.4",
"simple-git": "^3.30.0",
"uuid": "^13.0.0",
"validator": "^13.15.26",
Expand Down Expand Up @@ -177,7 +177,7 @@
"@types/validator": "^13.15.10",
"@types/yargs": "^17.0.35",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/coverage-v8": "^4.1.8",
"c8": "^11.0.0",
"cross-env": "^10.1.0",
"cypress": "^15.9.0",
Expand All @@ -190,7 +190,7 @@
"globals": "^16.5.0",
"husky": "^9.1.7",
"lint-staged": "^17.0.5",
"nyc": "^17.1.0",
"nyc": "^18.0.0",
"prettier": "^3.8.1",
"quicktype": "^23.2.6",
"supertest": "^7.2.2",
Expand All @@ -200,7 +200,7 @@
"typescript-eslint": "^8.54.0",
"vite": "^7.3.1",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4"
"vitest": "^4.1.8"
},
"optionalDependencies": {
"@esbuild/darwin-arm64": "^0.27.2",
Expand Down
1 change: 1 addition & 0 deletions src/proxy/processors/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type AttestationBase = {
reviewer: {
username: string;
email: string;
gitAccount?: string; // Legacy field for GitHub usernames
};
timestamp: string | Date;
automated?: boolean;
Expand Down
5 changes: 4 additions & 1 deletion test/1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import { describe, it, beforeAll, afterAll, beforeEach, afterEach, expect, vi } from 'vitest';
import request from 'supertest';
import { Service } from '../src/service';
import * as config from '../src/config';
import * as db from '../src/db';
import { Proxy } from '../src/proxy';
import { Express } from 'express';
Expand All @@ -45,6 +46,8 @@ describe('init', () => {
// Runs before all tests
beforeAll(async function () {
// Starts the service and returns the express app
// Auto-assign free port (prevents EADDRINUSE errors when running tests in parallel)
vi.spyOn(config, 'getUIPort').mockReturnValue(0);
const proxy = new Proxy();
app = await Service.start(proxy);
});
Expand All @@ -69,7 +72,7 @@ describe('init', () => {
// Runs after all tests
afterAll(function () {
// Must close the server to avoid EADDRINUSE errors when running tests in parallel
Service.httpServer.close();
Service.httpServer?.close();
});

// Example test: check server is running
Expand Down
60 changes: 26 additions & 34 deletions test/ConfigLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ describe('ConfigLoader', () => {

it(
'should throw error if repository is a valid URL but not a git repository',
{ timeout: 30000 },
async () => {
const source: ConfigurationSource = {
type: 'git',
Expand All @@ -579,11 +580,11 @@ describe('ConfigLoader', () => {
/Failed to clone repository/,
);
},
{ timeout: 30000 },
);

it(
'should throw error if repository is a valid git repo but the branch does not exist',
{ timeout: 30000 },
async () => {
const source: ConfigurationSource = {
type: 'git',
Expand All @@ -597,44 +598,35 @@ describe('ConfigLoader', () => {
/Failed to checkout branch/,
);
},
{ timeout: 30000 },
);

it(
'should throw error if config path was not found',
async () => {
const source: ConfigurationSource = {
type: 'git',
repository: 'https://github.com/finos/git-proxy.git',
path: 'path-not-found.json',
branch: 'main',
enabled: true,
};
it('should throw error if config path was not found', { timeout: 30000 }, async () => {
const source: ConfigurationSource = {
type: 'git',
repository: 'https://github.com/finos/git-proxy.git',
path: 'path-not-found.json',
branch: 'main',
enabled: true,
};

await expect(configLoader.loadFromSource(source)).rejects.toThrow(
/Configuration file not found at/,
);
},
{ timeout: 30000 },
);
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
/Configuration file not found at/,
);
});

it(
'should throw error if config file is not valid JSON',
async () => {
const source: ConfigurationSource = {
type: 'git',
repository: 'https://github.com/finos/git-proxy.git',
path: 'test/fixtures/baz.js',
branch: 'main',
enabled: true,
};
it('should throw error if config file is not valid JSON', { timeout: 30000 }, async () => {
const source: ConfigurationSource = {
type: 'git',
repository: 'https://github.com/finos/git-proxy.git',
path: 'test/fixtures/baz.js',
branch: 'main',
enabled: true,
};

await expect(configLoader.loadFromSource(source)).rejects.toThrow(
/Invalid configuration format in git/,
);
},
{ timeout: 30000 },
);
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
/Invalid configuration format in git/,
);
});
});

describe('deepMerge', () => {
Expand Down
4 changes: 3 additions & 1 deletion test/db/mongo/helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ vi.mock('mongodb', async () => {
const actual = await vi.importActual('mongodb');
return {
...actual,
MongoClient: vi.fn(() => mockClient),
MongoClient: vi.fn(function () {
return mockClient;
}),
};
});

Expand Down
Loading
Loading