获取Jest错误- TypeError:无法重新定义属性:性能

x6yk4ghg  于 2023-06-20  发布在  Jest
关注(0)|答案(1)|浏览(125)

我在一个Expo项目中工作,遇到了一个问题,由于TypeError,所有Jest测试都失败了:

> Test run started at 5/2/2023, 12:02:30 PM <

 FAIL  app/utils/story-building-utils/getCurrentWeek.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/brainstorm-utils/__tests__/slugify.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/models/personas/personas.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/models/brainstorms/brainstorms.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/models/wwxd/wwxd.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  test/i18n.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/api/Persona.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/services/api/api-problem.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/storage/storage.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/models/story-building/story-building.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/brainstorm-utils/__tests__/shuffleArray.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/brainstorm-utils/__tests__/parseParams.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/hooks/useGetBrainstormData/getBrainstormReducer.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/models/auth/auth.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/brainstorm-utils/__tests__/makeTitle.test.js
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/brainstorm-utils/createUniqueId.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

 FAIL  app/utils/persona-utils/createUniqueId.test.ts
  ● Test suite failed to run

    TypeError: Cannot redefine property: performance

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:20)

Test Suites: 17 failed, 17 total
Tests:       0 total
Snapshots:   0 total
Time:        6.061 s
Ran all test suites.

> Test run finished at 5/2/2023, 12:02:37 PM <

似乎这个问题是在我从Expo 44升级到48后开始出现的。我已经试图确保我的软件包版本是正确的博览会48,但我继续有这个问题。任何帮助是赞赏!

gz5pxeao

gz5pxeao1#

节点LTS版本18.16.0失败,我已经降级到18.12,一切都是绿色的??

相关问题