相关疑难解决方法(0)

在mocha测试中使用webpack别名

我正在开发一个在React/Redux/Webpack中工作的Web应用程序,现在我开始将测试与Mocha集成.

我按照Redux文档中的编写测试说明进行操作,但现在我遇到了webpack别名的问题.

例如,请查看我的一个动作创建者的此测试的导入部分:

import expect       from 'expect'                 // resolves without an issue
import * as actions from 'actions/app';           // can't resolve this alias
import * as types   from 'constants/actionTypes'; // can't resolve this alias

describe('Actions', () => {
  describe('app',() => {
    it('should create an action with a successful connection', () => {

      const host = '***************',
            port = ****,
            db = '******',
            user = '*********',
            pass = '******';

      const action = actions.createConnection(host, port, db, user, pass);

      const expectedAction …
Run Code Online (Sandbox Code Playgroud)

mocha.js npm reactjs webpack redux

50
推荐指数
3
解决办法
1万
查看次数

标签 统计

mocha.js ×1

npm ×1

reactjs ×1

redux ×1

webpack ×1