测试套件无法运行。 ReferenceError:窗口未定义

时间:2020-11-11 10:51:48

标签: reactjs testing

这是我的测试文件

import React from 'react';
import ReactDom from 'react-dom';
import AccessSeeker from './AccessSeeker';
test('renders', () => {
})

我收到此错误:

Test suite failed to run

    ReferenceError: window is not defined

      at node_modules/pikaday/pikaday.js:38:25
      at node_modules/pikaday/pikaday.js:16:26
      at Object.<anonymous> (node_modules/pikaday/pikaday.js:29:2)
      at Object.<anonymous> (src/components/DatePicker.js:2:16)

因为这一行:

import AccessSeeker from './AccessSeeker';

0 个答案:

没有答案