Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e52979

Browse files
update testing
1 parent b9be988 commit 6e52979

File tree

6 files changed

+33
-25
lines changed

6 files changed

+33
-25
lines changed

‎template/__mocks__/libs/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '@testing-library/jest-native/extend-expect';
1+
import '@testing-library/react-native/extend-expect';
22
// LOCAL
33
import './react-native-reanimated';
44
import './react-native-safe-area-context';

‎template/eslint.config.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import jest from 'eslint-plugin-jest';
55
import perfectionist from 'eslint-plugin-perfectionist';
66
import react from 'eslint-plugin-react';
77
import reactHooks from 'eslint-plugin-react-hooks';
8+
import testingLibrary from 'eslint-plugin-testing-library';
89
import unicorn from 'eslint-plugin-unicorn';
910
import unusedImports from 'eslint-plugin-unused-imports';
1011
import tsEslint from 'typescript-eslint';
@@ -15,7 +16,7 @@ const __dirname = dirname(__filename);
1516
export default [
1617
...tsEslint.configs.strict,
1718
{
18-
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
19+
files: ['**/*.mjs','**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
1920
plugins: {
2021
import: importPlugin,
2122
jest,
@@ -153,6 +154,9 @@ export default [
153154
},
154155
{
155156
files: ['./**/*.test.{ts,tsx}'],
157+
plugins: {
158+
'testing-library': testingLibrary,
159+
},
156160
rules: {
157161
'@typescript-eslint/no-unsafe-assignment': 0,
158162
'@typescript-eslint/no-unsafe-call': 0,

‎template/jest.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ module.exports = {
55
],
66
coverageReporters: ['html', 'text', 'text-summary', 'cobertura'],
77
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
8-
preset: '@testing-library/react-native',
9-
setupFilesAfterEnv: [
10-
'./node_modules/react-native-gesture-handler/jestSetup.js',
11-
'<rootDir>/jest.setup.js',
12-
],
8+
preset: 'react-native',
9+
setupFiles: ['./node_modules/react-native-gesture-handler/jestSetup.js'],
10+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
1311
testMatch: ['**/*.test.ts?(x)', '**/*.test.js?(x)'],
1412
transformIgnorePatterns: [
1513
'node_modules/(?!(jest-)?react-native|@react-native|@react-native-community|@react-navigation|ky)',

‎template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@react-native/eslint-config": "0.76.1",
4949
"@react-native/metro-config": "0.76.1",
5050
"@react-native/typescript-config": "0.76.1",
51-
"@testing-library/jest-native": "^5.4.2",
5251
"@testing-library/react-native": "^12.1.2",
5352
"@types/jest": "^29.4.0",
5453
"@types/node": "^18.14.1",
@@ -66,6 +65,7 @@
6665
"eslint-plugin-perfectionist": "^3.9.1",
6766
"eslint-plugin-react": "^7.37.1",
6867
"eslint-plugin-react-hooks": "^5.0.0",
68+
"eslint-plugin-testing-library": "^6.4.0",
6969
"eslint-plugin-unicorn": "^56.0.0",
7070
"eslint-plugin-unused-imports": "^4.1.4",
7171
"jest": "^29.7.0",

‎template/src/components/atoms/Skeleton/Skeleton.test.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,23 @@ describe('SkeletonLoader', () => {
3737
{ wrapper: TestAppWrapper },
3838
);
3939
const skeleton = getByTestId('skeleton-loader');
40-
expect(skeleton).toHaveAnimatedStyle({
40+
// TODO: use toHaveAnimatedStyle for better API but for now there is an issue with the library
41+
// expect(skeleton).toHaveAnimatedStyle({
42+
// opacity: 0.2,
43+
// });
44+
45+
expect(skeleton.props.jestAnimatedStyle.value).toEqual({
4146
opacity: 0.2,
4247
});
48+
4349
jest.advanceTimersByTime(800);
44-
expect(skeleton).toHaveAnimatedStyle({
50+
expect(skeleton.props.jestAnimatedStyle.value).toEqual({
4551
opacity: 1,
4652
});
53+
// TODO: use toHaveAnimatedStyle for better API but for now there is an issue with the library
54+
// expect(skeleton).toHaveAnimatedStyle({
55+
// opacity: 1,
56+
// });
4757
expect(skeleton).toHaveStyle({
4858
backgroundColor: '#A1A1A1',
4959
borderRadius: 4,

‎template/yarn.lock

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,17 +2025,6 @@
20252025
dependencies:
20262026
"@tanstack/query-core" "5.59.20"
20272027

2028-
"@testing-library/jest-native@^5.4.2":
2029-
version "5.4.3"
2030-
resolved "https://registry.yarnpkg.com/@testing-library/jest-native/-/jest-native-5.4.3.tgz#9334c68eaf45db9eb20d0876728cc5d7fc2c3ea2"
2031-
integrity sha512-/sSDGaOuE+PJ1Z9Kp4u7PQScSVVXGud59I/qsBFFJvIbcn4P6yYw6cBnBmbPF+X9aRIsTJRDl6gzw5ZkJNm66w==
2032-
dependencies:
2033-
chalk "^4.1.2"
2034-
jest-diff "^29.0.1"
2035-
jest-matcher-utils "^29.0.1"
2036-
pretty-format "^29.0.3"
2037-
redent "^3.0.0"
2038-
20392028
"@testing-library/react-native@^12.1.2":
20402029
version "12.8.1"
20412030
resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-12.8.1.tgz#833c73a825aa87b9127717a44d4aeee44b59a963"
@@ -2384,7 +2373,7 @@
23842373
"@typescript-eslint/types" "8.14.0"
23852374
"@typescript-eslint/typescript-estree" "8.14.0"
23862375

2387-
"@typescript-eslint/utils@^5.10.0":
2376+
"@typescript-eslint/utils@^5.10.0", "@typescript-eslint/utils@^5.62.0":
23882377
version "5.62.0"
23892378
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86"
23902379
integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==
@@ -3800,6 +3789,13 @@ eslint-plugin-react@^7.30.1, eslint-plugin-react@^7.37.1:
38003789
string.prototype.matchall "^4.0.11"
38013790
string.prototype.repeat "^1.0.0"
38023791

3792+
eslint-plugin-testing-library@^6.4.0:
3793+
version "6.4.0"
3794+
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-6.4.0.tgz#1ba8a7422e3e31cc315a73ff17c34908f56f9838"
3795+
integrity sha512-yeWF+YgCgvNyPNI9UKnG0FjeE2sk93N/3lsKqcmR8dSfeXJwFT5irnWo7NjLf152HkRzfoFjh3LsBUrhvFz4eA==
3796+
dependencies:
3797+
"@typescript-eslint/utils" "^5.62.0"
3798+
38033799
eslint-plugin-unicorn@^56.0.0:
38043800
version "56.0.0"
38053801
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-56.0.0.tgz#9fd3ebe6f478571734541fa745026b743175b59e"
@@ -4919,7 +4915,7 @@ jest-config@^29.7.0:
49194915
slash "^3.0.0"
49204916
strip-json-comments "^3.1.1"
49214917

4922-
jest-diff@^29.0.1, jest-diff@^29.7.0:
4918+
jest-diff@^29.7.0:
49234919
version "29.7.0"
49244920
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a"
49254921
integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==
@@ -4991,7 +4987,7 @@ jest-leak-detector@^29.7.0:
49914987
jest-get-type "^29.6.3"
49924988
pretty-format "^29.7.0"
49934989

4994-
jest-matcher-utils@^29.0.1, jest-matcher-utils@^29.7.0:
4990+
jest-matcher-utils@^29.7.0:
49954991
version "29.7.0"
49964992
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12"
49974993
integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==
@@ -6268,7 +6264,7 @@ pretty-format@^26.6.2:
62686264
ansi-styles "^4.0.0"
62696265
react-is "^17.0.1"
62706266

6271-
pretty-format@^29.0.0, pretty-format@^29.0.3, pretty-format@^29.7.0:
6267+
pretty-format@^29.0.0, pretty-format@^29.7.0:
62726268
version "29.7.0"
62736269
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
62746270
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /