无法在带有react-native-fs lib的react-native中运行Jest单元测试

问题描述 投票:4回答:1

我用最新版本创建了一个新的react-native应用程序,默认测试效果很好。然后,我使用'react-native-fs'lib在我的应用程序中写入文件,并且工作正常。但是我尝试运行测试命令,但失败了。

> [email protected] test D:\test\TestJest
> jest

 FAIL  __tests__\index.android.js
  ● Test suite failed to run

TypeError: Cannot read property 'RNFSFileTypeRegular' of undefined

  at Object.<anonymous> (node_modules\react-native-fs\FS.common.js:17:36)
  at Object.<anonymous> (index.android.js:14:20)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.8s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

我已关注the manual document of Jest,但尚未解决错误。这是my example repo。您可以看看我的示例存储库,让我知道我做错了吗?

谢谢。

react-native jest react-native-fs
1个回答
0
投票

请您分享代码段

© www.soinside.com 2019 - 2024. All rights reserved.