Skip to content

Commit 492d76b

Browse files
author
DavertMik
committed
fix register retryTo globally
1 parent 386deea commit 492d76b

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

lib/plugin/retryTo.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
const { retryTo } = require('../effects')
22

3-
module.exports = function (config) {
4-
console.log(`
5-
Deprecation Warning: 'retryTo' has been moved to the effects module.
6-
You should update your tests to use it as follows:
7-
8-
\`\`\`javascript
9-
const { retryTo } = require('codeceptjs/effects');
10-
11-
// Example: Retry these steps 5 times before failing
12-
await retryTo((tryNum) => {
13-
I.switchTo('#editor frame');
14-
I.click('Open');
15-
I.see('Opened');
16-
}, 5);
17-
\`\`\`
3+
const defaultConfig = {
4+
registerGlobal: true,
5+
}
186

19-
For more details, refer to the documentation.
20-
`)
7+
module.exports = function (config) {
8+
config = Object.assign(defaultConfig, config)
9+
console.log(`Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module`)
2110

2211
if (config.registerGlobal) {
2312
global.retryTo = retryTo

lib/plugin/tryTo.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
const { tryTo } = require('../effects')
22

3-
module.exports = function (config) {
4-
console.log(`
5-
Deprecated Warning: 'tryTo' has been moved to the effects module.
6-
You should update your tests to use it as follows:
7-
8-
\`\`\`javascript
9-
const { tryTo } = require('codeceptjs/effects');
10-
11-
// Example: failed step won't fail a test but will return true/false
12-
await tryTo(() => {
13-
I.switchTo('#editor frame');
14-
});
15-
\`\`\`
3+
const defaultConfig = {
4+
registerGlobal: true,
5+
}
166

17-
For more details, refer to the documentation.
18-
`)
7+
module.exports = function (config) {
8+
config = Object.assign(defaultConfig, config)
9+
console.log(`Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module`)
1910

2011
if (config.registerGlobal) {
2112
global.tryTo = tryTo

0 commit comments

Comments
 (0)