Skip to content

Commit 3c41128

Browse files
authored
Merge pull request thunder-id#3030 from jeradrutnam/main
Fix frontend/packages & docs packages lint and test failures and re-enabled in CI
2 parents 24d4d00 + f8cbc80 commit 3c41128

149 files changed

Lines changed: 1934 additions & 1625 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.audit-ignore.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"$comment": "Audit advisory IDs to ignore. Frontend uses CVE IDs (pnpm), E2E/sample-apps use GHSA IDs (npm).",
3-
"frontend": [],
2+
"$comment": "Audit advisory IDs to ignore for npm audit (E2E and sample-apps). Frontend CVE ignores are managed via auditConfig.ignoreCves in pnpm-workspace.yaml.",
43
"common": [],
54
"e2e": [],
65
"sample-apps": []

.github/workflows/pr-builder.yml

Lines changed: 77 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
# Avoid running multiple PR builders for the same PR on subsequent pushes.
1515
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1717
cancel-in-progress: true
1818

1919
env:
@@ -46,12 +46,9 @@ jobs:
4646
working-directory: frontend
4747
run: |
4848
echo "🔍 Running pnpm audit for frontend dependencies..."
49-
IGNORE_ARGS=()
50-
while IFS= read -r id; do
51-
IGNORE_ARGS+=(--ignore "$id")
52-
done < <(jq -r '.frontend[].id' "$GITHUB_WORKSPACE/.audit-ignore.json")
49+
# CVE ignores are managed via auditConfig.ignoreCves in pnpm-workspace.yaml
5350
# Remove `--ignore-registry-errors` once pnpm 11 is generally available. Tracker: https://github.com/pnpm/pnpm/issues/11265
54-
pnpm audit --ignore-registry-errors --audit-level=high "${IGNORE_ARGS[@]}"
51+
pnpm audit --ignore-registry-errors --audit-level=high
5552
5653
- name: 🔍 Run npm audit (E2E Tests)
5754
working-directory: tests/e2e
@@ -336,16 +333,12 @@ jobs:
336333
if: steps.filter.outputs.code != 'true'
337334
run: echo "Only documentation changes detected - skipping frontend and E2E tests"
338335

339-
test-frontend:
340-
name: 🧪 Frontend Tests (shard ${{ matrix.shard }}/4)
336+
test-frontend-packages:
337+
name: 🧪 Frontend Package & Gate Tests
341338
needs: [detect-code-changes]
342339
if: ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'merge_group') && (needs.detect-code-changes.result == 'skipped' || needs.detect-code-changes.outputs.should-run == 'true') }}
343340
runs-on: ubuntu-latest
344341
timeout-minutes: 30
345-
strategy:
346-
fail-fast: false
347-
matrix:
348-
shard: [1, 2, 3, 4]
349342
steps:
350343
- name: 📥 Checkout Code
351344
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -369,37 +362,85 @@ jobs:
369362
run: |
370363
pnpm build:frontend
371364
372-
- name: 🧪 Run Console Tests with Coverage
365+
- name: 🎭 Install Playwright Browsers
366+
run: pnpm exec playwright install chromium
367+
368+
- name: 🧪 Run Tests for Frontend Packages
373369
run: |
374-
cd frontend/apps/console
375-
pnpm vitest run --coverage --shard=${{ matrix.shard }}/4
370+
cd frontend
371+
pnpm test:packages
376372
377373
- name: 🧪 Run Gate Tests with Coverage
378-
if: matrix.shard == 1
379374
run: |
380375
cd frontend/apps/gate
381376
pnpm test:coverage
382377
383-
# TODO: Enable package tests in CI once the broken tests are fixed
378+
# Strip branch data (BRDA/BRF/BRH) from frontend LCOV reports before uploading.
379+
# React Compiler (babel-plugin-react-compiler) generates phantom branch points in compiled
380+
# output that inflate the partial-line count in Codecov's coverage calculation.
381+
# This is a known upstream issue: https://github.com/facebook/react/issues/32950
382+
# Line and function coverage remain unaffected and accurately reflect test quality.
383+
- name: 🧹 Strip branch data from gate LCOV report
384+
run: |
385+
if [ -f "frontend/apps/gate/coverage/lcov.info" ]; then
386+
sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "frontend/apps/gate/coverage/lcov.info"
387+
fi
384388
385-
# - name: 🧪 Run Packages Tests with Coverage
386-
# if: matrix.shard == 1
387-
# run: |
388-
# cd frontend/packages
389-
# pnpm test:coverage
389+
- name: 📦 Upload gate coverage artifact
390+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
391+
with:
392+
name: gate-coverage
393+
path: frontend/apps/gate/coverage/lcov.info
394+
if-no-files-found: error
395+
396+
test-frontend-console:
397+
name: 🧪 Console Tests (shard ${{ matrix.shard }}/4)
398+
needs: [detect-code-changes]
399+
if: ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'merge_group') && (needs.detect-code-changes.result == 'skipped' || needs.detect-code-changes.outputs.should-run == 'true') }}
400+
runs-on: ubuntu-latest
401+
timeout-minutes: 30
402+
strategy:
403+
fail-fast: false
404+
matrix:
405+
shard: [1, 2, 3, 4]
406+
steps:
407+
- name: 📥 Checkout Code
408+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
409+
410+
- name: ⚙️ Set up Node.js
411+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
412+
with:
413+
node-version: ${{ env.NODE_VERSION }}
414+
415+
- name: 📦 Install pnpm
416+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
417+
with:
418+
run_install: false
419+
cache_dependency_path: pnpm-lock.yaml
420+
421+
- name: 📦 Install Frontend Dependencies
422+
run: |
423+
pnpm install --frozen-lockfile
424+
425+
- name: 🔨 Build Frontend
426+
run: |
427+
pnpm build:frontend
428+
429+
- name: 🧪 Run Console Tests with Coverage
430+
run: |
431+
cd frontend/apps/console
432+
pnpm vitest run --coverage --shard=${{ matrix.shard }}/4
390433
391434
# Strip branch data (BRDA/BRF/BRH) from frontend LCOV reports before uploading.
392435
# React Compiler (babel-plugin-react-compiler) generates phantom branch points in compiled
393436
# output that inflate the partial-line count in Codecov's coverage calculation.
394437
# This is a known upstream issue: https://github.com/facebook/react/issues/32950
395438
# Line and function coverage remain unaffected and accurately reflect test quality.
396-
- name: 🧹 Strip branch data from frontend LCOV reports
439+
- name: 🧹 Strip branch data from console LCOV report
397440
run: |
398-
for lcov_file in frontend/apps/console/coverage/lcov.info frontend/packages/coverage/lcov.info; do
399-
if [ -f "$lcov_file" ]; then
400-
sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "$lcov_file"
401-
fi
402-
done
441+
if [ -f "frontend/apps/console/coverage/lcov.info" ]; then
442+
sed -i '/^BRDA:/d;/^BRF:/d;/^BRH:/d' "frontend/apps/console/coverage/lcov.info"
443+
fi
403444
404445
- name: 📦 Upload console coverage artifact
405446
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -408,18 +449,10 @@ jobs:
408449
path: frontend/apps/console/coverage/lcov.info
409450
if-no-files-found: error
410451

