首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >流星/用酶反应摩卡测试-找不到模块'has‘

流星/用酶反应摩卡测试-找不到模块'has‘
EN

Stack Overflow用户
提问于 2016-06-28 07:00:05
回答 2查看 498关注 0票数 0

如前所述,我正在使用React运行Meteor应用程序,并开始用Mocha编写测试。目前,我有一个基本的测试,测试什么都没有。

client/prospects/ProspectForm.tests.jsx

代码语言:javascript
复制
import React from 'react';
import { shallow } from 'enzyme';

describe('<Foo />', () => {

  it('calls componentDidMount', () => {
  });

});

当我启动我的测试服务器时,我得到以下错误

找不到模块'has‘。看起来问题源于酶,但当我创建一个新的流星应用程序,添加酶和实际流星:摩卡,然后添加同样的测试,它的工作很好,所以它必须与我的环境在这个应用程序。

这是我的package.json

代码语言:javascript
复制
    {
  "name": "myApp",
  "private": true,
  "scripts": {
    "start": "meteor run"
  },
  "dependencies": {
    "material-ui": "^0.15.0",
    "meteor-node-stubs": "~0.2.0",
    "react": "^15.0.2",
    "react-addons-pure-render-mixin": "^15.0.1",
    "react-datepicker": "^0.27.0",
    "react-dom": "^15.0.2",
    "react-mounter": "^1.2.0",
    "react-s-alert": "^1.1.4",
    "react-tap-event-plugin": "^1.0.0"
  },
  "devDependencies": {
    "enzyme": "^2.3.0"
  }
}

这是我的流星包文件

代码语言:javascript
复制
# edgee:slingshot                         # Send files to storage service.
# peerlibrary:aws-sdk                     # Amazon SDK for S3/EC2/etc...


# CORE PACKAGES
meteor-base                               # Meteor platform
mobile-experience                         # Mobile Optimizations
logging                                   # Meteor internal logging
ejson                                     # Extends JSON Types
tracker                                   # Reactive Data Sources
email                                     # Send emails
accounts-password                         # Authentication for users.
es5-shim                                  # ECMAScript 5 compatibility for older browsers.
ecmascript                                # Enable ECMAScript2015+ syntax
standard-minifier-css                     # CSS Minification
standard-minifier-js                      # Javascript Minification
static-html                               # Adds global head tag
reload                                    # Active reload
react-meteor-data                         # Used for react data mixins

stevezhu:lodash                           # Javascript utility library.
momentjs:moment                           # Date library for Javascript.
johnantoni:meteor-normalize               # normalizes css
fourseven:scss                            # SASS stylesheets.
fortawesome:fontawesome                   # Icons.
natestrauser:animate-css                  # Animations using CSS.
mongo                                     # Mongo DB
aldeed:collection2                        # Schemas and validations for database collections.
dburles:collection-helpers                # Create data helpers in ./lib available to client and server.
meteortoys:allthings                      # A number of helpers for deveopment. Activate with control+m
kadira:flow-router                        # Router.
mystor:device-detection                   # Detect device user is using.
semantic:ui-css
practicalmeteor:mocha

有人知道这是怎么回事吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-06-28 07:50:02

如果您还没有安装这两个依赖项,则还需要安装它们:

代码语言:javascript
复制
npm i --save-dev react-addons-test-utils
npm i --save-dev react-dom

看起来你有反应,但你错过了测试用例。

票数 1
EN

Stack Overflow用户

发布于 2016-06-28 19:28:11

运行流星更新为我解决了这一问题,我也不得不照达文所说的去做。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38069179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档