You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: actions/shared/index.cjs
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4209,16 +4209,28 @@ var coerce = {
4209
4209
varNEVER=INVALID;
4210
4210
4211
4211
// ../config/dist/types.js
4212
+
varRunnerSchema=external_exports.object({
4213
+
name: external_exports.string().min(1,"Runner name is required").regex(/^[a-zA-Z0-9._-]+$/,"Runner name can only contain alphanumeric characters, dots, underscores, and hyphens"),
crashDetectionInterval: external_exports.number().min(100,"Crash detection interval must be at least 100ms").default(500),
4231
+
coverage: external_exports.object({
4232
+
root: external_exports.string().optional().describe(`Root directory for coverage instrumentation in monorepo setups. Specifies the directory from which coverage data should be collected. Use ".." for create-react-native-library projects where tests run from example/ but source files are in parent directory. Passed to babel-plugin-istanbul's cwd option.`)
4233
+
}).optional(),
4222
4234
// Deprecated property - used for migration detection
Copy file name to clipboardExpand all lines: website/src/docs/getting-started/configuration.mdx
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,9 @@ For Expo projects, the `entryPoint` should be set to the path specified in the `
103
103
104
104
// Optional: Reset environment between test files (default: true)
105
105
resetEnvironmentBetweenTestFiles?:boolean;
106
+
107
+
// Optional: Root directory for coverage instrumentation in monorepos (default: process.cwd())
108
+
coverageRoot?:string;
106
109
}
107
110
```
108
111
@@ -324,6 +327,30 @@ const config = {
324
327
exportdefaultconfig;
325
328
```
326
329
330
+
## Coverage Root
331
+
332
+
The coverage root option specifies the root directory for coverage instrumentation in monorepository setups. This is particularly important when your tests run from a different directory than where your source files are located.
333
+
334
+
```javascript
335
+
{
336
+
coverageRoot:'../', // Use parent directory as coverage root
337
+
}
338
+
```
339
+
340
+
**Default:**`process.cwd()` (current working directory)
341
+
342
+
This option is passed to babel-plugin-istanbul's `cwd` option and ensures that coverage data is collected correctly in monorepo scenarios where:
343
+
344
+
- Tests run from an `example/` directory but source files are in `../src/`
345
+
- Libraries are structured with separate test and source directories
346
+
- Projects have nested directory structures that don't align with the current working directory
347
+
348
+
Without specifying `coverageRoot`, babel-plugin-istanbul may skip instrumenting files outside the current working directory, resulting in incomplete coverage reports.
349
+
350
+
:::tip When to use coverageRoot
351
+
Set `coverageRoot` when you notice 0% coverage in your reports or when source files are not being instrumented for coverage. This commonly occurs in create-react-native-library projects and other monorepo setups.
0 commit comments