Repository: wix/Detox
Pull request #3995 (2023-03-23 01:05:50)

Update project-setup.mdx
To clarify setup, as currently it's very easy for your eyes to just see the google() portion and put it in the wrong place. Spent 2 days struggling with this, and others have too. https://github.com/wix/Detox/issues/3973

## Description

<!--
Thank you for contributing!

Step 1: Before submitting a pull request that introduces a new functionality or fixes a bug,
please open an issue where we could discuss the suggestion, problem - and potential ways to fix.
-->

- This pull request addresses the issue described here: #3973 

<!--
Step 2: Provide an overview of how your fix / enhancement works.
If possible, provide screenshots of the before and after states (even for simple command line options - show the terminal).
-->

In this pull request, I have …

<!--
Step 3: Please review the checklist below.
-->

---


> _For features/enhancements:_
 - [x] I have added/updated the relevant references in the [documentation](https://github.com/wix/Detox/tree/master/docs) files.

> _For API changes:_
 - [ ] I have made the necessary changes in the [types index](https://github.com/wix/Detox/blob/master/detox/index.d.ts) file.



Patch:
diff --git a/detox/package.json b/detox/package.json
index fc4ff86fe..dbda34148 100644
--- a/detox/package.json
+++ b/detox/package.json
@@ -61,7 +61,7 @@
     "bunyan": "^1.8.12",
     "bunyan-debug-stream": "^3.1.0",
     "caf": "^15.0.1",
-    "chalk": "^2.4.2",
+    "chalk": "^4.0.0",
     "child-process-promise": "^2.2.0",
     "execa": "^5.1.1",
     "find-up": "^4.1.0",
diff --git a/detox/src/logger/DetoxLogger.js b/detox/src/logger/DetoxLogger.js
index 042343461..57383a93b 100644
--- a/detox/src/logger/DetoxLogger.js
+++ b/detox/src/logger/DetoxLogger.js
@@ -310,19 +310,19 @@ class DetoxLogger {
   /** @internal */
   static defaultOptions({ level }) {
     const ph = level === 'trace' || level === 'debug'
-      ? value => require('chalk').default.grey(value) + ' '
-      : value => require('chalk').default.grey(value);
+      ? value => require('chalk').grey(value) + ' '
+      : value => require('chalk').grey(value);
 
     const id = level === 'trace'
-      ? value => require('chalk').default.yellow(`@${value}`)
+      ? value => require('chalk').yellow(`@${value}`)
       : undefined;
 
     const cat = level === 'trace' || level === 'debug'
-      ? (value) => require('chalk').default.yellow(`${value}`.split(',', 1)[0])
+      ? (value) => require('chalk').yellow(`${value}`.split(',', 1)[0])
       : undefined;
 
     const event = level === 'trace' || level === 'debug'
-      ? (value) => require('chalk').default.grey(`:${value}`)
+      ? (value) => require('chalk').grey(`:${value}`)
       : undefined;
 
     const identity = x => x;
diff --git a/docs/introduction/project-setup.mdx b/docs/introduction/project-setup.mdx
index 1b8c9a31f..7d4ae5e0c 100644
--- a/docs/introduction/project-setup.mdx
+++ b/docs/introduction/project-setup.mdx
@@ -148,6 +148,7 @@ patch or create if they are missing:
 ### 4.1. Patching build scripts
 
 Open your main build script and apply the suggested changes:
+⚠️ New android projects won't have an allprojects {} section, so it will need to be added.
 
 ```diff title="android/build.gradle"
  buildscript {
diff --git a/package.json b/package.json
index 0f87715ce..1196bf32e 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
     "registry": "https://registry.npmjs.org/"
   },
   "devDependencies": {
-    "chalk": "^2.4.2",
+    "chalk": "^4.0.0",
     "dictionary-en": "^3.1.0",
     "lerna": "3.22.1",
     "lodash": "4.17.x",


Test patch:
diff --git a/detox/runners/jest/testEnvironment/listeners/SpecReporter.js b/detox/runners/jest/testEnvironment/listeners/SpecReporter.js
index df2b13b7a..169daa34c 100644
--- a/detox/runners/jest/testEnvironment/listeners/SpecReporter.js
+++ b/detox/runners/jest/testEnvironment/listeners/SpecReporter.js
@@ -1,4 +1,4 @@
-const chalk = require('chalk').default;
+const chalk = require('chalk');
 const noop = require('lodash/noop');
 
 const { config, log, session } = require('../../../../internals');
diff --git a/detox/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js b/detox/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js
index 3c31654be..815537f43 100644
--- a/detox/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js
+++ b/detox/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js
@@ -1,6 +1,6 @@
 const path = require('path');
 
-const chalk = require('chalk').default;
+const chalk = require('chalk');
 const _ = require('lodash');
 
 const { device } = require('../../../..');