我正在尝试将一个div集中,这是用于HTML5/JavaScript的Windows 8应用程序的Microsoft pubCenter AdControl.
<div id="myAd" style="; top: 0%; width: 292px; height: 60px; z-index: 1"
data-win-control="MicrosoftNSJS.Advertising.AdControl"
data-win-options="{applicationId: 'exampleAdId', adUnitId: 'exampleAdUnit'}">
</div>
Run Code Online (Sandbox Code Playgroud)
如何将div水平居中,使其始终位于页面中间?
让我举个例子。
before(function (done)
{
...
testUtils.someInitWork(done);
});
testUtils = {
someInitWork: function (done)
{
...
if (e)
// wrap the error into another error object and add contextual information.
e2 = errorManager.getError('myerror', e, { context: "more context for the error });
}
};
Run Code Online (Sandbox Code Playgroud)
当测试初始化代码在 util 函数的深处失败时,它会将所需的上下文信息传递到错误对象中。这个错误对象最终会传递给 before 的 done 回调。mocha 在控制台上打印错误消息(我使用的是记者规范)。相反,如果我可以打印它util.inspect(e)
- 该信息对于调试问题将更有用。
当然,我可以修改测试代码打印出来。但是有没有办法修改 mocha 在控制台上报告错误(传递给回调之前)的方式?