React + Jest单元测试中的Material-UI印刷错误

时间:2018-11-26 05:29:50

标签: reactjs unit-testing jestjs material-ui typography

当我在浏览器中运行应用程序时,我没有从我的React Web应用程序看到任何警告,但是在单元测试运行期间,我遇到了Material-UI印刷错误。

  

警告:Material-UI:您正在使用不建议使用的版式变体,它将在下一个主要版本中删除。         请阅读https://material-ui.com/style/typography#migration-to-typography-v2

下的迁移指南

请提出如何解决此问题的建议。

迁移指南在这方面无济于事,因为我已将文档中提到的所有Typography变体升级到最新版本。

@ material-ui / core版本:3.5.1

  

纱线运行v1.9.4 $节点脚本/test.js --env = jsdom

     

PASS src / containers / Login / Login.spec.js●控制台

console.error node_modules/warning/warning.js:34
  Warning: Material-UI: you are using the deprecated typography variants that will be removed in the next major release.
  Please read the migration guide under https://material-ui.com/style/typography#migration-to-typography-v2

1 个答案:

答案 0 :(得分:0)

您似乎没有使用与迁移指南中提到的主题类似的主题:

const theme = createMuiTheme({
  typography: {
    useNextVariants: true,
  },
});

或如果不使用主题,请设置window.__MUI_USE_NEXT_TYPOGRAPHY_VARIANTS__ = true;

相关问题