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

jest 多个Effect的时候报错 #146

Open
zhanglong-3ti opened this issue Aug 27, 2019 · 0 comments
Open

jest 多个Effect的时候报错 #146

zhanglong-3ti opened this issue Aug 27, 2019 · 0 comments

Comments

@zhanglong-3ti
Copy link

主要代码:

useEffect(() => {
  setTitle('主页');
   }, []);
 useEffect(() => {
   setIsLoaded(false);
 }, [dateRange])

jest代码:

const component = renderIntoDocument(<homePage/>);
expect(component).toMatchSnapshot();

发现只要写多个useEffect, 然后进行单元测试就会报错,错误信息是ReferenceError: Taro is not defined

版本:

"nervjs": "^1.4.0",
"nerv-test-utils": "^1.4.3",
"@tarojs/taro": "1.3.14",

请问这个问题如何解决呢?

@zhanglong-3ti zhanglong-3ti changed the title jest renderIntoDocument 报错 jest 多个Effect的时候报错 Aug 27, 2019
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