411-
- name: 📦 Upload gate coverage artifact
412-
if: matrix.shard == 1
413-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
414-
with:
415-
name: gate-coverage
416-
path: frontend/apps/gate/coverage/lcov.info
417-
if-no-files-found: error
418-
419452
upload-frontend-coverage:
420453
name: 📊 Upload Frontend Coverage
421-
needs: test-frontend
422-
if: always() && needs.test-frontend.result == 'success'
454+
needs: [test-frontend-packages, test-frontend-console]
455+
if: always() && needs.test-frontend-packages.result == 'success' && needs.test-frontend-console.result == 'success'
423456
runs-on: ubuntu-latest
424457
timeout-minutes: 30
425458
permissions:
@@ -624,6 +657,12 @@ jobs:
624657
with:
625658
node-version: 'lts/*'
626659

660+
- name: 📦 Install pnpm
661+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
662+
with:
663+
run_install: false
664+
cache_dependency_path: pnpm-lock.yaml
665+
627666
- name: 📥 Download Built Distribution
628667
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
629668
with:

docs/eslint.config.js

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
* under the License.
1717
*/
1818

19-
import thunderIdPlugin, {createParserOptions} from '@thunderid/eslint-plugin';
20-
import {fileURLToPath} from 'url';
2119
import {dirname} from 'path';
20+
import {fileURLToPath} from 'url';
21+
import thunderIdPlugin, {createParserOptions} from '@thunderid/eslint-plugin';
2222

23-
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention
2423
const __filename = fileURLToPath(import.meta.url);
25-
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention
24+
2625
const __dirname = dirname(__filename);
2726

2827
export default [
@@ -38,5 +37,52 @@ export default [
3837
project: './tsconfig.eslint.json',
3938
}),
4039
},
40+
rules: {
41+
'import-x/no-unresolved': [
42+
'error',
43+
{
44+
ignore: ['^@docusaurus/', '^@theme/', '^@theme-original/', '^@generated/', '^@site/'],
45+
},
46+
],
47+
},
48+
},
49+
{
50+
files: ['**/*.mjs'],
51+
languageOptions: {
52+
parserOptions: {
53+
project: null,
54+
},
55+
},
56+
},
57+
{
58+
files: ['scripts/**/*.mjs'],
59+
languageOptions: {
60+
globals: {
61+
process: 'readonly',
62+
__dirname: 'readonly',
63+
__filename: 'readonly',
64+
URL: 'readonly',
65+
console: 'readonly',
66+
Buffer: 'readonly',
67+
},
68+
},
69+
rules: {
70+
'import/no-extraneous-dependencies': 'off',
71+
'import-x/extensions': 'off',
72+
'@thunderid/copyright-header': ['error', {allowShebang: true}],
73+
},
74+
},
75+
{
76+
files: ['plugins/shims/*.cjs'],
77+
languageOptions: {
78+
globals: {
79+
module: 'writable',
80+
require: 'readonly',
81+
__dirname: 'readonly',
82+
__filename: 'readonly',
83+
process: 'readonly',
84+
exports: 'writable',
85+
},
86+
},
4187
},
4288
];

