Skip to content

Commit

Permalink
update ci.yml and jest.config
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Feb 20, 2024
1 parent 33b6287 commit 40cdeb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ jobs:
name: test/node ${{ matrix.node }}/${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run test
- run: npm run build

Expand All @@ -24,11 +26,12 @@ jobs:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '17'
- run: npm install
node-version: '18'
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: paambaati/[email protected]
env:
Expand Down
22 changes: 9 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// jest.config.js

module.exports = {
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
Expand All @@ -9,28 +7,26 @@ module.exports = {
'!*.config.{js,ts}',
],
moduleNameMapper: {
/* Handle CSS imports (with CSS modules)
https://jestjs.io/docs/webpack#mocking-css-modules */
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',

// Handle CSS imports (without CSS modules)
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',

/* Handle image imports
https://jestjs.io/docs/webpack#handling-static-assets */
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$':
'<rootDir>/__mocks__/fileMock.js',
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$': '<rootDir>/__mocks__/fileMock.js',
},
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
testEnvironment: 'jsdom',
transform: {
/* Use babel-jest to transpile tests with the next/babel preset
https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object */
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
},
transformIgnorePatterns: [
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
coverageThreshold: {
global: {
branches: 18,
functions: 18,
lines: 18,
statements: 18,
},
},
};

0 comments on commit 40cdeb0

Please sign in to comment.