Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过rekit 初始化创建app,npm test报错 #248

Open
TeresaZhang7517 opened this issue Sep 1, 2021 · 0 comments
Open

通过rekit 初始化创建app,npm test报错 #248

TeresaZhang7517 opened this issue Sep 1, 2021 · 0 comments

Comments

@TeresaZhang7517
Copy link

通过
rekit create ReactApp
npm install
npm test
创建项目之后没有做别的改动,
测试用例报错如下:
` FAIL tests/features/examples/CounterPage.test.js-- expected a string (for built-in components) or a class/function (for composite components) examples/CounterPage
× renders node with correct class name (112ms)
× counter actions are called when buttons clicked (5ms)

● examples/CounterPage › renders node with correct class name

TypeError: Cannot read property 'contextTypes' of undefined

  11 |       },
  12 |     };
> 13 |     const renderedComponent = shallow(<CounterPage {...props} />);
     |                               ^
  14 |
  15 |     expect(renderedComponent.find('.examples-counter-page').length).toBe(1);
  16 |   });

  at Object.render (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:693:54)
  at new ShallowWrapper (node_modules/enzyme/src/ShallowWrapper.js:411:22)
  at shallow (node_modules/enzyme/src/shallow.js:10:10)
  at Object.<anonymous> (tests/features/examples/CounterPage.test.js:13:31)

● examples/CounterPage › counter actions are called when buttons clicked

TypeError: Cannot read property 'contextTypes' of undefined

  26 |       },
  27 |     };
> 28 |     const renderedComponent = shallow(
     |                               ^
  29 |       <CounterPage {...pageProps} />
  30 |     );
  31 |     renderedComponent.find('.btn-plus-one').simulate('click');

  at Object.render (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:693:54)
  at new ShallowWrapper (node_modules/enzyme/src/ShallowWrapper.js:411:22)
  at shallow (node_modules/enzyme/src/shallow.js:10:10)
  at Object.<anonymous> (tests/features/examples/CounterPage.test.js:28:31)

Test Suites: 1 failed, 1 total
Tests: 2 failed, 2 total
Snapshots: 0 total
Time: 7.295s
Ran all test suites matching /CounterPage/i.`

请问这个是什么问题呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant