Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个角度模块,它有一些角度配置,我希望所有测试在运行之前都有。我可以进入所有文件并通过包含该模块angular.mock.module但我想知道我是否可以通过 karma 以某种方式做到这一点。
angular.mock.module
创建一个具有合适名称的新文件。让我们说required.ts。在此文件中,包含您想要包含在测试中的所有必需模块/依赖项。现在karma.conf,添加required.tsin 文件并对其进行预处理以获得所需的结果。
required.ts
karma.conf
您也可以决定制作 arequire.js在这种情况下您不必在karma.conf.
require.js