Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: main
branches: [main]
pull_request:
workflow_call:

Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
nodejs: [18, 19, 20, 21, 22, 23]
nodejs: [20, 21, 22, 23, 24]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CodeQL

on:
push:
branches: main
branches: [main]
pull_request:
branches: main
branches: [main]

concurrency:
group: codeql-${{ github.ref_name }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23.11.0
24.2.0
552 changes: 273 additions & 279 deletions .yarn/releases/yarn-4.9.1.cjs → .yarn/releases/yarn-4.9.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ plugins:
path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"

yarnPath: .yarn/releases/yarn-4.9.1.cjs
yarnPath: .yarn/releases/yarn-4.9.2.cjs
49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,50 +62,51 @@
"test": "NODE_OPTIONS=\"--no-experimental-detect-module\" vitest",
"test:ci": "vitest"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].2",
"dependencies": {
"@babel/core": "^7.26.10",
"@babel/register": "^7.25.9",
"debug": "^4.4.0",
"@babel/core": "^7.27.4",
"@babel/register": "^7.27.1",
"babel-plugin-module-resolver": "^5.0.2",
"debug": "^4.4.1",
"dot-prop-immutable": "^2.1.1",
"rewiremock": "^3.14.5",
"rewiremock": "^3.14.6",
"supports-color": "^10.0.0",
"ts-pattern": "^5.7.0"
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@assertive-ts/core": "^2.1.0",
"@eslint/js": "^9.24.0",
"@react-native/babel-preset": "^0.79.1",
"@stylistic/eslint-plugin": "^4.2.0",
"@eslint/js": "^9.29.0",
"@react-native/babel-preset": "^0.80.0",
"@stylistic/eslint-plugin": "^4.4.1",
"@testing-library/react-native": "^13.2.0",
"@types/babel__core": "^7.20.5",
"@types/babel__register": "^7.17.3",
"@types/debug": "^4.1.12",
"@types/node": "^22.14.1",
"@types/react": "^19.1.2",
"@types/node": "^24.0.3",
"@types/react": "^19.1.8",
"@types/react-test-renderer": "^19.1.0",
"@types/sinon": "^17.0.4",
"eslint": "^9.24.0",
"eslint-import-resolver-typescript": "^4.3.2",
"eslint": "^9.29.0",
"eslint-import-resolver-typescript": "^4.4.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsdoc": "^50.6.9",
"eslint-plugin-perfectionist": "^4.11.0",
"eslint-plugin-jsdoc": "^51.0.1",
"eslint-plugin-perfectionist": "^4.14.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-sonarjs": "^3.0.2",
"globals": "^16.0.0",
"globals": "^16.2.0",
"react": "19.1.0",
"react-native": "^0.79.1",
"react-native-svg": "^15.11.2",
"react-native": "^0.80.0",
"react-native-svg": "^15.12.0",
"react-test-renderer": "^19.1.0",
"semantic-release": "^24.2.3",
"semantic-release": "^24.2.5",
"semantic-release-yarn": "^3.0.2",
"sinon": "^20.0.0",
"sinon": "^21.0.0",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.30.1",
"vite": "^6.2.6",
"vite-plugin-dts": "^4.5.3",
"vitest": "^3.1.1"
"typescript-eslint": "^8.34.1",
"vite": "^6.3.5",
"vite-plugin-dts": "^4.5.4",
"vitest": "^3.2.3"
},
"peerDependencies": {
"@react-native/babel-preset": ">=0.73.18",
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/mockComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export function mockComponent<P, C extends ComponentClass<PropsWithChildren<P>>>
RealComponent: C,
instanceMethods?: AllNativeMethods,
): C {
const SuperClass: ComponentClass<PropsWithChildren<P>> = typeof RealComponent === "function"
const isFunction = typeof RealComponent === "function";
const isClass = get(RealComponent.prototype, "constructor") instanceof Component;
const SuperClass: ComponentClass<PropsWithChildren<P>> = isFunction && isClass
? RealComponent
: Component;
const name = (RealComponent.displayName ?? "")
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Animated/AnimatedMock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Animated } from "react-native";

import { AnimatedValueMock } from "./AnimatedValueMock";
import { AnimatedValueXYMock } from "./AnimatedValueXY";
import { AnimatedValueXYMock } from "./AnimatedValueXYMock";

export const AnimatedMock: typeof Animated = {
...Animated,
Expand Down
20 changes: 20 additions & 0 deletions src/lib/babelRegister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,25 @@ register({
".jsx",
],
only: [/[/\\]node_modules[/\\](react-native|@react-native)[/\\]/],
plugins: [
["module-resolver", {
resolvePath(sourcePath: string) {
if (sourcePath.startsWith(".")) {
const hastePaths = [
"/Image",
"/Platform",
"/PlatformColorValueTypes",
"/BaseViewConfig",
];

return hastePaths.some(path => sourcePath.endsWith(path))
? `${sourcePath}.ios`
: undefined;
}

return undefined;
},
}],
],
presets: ["module:@react-native/babel-preset"],
});
4 changes: 2 additions & 2 deletions src/lib/mockNative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function mockNative(type: NativeKey, methods: Partial<AllNativeMethods |
.with("TextInput", () => mockComponent(Comp, Object.assign({ }, textInputMethodsMock, methods)))
.otherwise(() => mockComponent(Comp, Object.assign({ }, nativeMethodsMock, methods)));

replace(path, () => type === "ActivityIndicator" ? { default: Mock } : Mock);
replace(path, () => ({ default: Mock }));
MOCKS.add(type);
logger.replace(`Native methods mocks assigned to ${type}.`);
}
Expand All @@ -84,7 +84,7 @@ export function restoreNativeMocks(): void {
.with("TextInput", () => mockComponent(Comp, textInputMethodsMock))
.otherwise(() => mockComponent(Comp, nativeMethodsMock));

replace(path, () => type === "ActivityIndicator" ? { default: Mock } : Mock);
replace(path, () => ({ default: Mock }));
});

MOCKS.clear();
Expand Down
Loading