Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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
23 changes: 22 additions & 1 deletion .github/workflows/pr-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
- "LICENSE"
workflow_dispatch:

# Avoid running multiple builds for the same PR.
concurrency:
group: pr-builder-${{ github.ref }}
cancel-in-progress: true

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -169,7 +174,23 @@ jobs:

- name: 🃏 Run Jest & Collect Coverage
id: run-jest-test-and-coverage
run: pnpm test
run: pnpm test:ci

- name: Upload `@asgardeo/js` coverage reports to Codecov
id: upload-asgardeo-js-coverage
uses: codecov/[email protected]
with:
files: ./packages/core/coverage/coverage-final.json
flags: '@asgardeo/js'
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload `@asgardeo/react` coverage reports to Codecov
id: upload-asgardeo-react-coverage
uses: codecov/[email protected]
with:
files: ./packages/core/coverage/coverage-final.json
flags: '@asgardeo/react'
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: 🚧 Build
Expand Down
37 changes: 37 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -------------------------------------------------------------------------------------
#
# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
#
# WSO2 LLC. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# --------------------------------------------------------------------------------------

# This workflow will run the Codecov action on the repository.

codecov:
require_ci_to_pass: yes
notify:
wait_for_ci: yes
coverage:
status:
project:
default:
enabled: yes
threshold: null
target: auto
patch:
default:
target: 80%
threshold: 40%
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"publish:packages": "changeset publish",
"test": "nx run-many --target=test --parallel",
"typecheck": "nx run-many --target=typecheck --parallel",
"test:ci": "nx run-many --target=test:ci --parallel",
"version:packages": "changeset version && pnpm install --lockfile-only"
},
"devDependencies": {
Expand Down
47 changes: 47 additions & 0 deletions packages/core/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import type {Config} from '@jest/types';

const jestConfig: Config.InitialOptions = {
displayName: '@asgardeo/js',
extensionsToTreatAsEsm: ['.ts'],
moduleDirectories: ['node_modules', 'test-configs', __dirname],
moduleFileExtensions: ['js', 'ts', 'json', 'node'],
moduleNameMapper: {
'^@unit-testing(.*)$': '<rootDir>/test-configs/utils',
},
modulePaths: ['<rootDir>'],
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/test-configs/setup-test.ts'],
testEnvironment: 'node',
testMatch: ['<rootDir>/**/?(*.)test.{ts,js}'],
testPathIgnorePatterns: ['<rootDir>/(dist|node_modules)/'],
transform: {
'^.+\\.ts?$': [
'ts-jest',
{
useESM: true,
},
],
},
transformIgnorePatterns: [],
verbose: true,
};

export default jestConfig;
10 changes: 9 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,30 @@
"scripts": {
"build": "rollup -c",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
"lint:fix": "eslint . --fix",
"test": "pnpm jest --passWithNoTests",
"test:ci": "pnpm jest --passWithNoTests --coverage"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@jest/types": "^29.6.3",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"@types/lodash.isempty": "^4.4.9",
"@types/lodash.merge": "^4.6.9",
"@types/node": "^20.12.7",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?fa0b844715320a3953d6d055997c0770f8695082",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?fa0b844715320a3953d6d055997c0770f8695082",
"eslint": "~8.57.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"rollup": "^4.17.2",
"rollup-plugin-dts": "^6.1.0",
"ts-jest": "^29.1.5",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.1.6"
},
Expand Down
Loading