Skip to content

Commit

Permalink
ci(react-native): fix jest (#1175)
Browse files Browse the repository at this point in the history
close #1153

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
  • Loading branch information
manudeli authored Aug 2, 2024
1 parent 637475b commit adbb765
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
- "packages/utils/**/*"
"@suspensive/react":
- "packages/react/**/*"
"@suspensive/react-native":
- "packages/react-native/**/*"
"@suspensive/react-query":
- "packages/react-query/**/*"
"@suspensive/react-query-4":
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ component_management:
name: '@suspensive/react'
paths:
- packages/react/**
- component_id: react-native
name: '@suspensive/react-native'
paths:
- packages/react-native/**
- component_id: react-query
name: '@suspensive/react-query'
paths:
Expand Down
1 change: 1 addition & 0 deletions docs/suspensive.org/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build": "next build",
"ci:eslint": "next lint",
"ci:type": "tsc --noEmit",
"clean": "rimraf ./.next",
"dev": "next dev -p 4000",
"start": "next start -p 4000"
},
Expand Down
1 change: 1 addition & 0 deletions examples/next-streaming-react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"build": "next build",
"ci:eslint": "next lint",
"ci:type": "tsc --noEmit",
"clean": "rimraf ./.next",
"dev": "next dev -p 4100",
"start": "next start -p 4100"
},
Expand Down
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ignoreDependencies": ["@suspensive/react"]
},
"packages/react-native": {
"ignoreDependencies": ["expo", "@testing-library/react-native"],
"ignoreDependencies": ["expo", "ts-node"],
"ignore": ["babel.config.cjs"]
}
}
Expand Down
11 changes: 0 additions & 11 deletions packages/react-native/jest.config.cjs

This file was deleted.

11 changes: 11 additions & 0 deletions packages/react-native/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from 'jest'

// eslint-disable-next-line @typescript-eslint/no-var-requires
module.exports = {
preset: 'jest-expo',
transform: {
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
},
transformIgnorePatterns: ['../../node_modules/(?!@react-native|react-native)'],
setupFilesAfterEnv: ['./jest.setup.ts'],
} satisfies Config
1 change: 1 addition & 0 deletions packages/react-native/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/react-native/extend-expect'
7 changes: 4 additions & 3 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"ci:attw": "attw --pack",
"ci:eslint": "eslint \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}\"",
"ci:publint": "publint --strict",
"ci:test": "jest",
"ci:test:watch": "vitest --ui --coverage --typecheck",
"ci:test": "jest --coverage",
"ci:test:watch": "jest --watchAll --coverage",
"ci:type": "tsc --noEmit",
"clean": "rimraf ./dist && rimraf ./coverage",
"dev": "tsup --watch",
Expand All @@ -63,7 +63,8 @@
"jest": "^29.7.0",
"jest-expo": "^51.0.3",
"react": "^18.3.1",
"react-native": "0.74.3"
"react-native": "0.74.3",
"ts-node": "^10.9.2"
},
"peerDependencies": {
"react": "^18",
Expand Down
7 changes: 7 additions & 0 deletions packages/react-native/src/TestText.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { render, screen } from '@testing-library/react-native'
import { TestText } from './TestText'

describe('<TestText />', () => {
it('should render text "Test" with custom text', () => {
render(<TestText />)

expect(1).toBe(1)
expect(screen.queryByRole('text', { name: 'Test' })).toBeOnTheScreen()
expect(screen.queryByRole('text', { name: 'Text' })).not.toBeOnTheScreen()
})
})
Loading

0 comments on commit adbb765

Please sign in to comment.