Skip to content

Commit 86a14c4

Browse files
authored
Fix/echo chrome input (#17)
* feat: added unittest and fix for chrome echo at first message * feat: added test before publishing to npm
1 parent 8ac5c75 commit 86a14c4

23 files changed

Lines changed: 15027 additions & 4500 deletions

.github/workflows/npm-publish.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,27 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
build:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 18
22+
cache: "npm"
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
build-and-publish:
31+
needs: test
1232
runs-on: ubuntu-latest
1333

1434
permissions:
@@ -43,7 +63,7 @@ jobs:
4363

4464
create_release:
4565
name: Create GitHub Release
46-
needs: build
66+
needs: build-and-publish
4767
runs-on: ubuntu-latest
4868

4969
permissions:

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [18, 20]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: "npm"
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Run tests
33+
run: npm test
34+
35+
- name: Run tests with coverage
36+
run: npm run test:coverage
37+
continue-on-error: true
38+
39+
- name: Upload coverage report
40+
uses: actions/upload-artifact@v4
41+
if: matrix.node-version == 20
42+
with:
43+
name: coverage-report
44+
path: coverage/
45+
retention-days: 7

jest.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/** @type {import('jest').Config} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'jsdom',
5+
roots: ['<rootDir>/src', '<rootDir>/tests'],
6+
testMatch: ['**/*.test.ts', '**/*.test.tsx'],
7+
moduleNameMapper: {
8+
'^@/rapida/(.*)$': '<rootDir>/src/$1',
9+
},
10+
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
11+
collectCoverageFrom: [
12+
'src/**/*.{ts,tsx}',
13+
'!src/**/*.d.ts',
14+
'!src/clients/protos/**',
15+
'!src/styles/**',
16+
],
17+
coverageDirectory: 'coverage',
18+
coverageReporters: ['text', 'lcov', 'html'],
19+
transform: {
20+
'^.+\\.tsx?$': ['ts-jest', {
21+
tsconfig: 'tsconfig.test.json',
22+
}],
23+
},
24+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
25+
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
26+
verbose: true,
27+
};

0 commit comments

Comments
 (0)