From eb8e30d631eb71c9cfffe2da4aa50866d964399d Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 17:09:00 +0000 Subject: [PATCH 01/62] test comment --- .c8rc.json | 5 + .github/workflows/test.yaml | 43 ++++- .gitignore | 2 + package-lock.json | 313 ++++++++++++++++++++++++++++++++++++ package.json | 6 +- 5 files changed, 360 insertions(+), 9 deletions(-) create mode 100644 .c8rc.json diff --git a/.c8rc.json b/.c8rc.json new file mode 100644 index 00000000..1a6ecfbf --- /dev/null +++ b/.c8rc.json @@ -0,0 +1,5 @@ +{ + "include": ["src/**/*.ts"], + "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], + "reporter": ["lcov"] +} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e54cf172..8709565c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,7 +2,7 @@ name: Lint and Test on: push: - branches-ignore: ['main'] + branches-ignore: ["main"] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,8 +17,8 @@ jobs: tests-npm: uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@main with: - docker_compose_file: '' - npm_build_command: 'npm run build' + docker_compose_file: "" + npm_build_command: "npm run build" tests: '["test:unit", "test:integration", "test:ratelimit"]' env_vars: | { @@ -26,14 +26,44 @@ jobs: "PUPPETEER_ARGS": "--no-sandbox,--disable-setuid-sandbox" } + coverage: + runs-on: ubuntu-latest + needs: tests-npm + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - run: npm ci + - run: npm run build + - name: Run tests with coverage + run: | + npm run test:unit + npm run test:ratelimit + + - name: Install LCOV + run: sudo apt-get install -y lcov + + - name: Report code coverage + uses: zgosalvez/github-actions-report-lcov@v5 + with: + coverage-files: coverage/lcov.info + github-token: ${{ secrets.GITHUB_TOKEN }} + update-comment: true + e2e-tests-npm: uses: digicatapult/shared-workflows/.github/workflows/tests-e2e-npm.yml@main concurrency: group: e2e-tests-npm with: - docker_compose_file: '' - pre_test_command: 'npm ci && npx playwright install-deps && npx playwright install' - test_command: 'npm run test:playwright || exit 1' + docker_compose_file: "" + pre_test_command: "npm ci && npx playwright install-deps && npx playwright install" + test_command: "npm run test:playwright || exit 1" env_vars: | { "PUPPETEER_ARGS": "--no-sandbox,--disable-setuid-sandbox" @@ -47,4 +77,3 @@ jobs: permissions: packages: write contents: write - diff --git a/.gitignore b/.gitignore index 0b52e7cc..120a83a0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ obj /playwright/.cache/ .env playwright/.auth + +coverage/ diff --git a/package-lock.json b/package-lock.json index 25060be5..ff6676b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,6 +74,7 @@ "@types/unzipper": "^0.10.11", "@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/parser": "^8.46.2", + "c8": "^10.1.3", "chai-as-promised": "^8.0.2", "depcheck": "^1.4.7", "eslint": "^9.38.0", @@ -295,6 +296,16 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/@bcoe/v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@borewit/text-codec": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.1.1.tgz", @@ -1490,6 +1501,16 @@ "node": ">=12" } }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -4145,6 +4166,13 @@ "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", "license": "MIT" }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/jsdom": { "version": "27.0.0", "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-27.0.0.tgz", @@ -5806,6 +5834,153 @@ "node": ">= 0.8" } }, + "node_modules/c8": { + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.3.tgz", + "integrity": "sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bcoe/v8-coverage": "^1.0.1", + "@istanbuljs/schema": "^0.1.3", + "find-up": "^5.0.0", + "foreground-child": "^3.1.1", + "istanbul-lib-coverage": "^3.2.0", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", + "test-exclude": "^7.0.1", + "v8-to-istanbul": "^9.0.0", + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "monocart-coverage-reports": "^2" + }, + "peerDependenciesMeta": { + "monocart-coverage-reports": { + "optional": true + } + } + }, + "node_modules/c8/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/c8/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/c8/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/c8/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/c8/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/c8/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/c8/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/c8/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -6339,6 +6514,13 @@ "node": ">= 0.6" } }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, "node_modules/cookie": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", @@ -9294,6 +9476,13 @@ "node": ">=18" } }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, "node_modules/html-to-image": { "version": "1.11.13", "resolved": "https://registry.npmjs.org/html-to-image/-/html-to-image-1.11.13.tgz", @@ -9724,6 +9913,58 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "license": "ISC" }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jackspeak": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", @@ -10329,6 +10570,22 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", @@ -13713,6 +13970,47 @@ "node": ">=8.0.0" } }, + "node_modules/test-exclude": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^9.0.4" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/testcontainers": { "version": "11.7.2", "resolved": "https://registry.npmjs.org/testcontainers/-/testcontainers-11.7.2.tgz", @@ -14228,6 +14526,21 @@ "uuid": "dist/esm/bin/uuid" } }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, "node_modules/validator": { "version": "13.15.15", "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.15.tgz", diff --git a/package.json b/package.json index ad2d18f9..6a043063 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,12 @@ "type": "module", "scripts": { "depcheck": "depcheck", - "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", + "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 --clean=false ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", - "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", + "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 --clean=false ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", + "coverage:report": "c8 report", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", "clean": "rimraf -rf ./build", "dev": "npm run tsoa:build && NODE_ENV=dev node --import '@swc-node/register/esm-register' ./src/index.ts", @@ -101,6 +102,7 @@ "@types/unzipper": "^0.10.11", "@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/parser": "^8.46.2", + "c8": "^10.1.3", "chai-as-promised": "^8.0.2", "depcheck": "^1.4.7", "eslint": "^9.38.0", From 526180cb0ba79749cb648f0dc4f2e75dfa14c6b8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 17:22:44 +0000 Subject: [PATCH 02/62] env --- .github/workflows/test.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8709565c..38193f0b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,7 +28,6 @@ jobs: coverage: runs-on: ubuntu-latest - needs: tests-npm permissions: contents: read pull-requests: write @@ -45,12 +44,14 @@ jobs: run: | npm run test:unit npm run test:ratelimit + env: + PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" - name: Install LCOV run: sudo apt-get install -y lcov - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@v5 + uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 with: coverage-files: coverage/lcov.info github-token: ${{ secrets.GITHUB_TOKEN }} From 702402d747b8ae0abe05a849f50b67577ab021bd Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 17:34:46 +0000 Subject: [PATCH 03/62] pr sync --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 38193f0b..2d3ff60d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,6 +3,9 @@ name: Lint and Test on: push: branches-ignore: ["main"] + pull_request: + types: + - synchronize concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -47,9 +50,6 @@ jobs: env: PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" - - name: Install LCOV - run: sudo apt-get install -y lcov - - name: Report code coverage uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 with: From 76a70a797bad7c97efcf8e1e629594f48cece6b1 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 17:40:04 +0000 Subject: [PATCH 04/62] seperate --- .github/workflows/coverage.yml | 45 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 31 ----------------------- 2 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..967bcdd4 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,45 @@ +name: Coverage Report + +on: + pull_request: + types: [synchronize] + +permissions: + contents: read + pull-requests: write + +jobs: + coverage: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - run: npm ci + + - run: npm run build + + - name: Run tests with coverage + run: | + npm run test:unit + npm run test:ratelimit + env: + PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" + + - name: Install LCOV + run: sudo apt-get install -y lcov + + - name: Report code coverage + uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 + with: + coverage-files: coverage/lcov.info + github-token: ${{ secrets.GITHUB_TOKEN }} + update-comment: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2d3ff60d..5fa7575a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,9 +3,6 @@ name: Lint and Test on: push: branches-ignore: ["main"] - pull_request: - types: - - synchronize concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -29,34 +26,6 @@ jobs: "PUPPETEER_ARGS": "--no-sandbox,--disable-setuid-sandbox" } - coverage: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - run: npm ci - - run: npm run build - - name: Run tests with coverage - run: | - npm run test:unit - npm run test:ratelimit - env: - PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" - - - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 - with: - coverage-files: coverage/lcov.info - github-token: ${{ secrets.GITHUB_TOKEN }} - update-comment: true - e2e-tests-npm: uses: digicatapult/shared-workflows/.github/workflows/tests-e2e-npm.yml@main concurrency: From 9f2229a74cf08b5c624fe0493433880cb3df4ec9 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 17:56:23 +0000 Subject: [PATCH 05/62] improve coverage --- src/lib/server/utils/__tests__/githubRequest.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/server/utils/__tests__/githubRequest.test.ts b/src/lib/server/utils/__tests__/githubRequest.test.ts index 97312398..6682ce0f 100644 --- a/src/lib/server/utils/__tests__/githubRequest.test.ts +++ b/src/lib/server/utils/__tests__/githubRequest.test.ts @@ -11,6 +11,13 @@ import { GithubRequest } from '../githubRequest.js' const env = container.resolve(Env) describe('githubRequest', function () { + test('getRepos', async function () { + const githubRequest = new GithubRequest(mockLogger) + Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) + const repos = await githubRequest.getRepos('token', 1) + expect(repos).to.equal('repos') + }) + test('getZip errors with upload limit', async function () { const githubRequest = new GithubRequest(mockLogger) Sinon.stub(githubRequest, 'requestWrapper').resolves({ From 48b009b723890c188ab225da4634d0a1a178c286 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 18:20:26 +0000 Subject: [PATCH 06/62] add json summary and files changes --- .c8rc.json | 2 +- src/lib/server/utils/githubRequest.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.c8rc.json b/.c8rc.json index 1a6ecfbf..4daf6357 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,5 @@ { "include": ["src/**/*.ts"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["lcov"] + "reporter": ["lcovm", "json-summary"] } diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 703f3106..6c2f407c 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -23,6 +23,19 @@ export const authRedirectURL = (returnUrl: string): string => { export class GithubRequest { constructor(@inject(Logger) private logger: ILogger) {} + getBla = async (token: string | undefined, page: number) => { + if (!token) throw new GithubReqError('Missing GitHub token') + + const octokit = new Octokit({ auth: token }) + const response = await this.requestWrapper(async () => + octokit.request('GET /user/repos', { + per_page: perPage, + page, + }) + ) + return response.data + } + getRepos = async (token: string | undefined, page: number) => { if (!token) throw new GithubReqError('Missing GitHub token') From 3049ea5ed2f21e3e8ed9d7df16d60de8669cf822 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 18:25:14 +0000 Subject: [PATCH 07/62] reporters --- .c8rc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.c8rc.json b/.c8rc.json index 4daf6357..15bdf20a 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,5 @@ { "include": ["src/**/*.ts"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["lcovm", "json-summary"] + "reporter": ["lcov", "json-summary", "text-summary"] } From 5ed29739dc32f978d1c5da93f13fadaef713cba8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 30 Oct 2025 18:51:38 +0000 Subject: [PATCH 08/62] branch cov --- .github/workflows/coverage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 967bcdd4..cc991167 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -37,6 +37,9 @@ jobs: - name: Install LCOV run: sudo apt-get install -y lcov + - name: Set lcovrc for branch coverage + run: echo 'branch_coverage=1' > ~/.lcovrc + - name: Report code coverage uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 with: From 956ea2438b5fe193422929328594adefa0f2ce00 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 31 Oct 2025 17:38:33 +0000 Subject: [PATCH 09/62] test --- .c8rc.json | 2 +- .github/workflows/coverage.yml | 99 +++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 15bdf20a..54547a26 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,5 @@ { "include": ["src/**/*.ts"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["lcov", "json-summary", "text-summary"] + "reporter": ["json"] } diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index cc991167..c3014b1f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,48 +1,63 @@ -name: Coverage Report +name: Coverage Test on: - pull_request: - types: [synchronize] + push: + branches-ignore: ["main"] permissions: - contents: read - pull-requests: write + contents: read jobs: - coverage: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - run: npm ci - - - run: npm run build - - - name: Run tests with coverage - run: | - npm run test:unit - npm run test:ratelimit - env: - PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" - - - name: Install LCOV - run: sudo apt-get install -y lcov - - - name: Set lcovrc for branch coverage - run: echo 'branch_coverage=1' > ~/.lcovrc - - - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@b9c423417947b8f4156df37174e5a8be99a02747 - with: - coverage-files: coverage/lcov.info - github-token: ${{ secrets.GITHUB_TOKEN }} - update-comment: true + test: + runs-on: ubuntu-latest + strategy: + matrix: + test-type: [unit, ratelimit] + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - run: npm ci + + - run: npm run build + + - name: Run ${{ matrix.test-type }} tests with coverage + run: | + npm run test:${{ matrix.test-type }} + env: + PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" + + - name: Upload coverage JSON summary + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.test-type }} + path: coverage/coverage-final.json + + coverage-report: + runs-on: ubuntu-latest + needs: test + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Download all coverage summaries + uses: actions/download-artifact@v4 + with: + path: coverage + + - name: Generate merged coverage + run: npx c8 report --reporter=text >> $GITHUB_STEP_SUMMARY From a28bcaa6f07ce7f19835924f9668b3b3e8aa3240 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 31 Oct 2025 17:44:04 +0000 Subject: [PATCH 10/62] test --- .github/workflows/coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index c3014b1f..b8d91767 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -38,7 +38,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: coverage-${{ matrix.test-type }} - path: coverage/coverage-final.json + path: coverage/tmp coverage-report: runs-on: ubuntu-latest @@ -57,7 +57,7 @@ jobs: - name: Download all coverage summaries uses: actions/download-artifact@v4 with: - path: coverage + path: coverage/tmp - name: Generate merged coverage run: npx c8 report --reporter=text >> $GITHUB_STEP_SUMMARY From cb49a8e315a09a0f4aca56027cd7b68cd64ab36b Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 31 Oct 2025 18:16:27 +0000 Subject: [PATCH 11/62] test --- .c8rc.json | 3 +-- .github/workflows/coverage.yml | 3 ++- package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 54547a26..6311ee6d 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,4 @@ { "include": ["src/**/*.ts"], - "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["json"] + "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"] } diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b8d91767..90a96e03 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -58,6 +58,7 @@ jobs: uses: actions/download-artifact@v4 with: path: coverage/tmp + merge-multiple: true - - name: Generate merged coverage + - name: Generate report run: npx c8 report --reporter=text >> $GITHUB_STEP_SUMMARY diff --git a/package.json b/package.json index 6a043063..ccac2978 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "type": "module", "scripts": { "depcheck": "depcheck", - "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 --clean=false ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", + "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", - "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 --clean=false ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", + "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", "coverage:report": "c8 report", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", "clean": "rimraf -rf ./build", From 75dc98f6ad211b045f870e0cf5094b110a290cce Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 31 Oct 2025 18:29:25 +0000 Subject: [PATCH 12/62] should pass --- .c8rc.json | 4 +++- .github/workflows/coverage.yml | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 6311ee6d..1e315fec 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,4 +1,6 @@ { "include": ["src/**/*.ts"], - "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"] + "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], + "reporter": ["text", "html"], + "lines": 90 } diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 90a96e03..032c4404 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -60,5 +60,17 @@ jobs: path: coverage/tmp merge-multiple: true - - name: Generate report + - name: Generate text report run: npx c8 report --reporter=text >> $GITHUB_STEP_SUMMARY + + - name: Generate html report + run: npx c8 report --reporter=html + + - name: Upload html report + uses: actions/upload-artifact@v4 + with: + name: coverage + path: coverage + + - name: Fail if under thresholds + run: npx c8 check-coverage From f4a28e52f486fd6f7183c03c6db307e5d18f469c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 31 Oct 2025 18:32:00 +0000 Subject: [PATCH 13/62] should fail --- .c8rc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.c8rc.json b/.c8rc.json index 1e315fec..e7d208bd 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -2,5 +2,5 @@ "include": ["src/**/*.ts"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], "reporter": ["text", "html"], - "lines": 90 + "lines": 99 } From 8668185be6f1a5dd9002a4752e0ab89b490d43a1 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 09:28:22 +0000 Subject: [PATCH 14/62] use shared workflow --- .github/workflows/coverage.yml | 76 ---------------------------------- .github/workflows/test.yaml | 3 +- 2 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 032c4404..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Coverage Test - -on: - push: - branches-ignore: ["main"] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - test-type: [unit, ratelimit] - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - run: npm ci - - - run: npm run build - - - name: Run ${{ matrix.test-type }} tests with coverage - run: | - npm run test:${{ matrix.test-type }} - env: - PUPPETEER_ARGS: "--no-sandbox,--disable-setuid-sandbox" - - - name: Upload coverage JSON summary - uses: actions/upload-artifact@v4 - with: - name: coverage-${{ matrix.test-type }} - path: coverage/tmp - - coverage-report: - runs-on: ubuntu-latest - needs: test - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - name: Download all coverage summaries - uses: actions/download-artifact@v4 - with: - path: coverage/tmp - merge-multiple: true - - - name: Generate text report - run: npx c8 report --reporter=text >> $GITHUB_STEP_SUMMARY - - - name: Generate html report - run: npx c8 report --reporter=html - - - name: Upload html report - uses: actions/upload-artifact@v4 - with: - name: coverage - path: coverage - - - name: Fail if under thresholds - run: npx c8 check-coverage diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5fa7575a..bc9d410b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,11 +15,12 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@main + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@feat/coverage with: docker_compose_file: "" npm_build_command: "npm run build" tests: '["test:unit", "test:integration", "test:ratelimit"]' + coverage: true env_vars: | { "TMPDIR": "${{ github.workspace }}", From 08ec420f4992f50fdf302fe2c6fa45e7b2e75356 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 10:44:14 +0000 Subject: [PATCH 15/62] test From 5a9135342d5ee2b12b5036f5535a8b94171bb58c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 11:23:32 +0000 Subject: [PATCH 16/62] remove pass rate --- .c8rc.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index e7d208bd..24c67603 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,6 +1,5 @@ { "include": ["src/**/*.ts"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["text", "html"], - "lines": 99 + "reporter": ["text", "html"] } From a9c982f56c30400fc751052dc9fbe5889ec3d01e Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 11:41:21 +0000 Subject: [PATCH 17/62] add c8 to int test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ccac2978..3e5fda4f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", - "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", + "test:integration": "NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", "coverage:report": "c8 report", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", From e51f6cfb124623e7e9fa94b43b2d87bc07011563 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 11:42:01 +0000 Subject: [PATCH 18/62] v bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58773ad9..96c04f8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.4", + "version": "0.6.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dtdl-visualisation-tool", - "version": "0.6.4", + "version": "0.6.5", "license": "Apache-2.0", "dependencies": { "@digicatapult/dtdl-parser": "^1.0.57", diff --git a/package.json b/package.json index a18c80ed..5c2bb447 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.4", + "version": "0.6.5", "description": "CLI tool for dtdl visualisation", "main": "build/index.js", "bin": { From 5b280443eccd15bd2648d6d0dc53a285ed3c9f5f Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 11:48:23 +0000 Subject: [PATCH 19/62] revert changes --- .github/workflows/test.yaml | 12 ++++++------ .../server/utils/__tests__/githubRequest.test.ts | 7 ------- src/lib/server/utils/githubRequest.ts | 13 ------------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bc9d410b..805879e0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,7 +2,7 @@ name: Lint and Test on: push: - branches-ignore: ["main"] + branches-ignore: ['main'] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,8 +17,8 @@ jobs: tests-npm: uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@feat/coverage with: - docker_compose_file: "" - npm_build_command: "npm run build" + docker_compose_file: '' + npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' coverage: true env_vars: | @@ -32,9 +32,9 @@ jobs: concurrency: group: e2e-tests-npm with: - docker_compose_file: "" - pre_test_command: "npm ci && npx playwright install-deps && npx playwright install" - test_command: "npm run test:playwright || exit 1" + docker_compose_file: '' + pre_test_command: 'npm ci && npx playwright install-deps && npx playwright install' + test_command: 'npm run test:playwright || exit 1' env_vars: | { "PUPPETEER_ARGS": "--no-sandbox,--disable-setuid-sandbox" diff --git a/src/lib/server/utils/__tests__/githubRequest.test.ts b/src/lib/server/utils/__tests__/githubRequest.test.ts index 6682ce0f..97312398 100644 --- a/src/lib/server/utils/__tests__/githubRequest.test.ts +++ b/src/lib/server/utils/__tests__/githubRequest.test.ts @@ -11,13 +11,6 @@ import { GithubRequest } from '../githubRequest.js' const env = container.resolve(Env) describe('githubRequest', function () { - test('getRepos', async function () { - const githubRequest = new GithubRequest(mockLogger) - Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) - const repos = await githubRequest.getRepos('token', 1) - expect(repos).to.equal('repos') - }) - test('getZip errors with upload limit', async function () { const githubRequest = new GithubRequest(mockLogger) Sinon.stub(githubRequest, 'requestWrapper').resolves({ diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 6c2f407c..703f3106 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -23,19 +23,6 @@ export const authRedirectURL = (returnUrl: string): string => { export class GithubRequest { constructor(@inject(Logger) private logger: ILogger) {} - getBla = async (token: string | undefined, page: number) => { - if (!token) throw new GithubReqError('Missing GitHub token') - - const octokit = new Octokit({ auth: token }) - const response = await this.requestWrapper(async () => - octokit.request('GET /user/repos', { - per_page: perPage, - page, - }) - ) - return response.data - } - getRepos = async (token: string | undefined, page: number) => { if (!token) throw new GithubReqError('Missing GitHub token') From a740220f4c38b0eb8f7210780f6cfca8a6469df9 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 12:15:06 +0000 Subject: [PATCH 20/62] test From dfc880c2bdc030b2f2d041c8fdb771958014ff50 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 13:21:34 +0000 Subject: [PATCH 21/62] test no coverage files --- package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5c2bb447..bf99c4fb 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,11 @@ "type": "module", "scripts": { "depcheck": "depcheck", - "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", + "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", - "test:integration": "NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", - "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", - "coverage:report": "c8 report", + "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", + "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", "clean": "rimraf -rf ./build", "dev": "npm run tsoa:build && NODE_ENV=dev node --import '@swc-node/register/esm-register' ./src/index.ts", From 3f5126b122dc8b3e44931490cc0439a728446af4 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 13:28:46 +0000 Subject: [PATCH 22/62] test no coverage files From 910ead140353f1678737a5996f83d5a64851d56b Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 13:34:13 +0000 Subject: [PATCH 23/62] test no coverage files From 9b80f706787effb4d54394abf491415d5fbb9c66 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 13:39:52 +0000 Subject: [PATCH 24/62] test no coverage files From 96d810a8d518d7ff37e3c3d10083dfaa0f9bc8ae Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 13:51:52 +0000 Subject: [PATCH 25/62] test no coverage files From f90e591b09949c89d78be15c0981063cc96dca9a Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 3 Nov 2025 15:11:59 +0000 Subject: [PATCH 26/62] test failing test --- package.json | 6 +++--- test/ratelimit/rateLimit.test.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bf99c4fb..30e947f2 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "type": "module", "scripts": { "depcheck": "depcheck", - "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", + "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", - "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", - "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", + "test:integration": "NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", + "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", "clean": "rimraf -rf ./build", "dev": "npm run tsoa:build && NODE_ENV=dev node --import '@swc-node/register/esm-register' ./src/index.ts", diff --git a/test/ratelimit/rateLimit.test.ts b/test/ratelimit/rateLimit.test.ts index dcdb39eb..df651e23 100644 --- a/test/ratelimit/rateLimit.test.ts +++ b/test/ratelimit/rateLimit.test.ts @@ -28,6 +28,7 @@ describe('rate limit', () => { for (let i = 0; i < env.get('GLOBAL_RATE_LIMIT'); i++) { const response = await request(app).get('/api/health') expect(response.status).to.equal(200) + expect(true).to.equal(false) } const response = await request(app).get('/api/health') From aa90741d014e02f6a34f1b7223de6a25c1b61c26 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 12:06:53 +0000 Subject: [PATCH 27/62] remove c8 --- package.json | 7 +++---- test/ratelimit/rateLimit.test.ts | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 30e947f2..a2493d37 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "type": "module", "scripts": { "depcheck": "depcheck", - "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", + "test:unit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", "test:e2e": "NODE_ENV=test playwright test --ui", "test:playwright": "NODE_ENV=test playwright test --trace on --max-failures=1", - "test:integration": "NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", - "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test c8 ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", + "test:integration": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json --file ./test/integration/init.ts ./test/integration/*.test.ts", + "test:ratelimit": "NODE_OPTIONS=--no-experimental-strip-types NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./test/ratelimit/*.test.ts", "build": "npm run tsoa:build && swc ./src -d ./build --copy-files --strip-leading-paths", "clean": "rimraf -rf ./build", "dev": "npm run tsoa:build && NODE_ENV=dev node --import '@swc-node/register/esm-register' ./src/index.ts", @@ -101,7 +101,6 @@ "@types/unzipper": "^0.10.11", "@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/parser": "^8.46.2", - "c8": "^10.1.3", "chai-as-promised": "^8.0.2", "depcheck": "^1.4.7", "eslint": "^9.38.0", diff --git a/test/ratelimit/rateLimit.test.ts b/test/ratelimit/rateLimit.test.ts index df651e23..dcdb39eb 100644 --- a/test/ratelimit/rateLimit.test.ts +++ b/test/ratelimit/rateLimit.test.ts @@ -28,7 +28,6 @@ describe('rate limit', () => { for (let i = 0; i < env.get('GLOBAL_RATE_LIMIT'); i++) { const response = await request(app).get('/api/health') expect(response.status).to.equal(200) - expect(true).to.equal(false) } const response = await request(app).get('/api/health') From 766176ffd4b51b86b9fc33fab1a3e87964273b8c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 12:14:33 +0000 Subject: [PATCH 28/62] no c8 config --- .c8rc.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .c8rc.json diff --git a/.c8rc.json b/.c8rc.json deleted file mode 100644 index 24c67603..00000000 --- a/.c8rc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "include": ["src/**/*.ts"], - "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["text", "html"] -} From e8e7d211f634dffcfe0a1c0ab25daf65a286a026 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 12:24:51 +0000 Subject: [PATCH 29/62] with repo c8 config --- .c8rc.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .c8rc.json diff --git a/.c8rc.json b/.c8rc.json new file mode 100644 index 00000000..24c67603 --- /dev/null +++ b/.c8rc.json @@ -0,0 +1,5 @@ +{ + "include": ["src/**/*.ts"], + "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], + "reporter": ["text", "html"] +} From 44658df16205fd5069c5c639007d4da0960120fd Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 13:46:40 +0000 Subject: [PATCH 30/62] with repo config --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 805879e0..cb32eb89 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,6 +21,7 @@ jobs: npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' coverage: true + coverage_config: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", From c369d82c5c48d1846ca0c232dbb7edf1d86df8fa Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 14:07:55 +0000 Subject: [PATCH 31/62] use default workflow config --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index cb32eb89..805879e0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,6 @@ jobs: npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' coverage: true - coverage_config: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", From 98b771e64a13ed6fb90b725c4c9459aa8619c9d7 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 14:48:05 +0000 Subject: [PATCH 32/62] test pretty logging From d654182598a874fdc5a8ee43a2253ad6a083c81e Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 15:02:46 +0000 Subject: [PATCH 33/62] add file change and test coverage --- .../server/utils/__tests__/githubRequest.test.ts | 14 ++++++++++++++ src/lib/server/utils/githubRequest.ts | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lib/server/utils/__tests__/githubRequest.test.ts b/src/lib/server/utils/__tests__/githubRequest.test.ts index 97312398..90762d9d 100644 --- a/src/lib/server/utils/__tests__/githubRequest.test.ts +++ b/src/lib/server/utils/__tests__/githubRequest.test.ts @@ -11,6 +11,20 @@ import { GithubRequest } from '../githubRequest.js' const env = container.resolve(Env) describe('githubRequest', function () { + test('getRepos', async function () { + const githubRequest = new GithubRequest(mockLogger) + Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) + const repos = await githubRequest.getRepos('token', 1) + expect(repos).to.equal('repos') + }) + + test('getBla', async function () { + const githubRequest = new GithubRequest(mockLogger) + Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) + const repos = await githubRequest.getBla('token', 1) + expect(repos).to.equal('repos') + }) + test('getZip errors with upload limit', async function () { const githubRequest = new GithubRequest(mockLogger) Sinon.stub(githubRequest, 'requestWrapper').resolves({ diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 703f3106..6c2f407c 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -23,6 +23,19 @@ export const authRedirectURL = (returnUrl: string): string => { export class GithubRequest { constructor(@inject(Logger) private logger: ILogger) {} + getBla = async (token: string | undefined, page: number) => { + if (!token) throw new GithubReqError('Missing GitHub token') + + const octokit = new Octokit({ auth: token }) + const response = await this.requestWrapper(async () => + octokit.request('GET /user/repos', { + per_page: perPage, + page, + }) + ) + return response.data + } + getRepos = async (token: string | undefined, page: number) => { if (!token) throw new GithubReqError('Missing GitHub token') From b734f4567662d561b857ee7ccd253a48c1ab352a Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 15:26:47 +0000 Subject: [PATCH 34/62] test pretty logging From a9f32c8c856b03bd43550b0f652245ab41e8c02d Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Tue, 4 Nov 2025 15:46:48 +0000 Subject: [PATCH 35/62] test pretty logging From c153f69ff61948e18ce964cec35f25d00757ee6d Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 09:56:37 +0000 Subject: [PATCH 36/62] on pr sync --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 805879e0..6768ffe1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,8 +1,8 @@ name: Lint and Test on: - push: - branches-ignore: ['main'] + pull_request: + types: [synchronize] concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 795a307a167ccc65d8aec06844328c431a27a138 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 10:06:29 +0000 Subject: [PATCH 37/62] test --- src/lib/server/utils/githubRequest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 6c2f407c..ac1c3f48 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -33,6 +33,7 @@ export class GithubRequest { page, }) ) + return response.data } From 3a1a63a364a1eeb6f65ba467466762f88094c558 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 10:07:58 +0000 Subject: [PATCH 38/62] test --- src/lib/server/utils/githubRequest.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index ac1c3f48..6c2f407c 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -33,7 +33,6 @@ export class GithubRequest { page, }) ) - return response.data } From bbf442131f24ab425ddc4782de027368318c5583 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 10:41:34 +0000 Subject: [PATCH 39/62] test pretty logging From 632062af4f03b45699788b71fd5f32171142daf8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 10:56:11 +0000 Subject: [PATCH 40/62] test pretty logging From 5b2b94d1e7e1c21ce14af11d1e80d893fd34bc59 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 11:01:42 +0000 Subject: [PATCH 41/62] add file change --- src/lib/server/utils/githubRequest.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 6c2f407c..4c0e53bc 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -36,6 +36,19 @@ export class GithubRequest { return response.data } + getBla2 = async (token: string | undefined, page: number) => { + if (!token) throw new GithubReqError('Missing GitHub token') + + const octokit = new Octokit({ auth: token }) + const response = await this.requestWrapper(async () => + octokit.request('GET /user/repos', { + per_page: perPage, + page, + }) + ) + return response.data + } + getRepos = async (token: string | undefined, page: number) => { if (!token) throw new GithubReqError('Missing GitHub token') From d5d5a7b848808e265a04f85c4f80735a3ee744f8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 11:29:48 +0000 Subject: [PATCH 42/62] test pretty logging From fe71f6f105aa987822ae44fc5ec60862ff534628 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 12:17:13 +0000 Subject: [PATCH 43/62] test pretty logging From 87696916b918ce1a32849971cf90e026aeb7dfb1 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 13:55:17 +0000 Subject: [PATCH 44/62] test on push --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6768ffe1..805879e0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,8 +1,8 @@ name: Lint and Test on: - pull_request: - types: [synchronize] + push: + branches-ignore: ['main'] concurrency: group: ${{ github.workflow }}-${{ github.ref }} From f670415fe8e0171196f8412221f41ae7c447915c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 5 Nov 2025 14:25:01 +0000 Subject: [PATCH 45/62] test pretty logging From d0de7855fa8102a77fd119cf950e2bbb20b4963b Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 10:37:18 +0000 Subject: [PATCH 46/62] use main workflow --- .c8rc.json | 2 +- .github/workflows/test.yaml | 8 +++--- .../utils/__tests__/githubRequest.test.ts | 14 ---------- src/lib/server/utils/githubRequest.ts | 26 ------------------- 4 files changed, 5 insertions(+), 45 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 24c67603..6aae764a 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,5 @@ { - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], "reporter": ["text", "html"] } diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 805879e0..328de44f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,8 +1,8 @@ name: Lint and Test on: - push: - branches-ignore: ['main'] + pull_request: + types: [opened, reopened, synchronize] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -15,12 +15,12 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@feat/coverage + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@main with: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' - coverage: true + coverage_config: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", diff --git a/src/lib/server/utils/__tests__/githubRequest.test.ts b/src/lib/server/utils/__tests__/githubRequest.test.ts index 90762d9d..97312398 100644 --- a/src/lib/server/utils/__tests__/githubRequest.test.ts +++ b/src/lib/server/utils/__tests__/githubRequest.test.ts @@ -11,20 +11,6 @@ import { GithubRequest } from '../githubRequest.js' const env = container.resolve(Env) describe('githubRequest', function () { - test('getRepos', async function () { - const githubRequest = new GithubRequest(mockLogger) - Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) - const repos = await githubRequest.getRepos('token', 1) - expect(repos).to.equal('repos') - }) - - test('getBla', async function () { - const githubRequest = new GithubRequest(mockLogger) - Sinon.stub(githubRequest, 'requestWrapper').resolves({ data: 'repos' }) - const repos = await githubRequest.getBla('token', 1) - expect(repos).to.equal('repos') - }) - test('getZip errors with upload limit', async function () { const githubRequest = new GithubRequest(mockLogger) Sinon.stub(githubRequest, 'requestWrapper').resolves({ diff --git a/src/lib/server/utils/githubRequest.ts b/src/lib/server/utils/githubRequest.ts index 4c0e53bc..703f3106 100644 --- a/src/lib/server/utils/githubRequest.ts +++ b/src/lib/server/utils/githubRequest.ts @@ -23,32 +23,6 @@ export const authRedirectURL = (returnUrl: string): string => { export class GithubRequest { constructor(@inject(Logger) private logger: ILogger) {} - getBla = async (token: string | undefined, page: number) => { - if (!token) throw new GithubReqError('Missing GitHub token') - - const octokit = new Octokit({ auth: token }) - const response = await this.requestWrapper(async () => - octokit.request('GET /user/repos', { - per_page: perPage, - page, - }) - ) - return response.data - } - - getBla2 = async (token: string | undefined, page: number) => { - if (!token) throw new GithubReqError('Missing GitHub token') - - const octokit = new Octokit({ auth: token }) - const response = await this.requestWrapper(async () => - octokit.request('GET /user/repos', { - per_page: perPage, - page, - }) - ) - return response.data - } - getRepos = async (token: string | undefined, page: number) => { if (!token) throw new GithubReqError('Missing GitHub token') From 938ecb69fe42f38622e2583853a369f79dc12197 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 10:38:12 +0000 Subject: [PATCH 47/62] v bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c21a8499..99726951 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.7", + "version": "0.6.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dtdl-visualisation-tool", - "version": "0.6.7", + "version": "0.6.8", "license": "Apache-2.0", "dependencies": { "@digicatapult/dtdl-parser": "^1.0.58", diff --git a/package.json b/package.json index 0662c71b..657572d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.7", + "version": "0.6.8", "description": "CLI tool for dtdl visualisation", "main": "build/index.js", "bin": { From b159ca60e42e443513fe583a59a85a37ccc7340c Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 10:56:57 +0000 Subject: [PATCH 48/62] try bug branch with json config --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 328de44f..9159f9a0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@main + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-path with: docker_compose_file: '' npm_build_command: 'npm run build' From 73b2909359d8ec9fcbc5bf16929948c99904bb1e Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 11:03:22 +0000 Subject: [PATCH 49/62] lower threshold --- .c8rc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.c8rc.json b/.c8rc.json index 6aae764a..fd727929 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,5 +1,6 @@ { "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], - "reporter": ["text", "html"] + "reporter": ["text", "html"], + "lines": 50 } From 5816c1a6f650e2839399d50137609401bebee88f Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 11:04:27 +0000 Subject: [PATCH 50/62] test .js --- .c8rc.js | 6 ++++++ .github/workflows/test.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .c8rc.js diff --git a/.c8rc.js b/.c8rc.js new file mode 100644 index 00000000..6f1a130e --- /dev/null +++ b/.c8rc.js @@ -0,0 +1,6 @@ +export default { + include: ['src/**/*.ts', 'src/**/*.tsx'], + exclude: ['**/__tests__/**', 'src/lib/server/routes.ts'], + reporter: ['text', 'html'], + lines: 50, +} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9159f9a0..c092b8c0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' - coverage_config: '.c8rc.json' + coverage_config: '.c8rc.js' env_vars: | { "TMPDIR": "${{ github.workspace }}", From 3d508ae4a40ffeb12bf45d68e14eaefa1498852a Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 11:19:52 +0000 Subject: [PATCH 51/62] try again From d69ee46b99abde46097bcf946bdd2abd02673afe Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 11:52:05 +0000 Subject: [PATCH 52/62] other bug branch --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c092b8c0..51d6f424 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-path + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release with: docker_compose_file: '' npm_build_command: 'npm run build' From 75f7e7c023145dc609ba277cff95115b5db33077 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 11:57:36 +0000 Subject: [PATCH 53/62] test without config --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 51d6f424..2b816b2c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,6 @@ jobs: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' - coverage_config: '.c8rc.js' env_vars: | { "TMPDIR": "${{ github.workspace }}", From 8ac864709a1004cd361f037ae209d6efdcaf4db8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 12:36:47 +0000 Subject: [PATCH 54/62] test bug branch --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2b816b2c..510b2a7f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release-main with: docker_compose_file: '' npm_build_command: 'npm run build' From f46825d120e38f9ed56ef19a90ddfecd5344d018 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 14:59:14 +0000 Subject: [PATCH 55/62] test json --- .c8rc.js | 6 ------ .github/workflows/test.yaml | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .c8rc.js diff --git a/.c8rc.js b/.c8rc.js deleted file mode 100644 index 6f1a130e..00000000 --- a/.c8rc.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - include: ['src/**/*.ts', 'src/**/*.tsx'], - exclude: ['**/__tests__/**', 'src/lib/server/routes.ts'], - reporter: ['text', 'html'], - lines: 50, -} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 510b2a7f..9dde6dff 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,11 +15,12 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release-main + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release with: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' + coverage_config_json: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", From d0e450d3a73e2c7717c8fdfb24b91d95f048adb8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 15:10:30 +0000 Subject: [PATCH 56/62] test temp-dir --- .c8rc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.c8rc.json b/.c8rc.json index fd727929..0b4b1834 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -2,5 +2,6 @@ "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], "reporter": ["text", "html"], - "lines": 50 + "lines": 50, + "temp-directory": "./bla" } From d5d45892e1d94e64d2df845e29216546ef39d143 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 15:43:09 +0000 Subject: [PATCH 57/62] try again From 634d004ec4b277c4a29b58c9ff596a3eacf246f2 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 15:52:26 +0000 Subject: [PATCH 58/62] try again From caaa78ecbf4575d044ba2e68debb1c7a41e944e5 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 15:58:55 +0000 Subject: [PATCH 59/62] without config --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9dde6dff..2b816b2c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,6 @@ jobs: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' - coverage_config_json: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", From 3af9fe147eeb74fdf809e2139408549596afc744 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 6 Nov 2025 16:09:27 +0000 Subject: [PATCH 60/62] add config --- .c8rc.json | 3 +-- .github/workflows/test.yaml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 0b4b1834..fd727929 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -2,6 +2,5 @@ "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": ["**/__tests__/**", "src/lib/server/routes.ts"], "reporter": ["text", "html"], - "lines": 50, - "temp-directory": "./bla" + "lines": 50 } diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2b816b2c..9dde6dff 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,6 +20,7 @@ jobs: docker_compose_file: '' npm_build_command: 'npm run build' tests: '["test:unit", "test:integration", "test:ratelimit"]' + coverage_config_json: '.c8rc.json' env_vars: | { "TMPDIR": "${{ github.workspace }}", From 392f51f5610c899e26352caca383d38c2e92006a Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 7 Nov 2025 13:41:29 +0000 Subject: [PATCH 61/62] use main --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9dde6dff..4e1aded7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: matrix_commands: '["lint", "depcheck", "check", "xss-scan"]' tests-npm: - uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@bug/coverage-release + uses: digicatapult/shared-workflows/.github/workflows/tests-npm.yml@main with: docker_compose_file: '' npm_build_command: 'npm run build' From 5afbf594ee44c17a1d9df81d950afcba30fab92a Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 7 Nov 2025 13:42:38 +0000 Subject: [PATCH 62/62] v bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bdd578db..9e6310c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.10", + "version": "0.6.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dtdl-visualisation-tool", - "version": "0.6.10", + "version": "0.6.11", "license": "Apache-2.0", "dependencies": { "@digicatapult/dtdl-parser": "^1.0.58", diff --git a/package.json b/package.json index 092e19f3..3cb8a01f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dtdl-visualisation-tool", - "version": "0.6.10", + "version": "0.6.11", "description": "CLI tool for dtdl visualisation", "main": "build/index.js", "bin": {