(NodeJS)Jest在导入关键字之前检测到方括号

时间:2018-05-22 08:35:08

标签: javascript node.js reactjs jest

我正在用Jest模块编写一些简单的单元测试:

import { addExpense, removeExpense, editExpense } from '../../actions/expenses';
test('should setup remove expense action object', () => {
    const id = '148579';
    const action = removeExpense({ id });
    expect(action).toEqual({
        type: 'REMOVE_EXPENSE',
        id
    });
});

Jest向我提出了以下错误:

Test suite failed to run

/Users/ferranblanchexandri/Desktop/Coding/ReactCourse/expensify-app/src/tests/actions/expenses.test.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { addExpense, removeExpense, editExpense } from '../../actions/expenses';
      ^^^^^^

SyntaxError: Unexpected token import

0 个答案:

没有答案