我正在测试一些不同的文档引擎,我想为我们的大型项目尝试typedoc。我们在整个项目中都有各种测试文件(somefile.test.ts或someotherfile.test.tsx)。我正在努力让typedoc忽略这些文件。我做了npm i -D typedoc,然后在我的tsconfig.json
{
"compilerOptions": {
"configOptions": "some_options"
},
"include": ["src"],
"typedocOptions": {
"out": "docs",
"entryPoints": "src/index.tsx",
"exclude": [
"**/*.test.ts*",
"**/*.test.tsx*"
]
}
}然后我运行npm命令"tsdoc": "typedoc" - npm run tsdoc。Typedoc在我的文件中运行,在我的测试文件中发现了大量的typescript linting错误,因此它无法运行。(我们最近更新了我们的@types/jest,所以eslint和ts都在抱怨Property 'toEqual' does not exist on type 'Assertion'和Property 'toMatchSnapshot' does not exist on type 'Assertion'之类的东西。eslint和ts抱怨这些事情,但它不会阻止测试运行。但是我的typedocOptions有什么问题,它没有正确地忽略这些文件?
发布于 2021-04-11 11:15:49
这完全是胡思乱想,但我猜测typedoc在尝试生成文档之前运行tsc,以创建文件之间的链接。如果tsc/eslint给了它错误,它可能无法检查要排除哪些文件。
我建议调查一下为什么Jest升级会把事情搞得一团糟。一旦编译器/linting错误消失,我想typedoc会配合的。您也可以告诉tsc/eslint忽略这些文件,但我认为不编译测试文件会导致更多的问题。
https://stackoverflow.com/questions/66431304
复制相似问题