docs/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"@thunderid/eslint-plugin": "workspace:^",
5252
"@thunderid/logger": "workspace:^",
5353
"@thunderid/prettier-config": "workspace:^",
54-
"@wso2/oxygen-ui": "0.10.1",
55-
"@wso2/oxygen-ui-icons-react": "0.10.1",
54+
"@wso2/oxygen-ui": "catalog:",
55+
"@wso2/oxygen-ui-icons-react": "catalog:",
5656
"clsx": "2.1.1",
5757
"docusaurus-plugin-copy-page-button": "0.5.0",
5858
"eslint": "9.39.4",
@@ -65,6 +65,8 @@
6565
"@docusaurus/module-type-aliases": "3.9.2",
6666
"@docusaurus/tsconfig": "3.9.2",
6767
"@docusaurus/types": "3.9.2",
68+
"@types/react": "catalog:",
69+
"@types/react-dom": "catalog:",
6870
"openapi-to-postmanv2": "4.23.0",
6971
"rimraf": "catalog:",
7072
"typescript": "5.9.3",

docs/plugins/personaPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function personaPlugin(): Plugin {
4848
return {
4949
name: 'product-persona-plugin',
5050

51-
async allContentLoaded({
51+
allContentLoaded({
5252
allContent,
5353
actions,
5454
}: {

docs/plugins/shims/emotion-css.cjs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1+
/**
2+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
119
// SSR shim for @emotion/css — Emotion creates a DOM cache at module init
220
// which fails in Node.js (document is not defined). This no-op shim is used
321
// only during Docusaurus server-side rendering; the real package runs in the browser.
4-
function noop() { return ''; }
5-
function noopObj() { return {}; }
22+
23+
function noop() {
24+
return '';
25+
}
626

727
module.exports = {
828
css: noop,
@@ -12,6 +32,8 @@ module.exports = {
1232
hydrate: noop,
1333
flush: noop,
1434
merge: noop,
15-
getRegisteredStyles: function() { return []; },
16-
cache: { key: 'css', registered: {}, inserted: {}, sheet: { tags: [] } },
35+
getRegisteredStyles: function () {
36+
return [];
37+
},
38+
cache: {key: 'css', registered: {}, inserted: {}, sheet: {tags: []}},
1739
};

docs/plugins/shims/thunderid-react.cjs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
/**
2-
* No-op shim for @thunderid/react.
2+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
33
*
4-
* The frontend design package dist imports these symbols from @thunderid/react,
5-
* but docs only uses theme utilities from that package. This shim prevents
6-
* webpack from failing when it cannot resolve @thunderid/react in the docs build.
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
717
*/
18+
19+
// No-op shim for @thunderid/react.
20+
// The frontend design package dist imports these symbols from @thunderid/react,
21+
// but docs only uses theme utilities from that package. This shim prevents
22+
// webpack from failing when it cannot resolve @thunderid/react in the docs build.
23+
824
module.exports = {
925
Consent: () => null,
1026
ConsentCheckboxList: () => null,

docs/scripts/cut-version.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* under the License.
1919
*/
2020

21-
/* eslint-disable @thunderid/copyright-header, import/no-extraneous-dependencies, no-underscore-dangle */
22-
2321
/**
2422
* Cuts a new Docusaurus documentation version and snapshots the API spec for it.
2523
*
@@ -40,8 +38,8 @@
4038
import {execFileSync} from 'child_process';
4139
import {existsSync} from 'fs';
4240
import {join, dirname} from 'path';
43-
import {createLogger} from '@thunderid/logger';
4441
import {fileURLToPath} from 'url';
42+
import {createLogger} from '@thunderid/logger';
4543

4644
const __filename = fileURLToPath(import.meta.url);
4745
const __dirname = dirname(__filename);

docs/scripts/generate-postman-collections.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* under the License.
1919
*/
2020

21-
/* eslint-disable @thunderid/copyright-header, no-undef */
22-
2321
/**
2422
* Generates Postman collections, environments, and globals from OpenAPI specifications.
2523
* Product name and slug are derived from docusaurus.product.config.ts to keep the

0 commit comments

Comments
 (0)