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

Feat/workflow #105

Closed
wants to merge 12 commits into from
59 changes: 59 additions & 0 deletions .github/workflows/run-dapp-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Run dapp tests

on:
pull_request:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: read
packages: none

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '18.18.2'

- name: Install dependencies
run: yarn install

- name: Build app
run: yarn build --filter dapp

test-app:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected]
- uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '18.18.2'

- name: navigate to the dapp directory
run: cd apps/dapp

- name: Run jest tests
run: yarn exec jest

5 changes: 4 additions & 1 deletion apps/dapp/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
const nextJest = require("next/jest");

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
Expand All @@ -9,6 +9,9 @@ const createJestConfig = nextJest({
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
testEnvironment: "jsdom",
transform: {
"^.+.tsx?$": ["ts-jest",{}],
}
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
Expand Down
6 changes: 4 additions & 2 deletions apps/dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@
"react-redux": "^9.1.2"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@chakra-ui/cli": "^3.0.0",
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@testing-library/jest-dom": "6.1.5",
"@testing-library/react": "14.1.2",
"@types/jest": "29.5.11",
"@types/jest": "^29.5.13",
"@types/node": "^20",
"@types/react": "18.2.45",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "15.0.0-rc.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-jest": "^29.2.5",
"typescript": "5.3.3"
}
}
}
Loading
Loading