Skip to content

Commit 322c0de

Browse files
authored
[MOB-10126] Improve Test Files Structure (#784)
* Change test directory name to `tests` * Change `tests` directory structure so it mirrors `src` structure * Move mocks to `tests/mocks` instead of `tests/jest` * Move setup code into `setup-tests.js` * Use recommended native modules mocking technique * Move `InstabugUtils` tests to root tests directory * Remove example app unit tests * Change `Platform.constants ??=` to an if check * Rename all `NativeIBG*` to `Native*` in tests * Rename `__e2e__` to `e2e` and follow file naming convention * Rename `setup-tests.js` to `setup.js`
1 parent 243cdd5 commit 322c0de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+988
-1259
lines changed

.circleci/config.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,6 @@ jobs:
4444
- store_artifacts:
4545
path: test-results
4646

47-
test_sample:
48-
working_directory: ~/project
49-
docker:
50-
- image: circleci/node:lts
51-
steps:
52-
- checkout:
53-
path: ~/project
54-
- run: yarn
55-
- run: cd example && yarn install
56-
57-
- run:
58-
name: jest tests
59-
command: |
60-
cd example
61-
mkdir -p test-results/jest
62-
yarn test
63-
environment:
64-
JEST_JUNIT_OUTPUT: test-results/jest/junit.xml
65-
66-
- persist_to_workspace:
67-
root: ~/project
68-
paths:
69-
- example/node_modules
70-
71-
- store_test_results:
72-
path: example/test-results
73-
74-
- store_artifacts:
75-
path: example/test-results
76-
7747
test_android:
7848
executor:
7949
name: android/android-machine
@@ -229,7 +199,6 @@ workflows:
229199
jobs:
230200
- danger
231201
- test_module
232-
- test_sample
233202
- test_android
234203
- validate_shell_files
235204
- sync_generated_files
@@ -239,7 +208,6 @@ workflows:
239208
- hold:
240209
requires:
241210
- test_module
242-
- test_sample
243211
- test_android
244212
- validate_shell_files
245213
- sync_generated_files

example/.detoxrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"test-runner": "jest",
3-
"runner-config": "__e2e__/config.json",
3+
"runner-config": "e2e/config.json",
44
"configurations": {
55
"ios.sim.debug": {
66
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/InstabugSample.app",

example/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
extends: '@react-native-community',
44
overrides: [
55
{
6-
files: ['__e2e__/**.js'],
6+
files: ['e2e/**.js'],
77
env: { jest: true },
88
globals: {
99
device: false,

example/__tests__/instabugUtils.spec.js

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getElement } from './utils/elements';
2-
import mockData from './utils/mock-data';
2+
import mockData from './utils/mockData';
33

44
beforeEach(async () => {
55
await device.launchApp();

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"android": "npx react-native run-android",
77
"ios": "npx react-native run-ios",
88
"start": "react-native start",
9-
"test": "jest __tests__",
109
"lint": "eslint ."
1110
},
1211
"dependencies": {

0 commit comments

Comments
 (0)