我对摩卡有意见。如果我从杰克·摩卡刹车开始运行这个程序,只会显示一些错误,比如:
AssertionError: There is a code 200 in response
at Socket.<anonymous> (/home/X/Y/Z/test/test_Server.js:70:4)
at Socket.EventEmitter.emit (events.js:93:17)
at TCP.onread (net.js:418:51)
从命令行运行将提供更多的预期结果。这就是:
19 passing (30ms)
7 failing
1
我对Javascript,node.js和mocha都是新手。在查看基本示例时,我遇到了一个空函数" function ()“。使用empty函数的目的是什么?
var assert = require('assert'),
var test = require('selenium-webdriver/testing'),
var webdriver = require('selenium-webdriver');
test.describe('Google Search', function() {
test.it
我正在用nighwatch.js,selenium和色度驱动器运行摩卡
我能够使用describe运行,但是我正在进行动态测试,所以我需要使用下面的方式来调用,但是我无法让mocha以这样的方式运行
"use strict";
var nightwatch = require('nightwatch');
var Mocha = require('mocha');
var Test = Mocha.Test;
var Suite = Mocha.Suite;
var mocha = new Mocha();
var suite = Suit
我有一套测试,其中包含带有setInterval(...)调用的代码。
当通过windows powershell命令行在mocha中运行此代码时,所有测试都将运行,但测试运行程序将在之后无限期挂起。
我使用的命令是mocha "./unitTests/**/*.js"
有没有办法迫使测试跑者关闭?
或者,是否有一种方法可以确定代码是否运行在测试环境中,以便我可以禁用setInterval(...)调用?
示例代码:
// MODULE TO TEST
setInterval(function(){
// do cleanup task
}, 1000000);
fu
我正在使用类型记录,使用Mocha并尝试使用ES6异步/等待生成器。
这是我的密码:
"use strict";
import * as console from 'console';
import { Config } from './Config';
import * as assert from 'assert';
import * as mocha from 'mocha';
import fetch from 'node-fetch';
async function createExch
我试图了解Mocha的异步代码(在上)是如何工作的。
describe('User', function() {
describe('#save()', function() {
it('should save without error', function(done) {
var user = new User('Luna');
user.save(function(err) {
if (err) throw err;
done();
});
尝试在我的mongoDB数据库中插入新元素时,当我使用终端'npm运行测试‘时,它会给出以下错误:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure
"done()" is called; if returning a Promise, ensure it resolves.
下面是将元素保存到DB中的代码:
const mocha = require('mocha');
const assert = require('assert');
const
我已经编写了一些测试用例,并且正在尝试使用mocha和node debug来调试测试用例。
我在我的机器上安装了mocha
我安装了node-debug npm install -g node-debug
然后,我使用以下命令运行测试:node-debug _mocha test.js
这将打开一个浏览器窗口,但我收到以下错误
Detached from the target
Remote debugging has been terminated with reason: Error: connect ECONNREFUSED. Is node running with --debug p