Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/config/browsers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,60 @@ The section has the following parameters:
will be disabled.
</td>
</tr>
<tr>
<td>`mapDependencyRelativePath`</td>
<td>`null | (dependency: { scope: "browser" | "testplane", relativePath: string }) => string | void`</td>
<td>`null`</td>
<td>
Callback, which accepts test dependency path in POSIX style and maps it to another path
or filters it completely if `falsy` value is returned
</td>
</tr>
</tbody>
</table>

### `mapDependencyRelativePath` examples {#mapDependencyRelativePath_examples}

#### Ignore Next.js internal dependencies {#mapDependencyRelativePath_example_nextjs}

```ts
{
selectivity: {
enabled: true,
mapDependencyRelativePath({relativePath}) {
if (relativePath.startsWith("turbopack://")) {
return;
}

return relativePath;
},
}
}
```

#### Usage with @testplane/storybook plugin {#mapDependencyRelativePath_example_testplane_storybook}

```ts
{
selectivity: {
enabled: true,
mapDependencyRelativePath({relativePath}) {
// Testplane storybook autogenerated tests
if (relativePath.includes("/testplane-storybook-autogenerated/")) {
return;
}

// Storybook fake dependencies
if (relativePath === "storybook-stories.js" || relativePath === "storybook-config-entry.js") {
return;
}

return relativePath;
},
}
}
```

<Admonition type="info">
You should not specify `node_modules` in `disableSelectivityPatterns`, as this will cause a
significant slowdown. Instead, it is recommended to specify Testplane configuration files and
Expand Down
51 changes: 51 additions & 0 deletions i18n/ru/docusaurus-plugin-content-docs/current/config/browsers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,60 @@ export = {
Список паттернов, при изменении файлов по которым селективность должна отключаться.
</td>
</tr>
<tr>
<td>`mapDependencyRelativePath`</td>
<td>`null | (dependency: { scope: "browser" | "testplane", relativePath: string }) => string | void`</td>
<td>`null`</td>
<td>
Коллбэк, который принимает путь зависимости теста в стиле POSIX и преобразует его в другой путь
или полностью игнорирует зависимость, если возвращено `falsy` значение
</td>
</tr>
</tbody>
</table>

### Примеры `mapDependencyRelativePath` {#mapDependencyRelativePath_examples}

#### Игнорирование внутренних зависимостей Next.js {#mapDependencyRelativePath_example_nextjs}

```ts
{
selectivity: {
enabled: true,
mapDependencyRelativePath({relativePath}) {
if (relativePath.startsWith("turbopack://")) {
return;
}

return relativePath;
},
}
}
```

#### Использование с плагином @testplane/storybook {#mapDependencyRelativePath_example_testplane_storybook}

```ts
{
selectivity: {
enabled: true,
mapDependencyRelativePath({relativePath}) {
// Автогенерированные тесты testplane storybook
if (relativePath.includes("/testplane-storybook-autogenerated/")) {
return;
}

// Фиктивные зависимости Storybook
if (relativePath === "storybook-stories.js" || relativePath === "storybook-config-entry.js") {
return;
}

return relativePath;
},
}
}
```

<Admonition type="info">
В `disableSelectivityPatterns` не стоит указывать `node_modules` - это приведет к ощутимому
замедлению. Вместо этого, рекомендуется указать конфигурационные файлы Testplane и исходный код
Expand Down