Skip to content

Commit 66514a5

Browse files
committed
upgrade jest to 30
covert config files to mjs update github workflow to include elint and prettier add js to eslint config
1 parent 3938d2c commit 66514a5

File tree

10 files changed

+1482
-910
lines changed

10 files changed

+1482
-910
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [main]
8+
branches:
9+
- main
810

911
jobs:
10-
test:
11-
runs-on: macos-latest
12+
eslint-prettier-test:
13+
runs-on: ubuntu-latest
1214

1315
steps:
14-
- uses: actions/checkout@v4
16+
- name: Checkout
17+
uses: actions/checkout@v5
1518

16-
- name: Use Node.js
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version: '20.x'
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v5
2021

21-
- name: Enable corepack
22+
- name: Corepack enable
2223
run: corepack enable
2324

2425
- name: Install dependencies
25-
run: yarn
26+
run: yarn install
2627

27-
- name: Run tests
28+
- name: Run eslint
29+
run: yarn run eslint
30+
31+
- name: Run prettier
32+
run: yarn run prettier
33+
34+
- name: Run unit tests
2835
run: yarn run test

__tests__/__snapshots__/ThumbnailSelector.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`ThumbnailSelector it renders 1`] = `
44
<View

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

babel.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const presets = ['module:@react-native/babel-preset'];

eslint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ import markdown from '@eslint/markdown';
33
import ts from 'typescript-eslint';
44
import yml from 'eslint-plugin-yml';
55
import json from '@eslint/json';
6+
import js from '@eslint/js';
67

78
export default defineConfig([
89
{
910
files: ['**/*.{ts,tsx}'],
1011
plugins: { ts },
1112
extends: [ts.configs.recommended],
1213
},
14+
{
15+
files: ['**/*.{mjs}'],
16+
plugins: { js },
17+
extends: ['js/recommended'],
18+
},
1319
{
1420
files: ['**/*.md'],
1521
plugins: { markdown },

jest.config.js

Lines changed: 0 additions & 195 deletions
This file was deleted.

jest.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property and type check, visit:
3+
* https://jestjs.io/docs/configuration
4+
*
5+
* For more CLI info: https://jestjs.io/docs/cli#reference
6+
*/
7+
/** @type {import('jest').Config} */
8+
const config = {
9+
// Stop running tests after `n` failures
10+
bail: 1,
11+
12+
// Automatically clear mock calls, instances, contexts and results before every test
13+
clearMocks: true,
14+
15+
// Indicates whether the coverage information should be collected while executing the test
16+
collectCoverage: true,
17+
18+
// The directory where Jest should output its coverage files
19+
coverageDirectory: 'coverage',
20+
21+
// An object that configures minimum threshold enforcement for coverage results
22+
coverageThreshold: {
23+
global: {
24+
branches: 100,
25+
functions: 100,
26+
lines: 100,
27+
statements: 100,
28+
},
29+
},
30+
31+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
32+
modulePathIgnorePatterns: ['example/'],
33+
34+
// A preset that is used as a base for Jest's configuration
35+
preset: 'react-native',
36+
};
37+
38+
export default config;

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "A thumbnail selector.",
55
"main": "ThumbnailSelector.tsx",
66
"scripts": {
7-
"test": "yarn jest --coverage",
8-
"lint": "yarn eslint .",
7+
"test": "npx jest --collectCoverage",
8+
"eslint": "npx eslint .",
99
"prettier": "npx prettier --check ."
1010
},
1111
"repository": {
@@ -29,25 +29,26 @@
2929
"author": "Brian Sinnicke",
3030
"license": "MIT",
3131
"devDependencies": {
32+
"@eslint/js": "9.35.0",
3233
"@eslint/json": "0.13.2",
3334
"@eslint/markdown": "7.2.0",
3435
"@react-native/babel-preset": "0.81.1",
3536
"@react-native/eslint-config": "0.81.1",
3637
"@react-native/metro-config": "0.81.1",
3738
"@react-native/typescript-config": "0.81.1",
3839
"@testing-library/react-native": "13.3.3",
39-
"@types/jest": "29.5.14",
40+
"@types/jest": "30.0.0",
4041
"@types/react": "19.1.0",
4142
"@types/react-test-renderer": "19.1.0",
42-
"babel-jest": "29.7.0",
43+
"babel-jest": "30.1.2",
4344
"eslint": "9.35.0",
4445
"eslint-plugin-yml": "1.18.0",
45-
"jest": "29.7.0",
46+
"jest": "30.1.3",
4647
"prettier": "3.6.2",
4748
"react": "19.1.0",
4849
"react-native": "0.81.1",
4950
"react-test-renderer": "19.1.0",
50-
"ts-jest": "29.3.4",
51+
"ts-jest": "29.4.1",
5152
"typescript": "5.8.3",
5253
"typescript-eslint": "8.42.0"
5354
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const config = {
99
trailingComma: 'all',
1010
};
1111

12-
module.exports = config;
12+
export default config;

0 commit comments

Comments
 (0)