在Karma运行所有测试之前执行角度代码? [英] Execute angular code before Karma run all tests?
本文介绍了在Karma运行所有测试之前执行角度代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在业力中执行某种初始化编码?在执行测试之前,我需要运行这样的代码:
Is it possible to execute some sort of initialization coding in karma? I need to run a code like this before my tests get executed:
angular.module('module.common.brand', []).constant('BRAND', 'brandname');
我的应用当前需要此模块(和此常量),但今天,它以一种时髦的方式进行了初始化,我的业力对此一无所知.
My app currently requires this module (and this constant) but today this is currently initialized in a funky way that my karma doesn't know about it.
推荐答案
与其他任何JS文件一样,应在Karma配置( files
选项)中在 test/之前指定初始化文件.* .spec.js
.
As any other JS file, initialization file should be specified in Karma configuration (files
option), right before test/*.spec.js
.
这篇关于在Karma运行所有测试之前执行角度代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文