Skip to content

Commit 9e1826f

Browse files
committed
Add jest testing
1 parent d6211cd commit 9e1826f

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
with:
2020
composer-options: "--prefer-dist --optimize-autoloader --ignore-platform-reqs"
2121
- name: Run PestPHP
22-
run: vendor/bin/pest --coverage --coverage-clover test-results/coverage.xml
22+
run: vendor/bin/pest --coverage --coverage-clover test-results/pest.xml
2323
- name: Upload coverage to Codecov
2424
if: always()
2525
uses: codecov/codecov-action@v1
2626
with:
2727
token: ${{ secrets.CODECOV_TOKEN }}
28-
file: test-results/coverage.xml
28+
file: test-results/pest.xml
2929

3030
larastan:
3131
runs-on: ubuntu-latest
@@ -52,6 +52,22 @@ jobs:
5252
- name: Run ESLint
5353
run: yarn run lint
5454

55+
jest:
56+
runs-on: ubuntu-latest
57+
name: Jest
58+
steps:
59+
- uses: actions/checkout@v2
60+
- name: Install dependencies
61+
run: yarn install
62+
- name: Run Jest
63+
run: yarn test --coverage --coverageDirectory=test-results/jest.xml
64+
- name: Upload coverage to Codecov
65+
if: always()
66+
uses: codecov/codecov-action@v1
67+
with:
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
file: test-results/jest.xml
70+
5571
# phpcs:
5672
# runs-on: ubuntu-latest
5773
# name: PHP Style Fixer

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
transform: {
3+
'^.+\\.tsx?$': 'ts-jest',
4+
},
5+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
6+
};

js-tests/example.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('SocketIoChannel', () => {
2+
test('does thing one', () => {
3+
expect(true).toBe(true);
4+
});
5+
});

0 commit comments

Comments
 (0)