Skip to content

Commit a7e439f

Browse files
committed
add runInParent for plagins
1 parent c03ae5c commit a7e439f

7 files changed

Lines changed: 18 additions & 1 deletion

File tree

lib/container.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,14 @@ async function createPlugins(config, options = {}) {
674674

675675
// Use async loading for all plugins (ESM and CJS)
676676
plugins[pluginName] = await loadPluginAsync(module, config[pluginName])
677+
678+
// Skip loading plugin in parent process if runInParent is false
679+
if (config[pluginName].runInParent === false && process.env.RUNS_WITH_WORKERS) {
680+
delete plugins[pluginName]
681+
debug(`plugin ${pluginName} skipped in parent process (runInParent: false)`)
682+
continue
683+
}
684+
677685
debug(`plugin ${pluginName} loaded via async import`)
678686
} catch (err) {
679687
throw new Error(`Could not load plugin ${pluginName} from module '${module}':\n${err.message}\n${err.stack}`)

lib/plugin/autoDelay.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const defaultConfig = {
1515
methods: methodsToDelay,
1616
delayBefore: 100,
1717
delayAfter: 200,
18+
runInParent: false,
1819
}
1920

2021
/**

lib/plugin/htmlReporter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const defaultConfig = {
2828
keepHistory: false,
2929
historyPath: './test-history.json',
3030
maxHistoryEntries: 50,
31+
runInParent: true,
3132
}
3233

3334
/**

lib/plugin/pauseOnFail.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ import pause from '../pause.js'
2222
* ```
2323
*
2424
*/
25-
export default function() {
25+
const defaultConfig = {
26+
runInParent: false,
27+
}
28+
29+
export default function(config) {
2630
let failed = false
2731

2832
event.dispatcher.on(event.test.started, () => {

lib/plugin/retryFailedStep.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const defaultConfig = {
99
defaultIgnoredSteps: ['amOnPage', 'wait*', 'send*', 'execute*', 'run*', 'have*'],
1010
factor: 1.5,
1111
ignoredSteps: [],
12+
runInParent: false,
1213
}
1314

1415
/**

lib/plugin/screenshotOnFail.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const defaultConfig = {
1717
uniqueScreenshotNames: false,
1818
disableScreenshots: false,
1919
fullPageScreenshots: false,
20+
runInParent: false,
2021
}
2122

2223
const supportedHelpers = Container.STANDARD_ACTING_HELPERS

lib/plugin/stepTimeout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const defaultConfig = {
77
overrideStepLimits: false,
88
noTimeoutSteps: ['amOnPage', 'wait*'],
99
customTimeoutSteps: [],
10+
runInParent: false,
1011
}
1112

1213
/**

0 commit comments

Comments
 (0)