我的测试是用打字稿编写的,一切正常,现在我想要一个globalSetup.
我添加了 globalSetup 并工作得很好,但是一旦我导入一个模块,我就会得到:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Jest: Got error running globalSetup reason: Unknown file extension ".ts"
Run Code Online (Sandbox Code Playgroud)
似乎不仅仅是因为打字稿,因为当我从另一个打字稿文件导入函数时它可以工作。
问题是当我导入时node_modules
jest.config.js
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
globalSetup: './config/testSetup.ts',
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
};
Run Code Online (Sandbox Code Playgroud)
笑话版本v27.5.1
打字稿版本v4.8.4
我需要使 中的一些查询onSuccess无效useMutation。
我有一个queryKey这样的架构:
.....
1-["questions", "by_vendor" , "{vendor_code}" , "by_status", "{status}"]
2-["questions", "by_status", "{status}"]
3-["questions", "by_vendor", "{vendor_code}"]
.....
Run Code Online (Sandbox Code Playgroud)
我用来useQueryClient获取查询客户端。
我需要使使用的querykeys地方无效"by_status"。
有没有办法访问 active queryKeys.
有类似的方法queryClient.getQueryData(),但都需要queryKey提前。
谢谢你!