Repository: jestjs/jest (TypeScript)

Issue:
[Bug]: `testEnvironmentOptions` documentation/types are wrong
### Version

27.2.2

### Steps to reproduce

1. define a custom environment, eg.
    ```ts
    class CustomEnvironment extends NodeEnvironment {
        constructor(config) {
            super(config)
            const options = config.testEnvironmentOptions //type is Record<string, unknown>
            console.log(typeof options)
        }
    }
    ```
    (this step propbably isn't necessary to reproduce the issue but makes it easier to see the problem)
2. run `jest -h`
    ```
          --testEnvironmentOptions      Test environment options that will be passed
                                        to the testEnvironment. The relevant options
                                        depend on the environment.          [string]
    ```
    notice the type `string`
3. pass a value to `--testEnvironmentOptions`, assuming it gets `JSON.parse`d into a `Record`: 
    ```
    jest --testEnvironmentOptions="{ foo: 'bar' }"
    ```

### Expected behavior

if the type passed in the cli is `string`but the type in ts is `Record<string, unknown>`, i'd expect it to parse the JSON into a `Record` or something. therefore, the `console.log` from the custom environment's constructor outputs `"object"`

### Actual behavior

the `console.log` from the custom environment's constructor outputs `"string"`

### Additional context

`testEnvironmentOptions` isn't even present [here](https://jestjs.io/docs/cli). are you even supposed to be able to pass it in the command line?

### Environment

```shell
System:
    OS: Windows 10 10.0.18363
    CPU: (6) x64 Intel(R) Core(TM) i5-8600 CPU @ 3.10GHz
  Binaries:
    Node: 16.9.1 - C:\Program Files\nodejs\node.EXE
    npm: 7.24.1 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^27.2.2 => 27.2.2
```



Hints:

Patch:
diff --git a/packages/jest-cli/src/cli/args.ts b/packages/jest-cli/src/cli/args.ts
--- a/packages/jest-cli/src/cli/args.ts
+++ b/packages/jest-cli/src/cli/args.ts
@@ -549,9 +549,9 @@ export const options = {
   },
   testEnvironmentOptions: {
     description:
-      'Test environment options that will be passed to the testEnvironment. ' +
+      'A JSON string with options that will be passed to the `testEnvironment`. ' +
       'The relevant options depend on the environment.',
-    type: 'string', // Object
+    type: 'string',
   },
   testFailureExitCode: {
     description: 'Exit code of `jest` command if the test run failed',
diff --git a/packages/jest-config/src/setFromArgv.ts b/packages/jest-config/src/setFromArgv.ts
--- a/packages/jest-config/src/setFromArgv.ts
+++ b/packages/jest-config/src/setFromArgv.ts
@@ -35,9 +35,10 @@ export default function setFromArgv(
           break;
         case 'coverageThreshold':
         case 'globals':
+        case 'haste':
         case 'moduleNameMapper':
+        case 'testEnvironmentOptions':
         case 'transform':
-        case 'haste':
           const str = argv[key];
           if (isJSONString(str)) {
             options[key] = JSON.parse(str);
diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts
--- a/packages/jest-types/src/Config.ts
+++ b/packages/jest-types/src/Config.ts
@@ -462,6 +462,7 @@ export type Argv = Arguments<
     silent: boolean;
     snapshotSerializers: Array<string>;
     testEnvironment: string;
+    testEnvironmentOptions: string;
     testFailureExitCode: string | null | undefined;
     testMatch: Array<string>;
     testNamePattern: string;


Test patch:
diff --git a/packages/jest-config/src/__tests__/setFromArgv.test.ts b/packages/jest-config/src/__tests__/setFromArgv.test.ts
--- a/packages/jest-config/src/__tests__/setFromArgv.test.ts
+++ b/packages/jest-config/src/__tests__/setFromArgv.test.ts
@@ -47,6 +47,7 @@ test('works with string objects', () => {
   const argv = {
     moduleNameMapper:
       '{"types/(.*)": "<rootDir>/src/types/$1", "types2/(.*)": ["<rootDir>/src/types2/$1", "<rootDir>/src/types3/$1"]}',
+    testEnvironmentOptions: '{"userAgent": "Agent/007"}',
     transform: '{"*.js": "<rootDir>/transformer"}',
   } as Config.Argv;
   expect(setFromArgv(options, argv)).toMatchObject({
@@ -54,6 +55,9 @@ test('works with string objects', () => {
       'types/(.*)': '<rootDir>/src/types/$1',
       'types2/(.*)': ['<rootDir>/src/types2/$1', '<rootDir>/src/types3/$1'],
     },
+    testEnvironmentOptions: {
+      userAgent: 'Agent/007',
+    },
     transform: {
       '*.js': '<rootDir>/transformer',
     },