Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing running app-development unit tests separately #14384

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/frontend-unit-tests-app-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Frontend Tests

on:
push:
paths:
- 'frontend/app-development/**'
- '.github/workflows/frontend-unit-tests-app-development.yml'
- 'package.json'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CYPRESS_INSTALL_BINARY: 0

jobs:
test:
name: 'Testing app-development'
runs-on: ubuntu-latest
steps:
- name: 'Checking Out Code'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Installing Dependencies'
uses: ./.github/actions/yarn-install

- name: 'Running Unit Tests'
run: yarn test:ci:app-development

- name: 'Upload coverage reports to Codecov'
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: frontend/app-development/coverage
fail_ci_if_error: true
49 changes: 0 additions & 49 deletions .github/workflows/frontend-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- '!frontend/stats/**'
- 'testdata/**'
- '.github/workflows/frontend-unit-tests.yml'
- 'package.json'
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -43,51 +42,3 @@ jobs:
uses: github/codeql-action/analyze@v3
with:
category: '/language:javascript'

typecheck:
name: 'Typechecking and linting'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: 'Checking Out Code'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Installing Dependencies'
uses: ./.github/actions/yarn-install

- name: 'Doing the typecheck'
run: yarn typecheck

- name: 'Running Eslint'
run: yarn lint --cache

- name: 'Checking code style'
run: yarn run codestyle:check

test:
name: 'Testing'
runs-on: ubuntu-latest
steps:
- name: 'Checking Out Code'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Installing Dependencies'
uses: ./.github/actions/yarn-install

- name: 'Running Unit Tests'
run: yarn test:ci

- name: 'Upload coverage reports to Codecov'
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: frontend/coverage
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion frontend/app-development/layout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jest.mock('app-development/hooks/useWebSocket', () => ({
useWebSocket: jest.fn(),
}));

describe('PageLayout', () => {
describe.skip('PageLayout', () => {
afterEach(() => {
jest.clearAllMocks();
});
Expand Down
5 changes: 5 additions & 0 deletions frontend/app-development/layout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export const PageLayout = (): React.ReactNode => {
const match = matchPath({ path: '/:org/:app', caseSensitive: true, end: false }, pathname);
const { org, app } = match.params;

// Make some changes here to see if test coverage is affected.
// JUST FOR TESTING; REMOVE LATER, DO NOT MERGE
const triggerChange = 'trigger change';
console.log(triggerChange);

const { data: orgs, isPending: orgsPending } = useOrgListQuery();
const { data: repository } = useRepoMetadataQuery(org, app);
const repoOwnerIsOrg = !orgsPending && Object.keys(orgs).includes(repository?.owner?.login);
Expand Down
4 changes: 3 additions & 1 deletion frontend/app-development/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
"build": "cross-env NODE_ENV=production webpack --config ../webpack.config.prod.js",
"build-with-profile": "yarn build --profile --json > stats.json",
"bundle-size": "npx webpack-bundle-analyzer ./stats.json",
"lint": "eslint \"frontend/**/*.ts*\"",
"start": "yarn typecheck:watch & cross-env NODE_ENV=development webpack-dev-server --config ../webpack.config.dev.js --mode development",
"test": "jest --maxWorkers=50%",
"typecheck": "npx tsc --noEmit",
"test:ci": "jest --ci --coverage --max-workers=2 --cacheDirectory=$(yarn config get cacheFolder)",
"typecheck": "tsc --noEmit",
"typecheck:watch": "tsc --noEmit -w"
}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"scripts": {
"build": "yarn workspaces foreach -A -p run build",
"lint": "eslint \"frontend/**/*.ts*\"",
"lint:app-development": "yarn workspace app-development lint",
"lint:fix": "yarn run lint --fix",
"codestyle:check": "prettier frontend --check",
"codestyle:fix": "prettier frontend --write",
Expand All @@ -93,7 +94,9 @@
"syncpack": "npx syncpack fix-mismatches && npx syncpack format && npx syncpack set-semver-ranges",
"test": "jest --maxWorkers=50% --config=frontend/jest.config.js",
"test:ci": "jest --ci --coverage --max-workers=2 --cacheDirectory=$(yarn config get cacheFolder) --config=frontend/jest.config.js",
"test:ci:app-development": "yarn workspace app-development test:ci",
"typecheck": "tsc --noEmit -p frontend",
"typecheck:app-development": "yarn workspace app-development typecheck",
"playwright:test:all": "yarn workspace playwright-studio test:all",
"playwright:test:ui": "yarn workspace playwright-studio test:ui",
"resourceadm:playwright:test:ui": "yarn workspace playwright-resourceadm resourceadm:test:ui",
Expand Down
Loading