Skip to content

Commit

Permalink
build(deps): upgrade & migrate to detox 20
Browse files Browse the repository at this point in the history
IOS detox tests kept failing due to this issue
wix/Detox#4148.

Upgrading resolves the issue and things are bit faster now!
  • Loading branch information
thomas-pearson-mattr committed Dec 9, 2024
1 parent f4a6f98 commit 1e6c1c8
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 120 deletions.
18 changes: 15 additions & 3 deletions wrappers/react-native/example/.detoxrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"testRunner": "jest",
"runnerConfig": "jest.config.js",
"skipLegacyWorkersInjection": true,
"testRunner": {
"$0": "jest",
"args": {
"config": "jest.config.js",
"_": [
"e2e"
]
},
"forwardEnv": true
},
"jest": {
"setupTimeout": 120000,
"reportSpecs": false,
"reportWorkerAssign": false
},
"apps": {
"ios.release": {
"name": "PairingCryptoRnExample",
Expand Down
25 changes: 13 additions & 12 deletions wrappers/react-native/example/__tests__/detox-environment.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
const { DetoxCircusEnvironment, SpecReporter, WorkerAssignReporter } = require('detox/runners/jest-circus');
/*
* Copyright 2022 - MATTR Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const { DetoxCircusEnvironment, SpecReporter, WorkerAssignReporter } = require('detox/runners/jest');
const { FixturesEnvName, readFixtureFiles } = require('../__fixtures__/fixture-loader');

class CustomDetoxEnvironment extends DetoxCircusEnvironment {
constructor(config, context) {
super(config, context);

// Can be safely removed, if you are content with the default value (=300000ms)
// this.initTimeout = 300000;
this.initTimeout = 900000;

// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
// This is strictly optional.
this.registerListeners({
SpecReporter,
WorkerAssignReporter,
});
}

async setup() {
Expand Down
22 changes: 18 additions & 4 deletions wrappers/react-native/example/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
/*
* Copyright 2022 - MATTR Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const package = require('./package.json');

module.exports = {
displayName: package.name,
preset: 'react-native',
reporters: ['detox/runners/jest/streamlineReporter'],
maxWorkers: 1,
testTimeout: 120000,
verbose: true,
reporters: ['detox/runners/jest/reporter'],
globalSetup: 'detox/runners/jest/globalSetup',
globalTeardown: 'detox/runners/jest/globalTeardown',
testEnvironment: './__tests__/detox-environment',
testRunner: 'jest-circus/runner',
testTimeout: 20000,
testMatch: ['**/*.e2e.ts'],
testPathIgnorePatterns: ['/node_modules/', '/lib/'],
verbose: true,
collectCoverage: true,
coverageDirectory: './jest_results/coverage/',
coverageReporters: [['lcov', { projectRoot: '../' }], 'text'],
Expand Down
14 changes: 7 additions & 7 deletions wrappers/react-native/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
"@types/node": "16.11.7",
"@types/ramda": "0.28.18",
"babel-plugin-module-resolver": "4.1.0",
"detox": "19.12.6",
"detox": "20.28.0",
"jest": "29.2.1",
"metro-react-native-babel-preset": "0.73.2",
"patch-package": "6.4.7",
"pod-install": "0.1.38",
"postinstall-postinstall": "2.1.0",
"typescript": "4.5.5",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.12",
"@tsconfig/react-native": "^3.0.0",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1"
"@react-native/eslint-config": "0.72.2",
"@react-native/metro-config": "0.72.12",
"@tsconfig/react-native": "3.0.0",
"@types/react": "18.0.24",
"@types/react-test-renderer": "18.0.0",
"babel-jest": "29.2.1"
},
"jest": {
"preset": "react-native",
Expand Down
Loading

0 comments on commit 1e6c1c8

Please sign in to comment.