codeceptjs 3.7.2-beta.1 → 3.7.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/helper/WebDriver.js +0 -3
- package/lib/mocha/asyncWrapper.js +8 -4
- package/lib/mocha/suite.js +1 -0
- package/lib/mocha/test.js +2 -0
- package/package.json +1 -1
package/lib/helper/WebDriver.js
CHANGED
|
@@ -488,9 +488,6 @@ class WebDriver extends Helper {
|
|
|
488
488
|
config.capabilities = config.desiredCapabilities
|
|
489
489
|
}
|
|
490
490
|
config.capabilities.browserName = config.browser || config.capabilities.browserName
|
|
491
|
-
|
|
492
|
-
config.capabilities.webSocketUrl = config.webSocketUrl || config.capabilities.webSocketUrl || true
|
|
493
|
-
|
|
494
491
|
config.capabilities.browserVersion = config.browserVersion || config.capabilities.browserVersion
|
|
495
492
|
if (config.capabilities.chromeOptions) {
|
|
496
493
|
config.capabilities['goog:chromeOptions'] = config.capabilities.chromeOptions
|
|
@@ -187,30 +187,34 @@ module.exports.injected = function (fn, suite, hookName) {
|
|
|
187
187
|
* Starts promise chain, so helpers could enqueue their hooks
|
|
188
188
|
*/
|
|
189
189
|
module.exports.setup = function (suite) {
|
|
190
|
+
const { enhanceMochaTest } = require('./test')
|
|
190
191
|
return injectHook(() => {
|
|
191
192
|
recorder.startUnlessRunning()
|
|
192
|
-
event.emit(event.test.before, suite
|
|
193
|
+
event.emit(event.test.before, enhanceMochaTest(suite?.ctx?.currentTest))
|
|
193
194
|
}, suite)
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
module.exports.teardown = function (suite) {
|
|
198
|
+
const { enhanceMochaTest } = require('./test')
|
|
197
199
|
return injectHook(() => {
|
|
198
200
|
recorder.startUnlessRunning()
|
|
199
|
-
event.emit(event.test.after, suite
|
|
201
|
+
event.emit(event.test.after, enhanceMochaTest(suite?.ctx?.currentTest))
|
|
200
202
|
}, suite)
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
module.exports.suiteSetup = function (suite) {
|
|
206
|
+
const { enhanceMochaSuite } = require('./suite')
|
|
204
207
|
return injectHook(() => {
|
|
205
208
|
recorder.startUnlessRunning()
|
|
206
|
-
event.emit(event.suite.before, suite)
|
|
209
|
+
event.emit(event.suite.before, enhanceMochaSuite(suite))
|
|
207
210
|
}, suite)
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
module.exports.suiteTeardown = function (suite) {
|
|
214
|
+
const { enhanceMochaSuite } = require('./suite')
|
|
211
215
|
return injectHook(() => {
|
|
212
216
|
recorder.startUnlessRunning()
|
|
213
|
-
event.emit(event.suite.after, suite)
|
|
217
|
+
event.emit(event.suite.after, enhanceMochaSuite(suite))
|
|
214
218
|
}, suite)
|
|
215
219
|
}
|
|
216
220
|
|
package/lib/mocha/suite.js
CHANGED
|
@@ -7,6 +7,7 @@ const MochaSuite = require('mocha/lib/suite')
|
|
|
7
7
|
* Enhances MochaSuite with CodeceptJS specific functionality using composition
|
|
8
8
|
*/
|
|
9
9
|
function enhanceMochaSuite(suite) {
|
|
10
|
+
if (!suite) suite = new MochaSuite('Suite', null, false)
|
|
10
11
|
// already enhanced
|
|
11
12
|
if (suite.codeceptjs) return suite
|
|
12
13
|
|
package/lib/mocha/test.js
CHANGED
|
@@ -21,6 +21,8 @@ function createTest(title, fn) {
|
|
|
21
21
|
* @returns {CodeceptJS.Test & Mocha.Test} Enhanced test instance
|
|
22
22
|
*/
|
|
23
23
|
function enhanceMochaTest(test) {
|
|
24
|
+
// if no test, create a dummy one
|
|
25
|
+
if (!test) test = createTest('...', () => {})
|
|
24
26
|
// already enhanced
|
|
25
27
|
if (test.codeceptjs) return test
|
|
26
28
|
|