mirror of
https://github.com/CompassConnections/Compass.git
synced 2025-12-23 22:18:43 -05:00
Add code coverage
This commit is contained in:
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
run: npm run lint
|
||||
|
||||
- name: Run Jest tests
|
||||
run: npm run test tests/jest
|
||||
run: npm run test:coverage
|
||||
|
||||
# - name: Build app
|
||||
# env:
|
||||
@@ -52,9 +52,18 @@ jobs:
|
||||
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||
NEXT_PUBLIC_SUPABASE_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_KEY }}
|
||||
run: |
|
||||
yarn --cwd=web serve &
|
||||
npx nyc --reporter=lcov yarn --cwd=web serve &
|
||||
npx wait-on http://localhost:3000
|
||||
npx playwright test tests/e2e
|
||||
SERVER_PID=$(fuser -k 3000/tcp)
|
||||
echo $SERVER_PID
|
||||
kill $SERVER_PID
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: ./coverage/lcov.info
|
||||
flags: unit
|
||||
fail_ci_if_error: true
|
||||
env:
|
||||
CI: true
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -64,7 +64,7 @@ email-preview
|
||||
*.last-run.json
|
||||
|
||||
*lock.hcl
|
||||
/web/pages/test.tsx
|
||||
/web/pages/_test.tsx
|
||||
|
||||
*.png
|
||||
*.jpg
|
||||
@@ -97,3 +97,4 @@ icons/
|
||||
*.bak
|
||||
|
||||
test-results
|
||||
/.nyc_output/
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
[](https://github.com/CompassConnections/Compass/actions/workflows/ci.yml)
|
||||
[](https://github.com/CompassConnections/Compass/actions/workflows/cd.yml)
|
||||

|
||||
[](https://github.com/CompassConnections/Compass/actions/workflows/cd.yml)
|
||||
[](https://github.com/CompassConnections/Compass/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/CompassConnections/Compass)
|
||||
|
||||
|
||||
# Compass
|
||||
|
||||
|
||||
@@ -76,6 +76,6 @@ describe('getSocialUrl', () => {
|
||||
|
||||
it('should handle discord user IDs and default invite', () => {
|
||||
expect(getSocialUrl('discord', '123456789012345678')).toBe('https://discord.com/users/123456789012345678')
|
||||
expect(getSocialUrl('discord', 'not-an-id')).toBe({discordLink})
|
||||
expect(getSocialUrl('discord', 'not-an-id')).toBe(discordLink)
|
||||
})
|
||||
})
|
||||
7
common/tests/jsonToMarkdown.test.ts
Normal file
7
common/tests/jsonToMarkdown.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import {jsonToMarkdown} from "../src/md";
|
||||
|
||||
describe('JSON to Markdown', () => {
|
||||
it('', () => {
|
||||
expect(jsonToMarkdown({})).toBe('')
|
||||
})
|
||||
})
|
||||
16
jest.config.js
Normal file
16
jest.config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testPathIgnorePatterns: [
|
||||
// '/node_modules/',
|
||||
// '/dist/',
|
||||
// '/coverage/',
|
||||
'/tests/e2e',
|
||||
// '/lib/',
|
||||
// 'backend/email/emails/test.ts',
|
||||
'common/src/socials.test.ts',
|
||||
// 'backend/api/src',
|
||||
// 'martin',
|
||||
],
|
||||
};
|
||||
@@ -21,13 +21,13 @@
|
||||
"sync-android": "./scripts/sync_android.sh",
|
||||
"migrate": "./scripts/migrate.sh",
|
||||
"test": "jest",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:watch": "jest --watch",
|
||||
"test:update": "jest --updateSnapshot",
|
||||
"playwright": "playwright test",
|
||||
"playwright:ui": "playwright test --ui",
|
||||
"playwright:debug": "playwright test --debug",
|
||||
"playwright:report": "npx playwright show-report tests/reports/playwright-report",
|
||||
"test:watch": "jest --watch",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:update": "jest --updateSnapshot",
|
||||
"postinstall": "./scripts/post_install.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -9,7 +9,7 @@ npx playwright install chromium
|
||||
export NEXT_PUBLIC_API_URL=localhost:8088
|
||||
export NEXT_PUBLIC_FIREBASE_ENV=DEV
|
||||
|
||||
yarn --cwd=web serve &
|
||||
npx nyc --reporter=lcov yarn --cwd=web serve &
|
||||
npx wait-on http://localhost:3000
|
||||
npx playwright test tests/e2e
|
||||
SERVER_PID=$(fuser -k 3000/tcp)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// import '@testing-library/jest-dom';
|
||||
|
||||
describe('LoadingSpinner', () => {
|
||||
it('renders something', () => {
|
||||
// render(<LoadingSpinner/>);
|
||||
//
|
||||
// // Check if the spinner has the correct classes
|
||||
// const spinner = screen.getByTestId('spinner');
|
||||
// expect(spinner).toHaveClass('animate-spin');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user