mocha

    0热度

    1回答

    我想写采用摩卡框架测试,并具备此功能 this.checkReorder = function () { var result = []; this.products.forEach(function (p) { if (p.quantity <= p.reorder_level) { result.push(p) ; } })

    3热度

    1回答

    我正在测试一个nodejs应用程序。当我运行测试时发现这个错误。测试脚本如下: .expect((res) => { expect(res.headers['x-auth']).toExist(); expect(res.body._id).toExist(); expect(res.body.email).toBe(email); }) 错误显示: TypeE

    2热度

    1回答

    我正在使用Mocha测试以es6阶段0语法编写的react/webpack/babel应用程序,其中包括dynamic imports。的WebPack编译它没有错误,但达到一个动态的导入语法时摩卡引发以下错误: import('path/to/file').then(...) ^^^^^^ SyntaxError: Unexpected token import 是我跑的命令是: $ m

    0热度

    1回答

    也有类似的问题,但似乎并没有明确的答案,大多数答案都是旧的并且已被弃用。这就是为什么我问这个。 所以我有这样 // B2CPopup_methods_test.js import './domTestsHelper' import { expect } from 'chai' import newB2CPopup from './popupFromDbBoilerplate' descr

    0热度

    1回答

    运行应用程序时我没有得到,它只发生在我运行测试时。基本上我现在写了快照测试。 TypeError: Cannot read property 'length' of undefined at Papertype.render (src/components/layoutcomponents/papertype.js:50:23) 以下是在papertype.js import React, { C

    0热度

    1回答

    我正在编写邮件钩子测试。一旦保存了user,我们将其他信息另存为单独的集合。我想验证细节是否保存在第二个集合中。由于钩子异步执行,我无法验证它。 userSchema.post('save', function(user, next){ var filter = new filterModel({name: user.name}); filter.save().then(()=

    0热度

    1回答

    处理任何形式的错误/断言错误的正确方法是什么,以便当一个测试用例失败时,后续测试仍然运行?或者在1个JavaScript文件中只有1个测试用例对我更好些? describe('SMP Service Login Page', function() { describe('Loggin in', function() { // Unhappy flow always first

    0热度

    1回答

    我有这样的结构的测试文件: describe('Client A', function() { describe("Scenario 1", function() {...}); describe("Scenario 2", function() {...}); : : }); describe('Client B', function() {

    0热度

    1回答

    我想模拟一个ES6类的方法。 我进口车型模块: // test.js const models = require(path.resolve('./models')); 在模型文件夹中有一个index.js并同时呼吁models.user并重定向到用户文件夹index.js: // models/index.js models.user = user; 然后我在index.js用户等级

    3热度

    1回答

    我在尝试应用酶时遇到此错误,但无法找到任何相关问题。 这里是test.js; import React from 'react'; import AccountLoginForm from './LoginPage'; import sinon from 'sinon'; import { mount, shallow, configure } from 'enzyme'; import