mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-02 18:11:04 +08:00
The changes can be seen here between 8.0.1 and 8.2.1: https://github.com/mochajs/mocha/releases There are no breaking changes. The upgrade will give us the ability to use global fixtures which may speed up parallel mode. I'm also hoping this fixes a bug with describe.skip() not working properly for parallel mode. DISABLE_THIRD_PARTY_CHECK=Update Mocha Bug: chromium:1101784 Change-Id: Ia052a80c0f6dcefb1a2f21444cdfd3789a3203f8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2529149 Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org>
84 lines
1.5 KiB
JavaScript
84 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
var Runnable = require('./runnable');
|
|
const {inherits, constants} = require('./utils');
|
|
const {MOCHA_ID_PROP_NAME} = constants;
|
|
|
|
/**
|
|
* Expose `Hook`.
|
|
*/
|
|
|
|
module.exports = Hook;
|
|
|
|
/**
|
|
* Initialize a new `Hook` with the given `title` and callback `fn`
|
|
*
|
|
* @class
|
|
* @extends Runnable
|
|
* @param {String} title
|
|
* @param {Function} fn
|
|
*/
|
|
function Hook(title, fn) {
|
|
Runnable.call(this, title, fn);
|
|
this.type = 'hook';
|
|
}
|
|
|
|
/**
|
|
* Inherit from `Runnable.prototype`.
|
|
*/
|
|
inherits(Hook, Runnable);
|
|
|
|
/**
|
|
* Resets the state for a next run.
|
|
*/
|
|
Hook.prototype.reset = function() {
|
|
Runnable.prototype.reset.call(this);
|
|
delete this._error;
|
|
};
|
|
|
|
/**
|
|
* Get or set the test `err`.
|
|
*
|
|
* @memberof Hook
|
|
* @public
|
|
* @param {Error} err
|
|
* @return {Error}
|
|
*/
|
|
Hook.prototype.error = function(err) {
|
|
if (!arguments.length) {
|
|
err = this._error;
|
|
this._error = null;
|
|
return err;
|
|
}
|
|
|
|
this._error = err;
|
|
};
|
|
|
|
/**
|
|
* Returns an object suitable for IPC.
|
|
* Functions are represented by keys beginning with `$$`.
|
|
* @private
|
|
* @returns {Object}
|
|
*/
|
|
Hook.prototype.serialize = function serialize() {
|
|
return {
|
|
$$isPending: this.isPending(),
|
|
$$titlePath: this.titlePath(),
|
|
ctx:
|
|
this.ctx && this.ctx.currentTest
|
|
? {
|
|
currentTest: {
|
|
title: this.ctx.currentTest.title,
|
|
[MOCHA_ID_PROP_NAME]: this.ctx.currentTest.id
|
|
}
|
|
}
|
|
: {},
|
|
parent: {
|
|
[MOCHA_ID_PROP_NAME]: this.parent.id
|
|
},
|
|
title: this.title,
|
|
type: this.type,
|
|
[MOCHA_ID_PROP_NAME]: this.id
|
|
};
|
|
};
|