在我的IDE中,所有的.ts TypeScript文件都编译成一个文件。这包括我的单元测试文件。这允许我在测试中进行类型检查,并在一步内完成构建。但是,当我引导我的dev服务器时,它找不到describe()方法,所以如果没有定义它,我就重载它。
// If jasmine functions are not defined (i.e. not running tests) skip functions
if (describe === undefined) {
var describe = (function () { // Duplicate identifier 'descr
我试着写了一个规范,允许模仿Ajax调用。该测试用例在Chrome和Firefox等浏览器上运行良好。但是当我在IE (版本9,10)上运行测试用例时,我会遇到一些问题。当使用jQuery Ajax进行正常的Ajax调用时,就会出现此问题。
我在IE中得到一个错误,如下:
TypeError: Unable to get value of the property 'response': object is null or undefined.
我编写的测试用例如下所示
describe("mocking ajax", function() {
b
我使用了"jasmine":"^2.5.2“,在node中,我得到了错误:
TypeError: jasmine.addMatchers is not a function
在终端使用jasmine-node spec时,运行一个简单的例子,如下所示。
导致此问题的原因是什么?如何解决?
function helloWorld() {
return "Hello world!";
}
describe('keyframes-tool', function () {
it("sa
在Jasmine 1.3中,我们提供了获取当前规范和套件名称的选项:
describe("name for describe", function () {
it("name for it", function () {
console.log(this.suite.getFullName()); // would print "name for describe"
console.log(this.description); // would print "name for it"
我对茉莉花的事情还不熟悉,在过去的几个小时里,我一直困在这个问题上。我试图使用loadFixture()加载一个外部夹具文件。我使用Jasmin2.0.0和Jasmin-jQuery2.0.5。
ReferenceError: loadFixtures is not defined
at Suite.<anonymous> (--appname--/app/assets/Tester/spec/ChannelSpec.js:5:6)
at Env.describe (--appname--/app/assets/Tester/lib/jasmine-2.0.0/jasmin
/edit:我将配置完全剥离到了演示问题的最低限度。我还将一个工作项目上传到GitHub,您可以结帐,这样您就可以自己查看.。
GitHub上的问题用例: ()
npm install
npm run build
npm run test
我知道有几个相关的问题,但世界发展得如此之快,而且有如此多的因素/依赖关系,我无法用目前提出的解决方案来解决这个问题。
我有一个webpack配置,负责我的所有源代码,它的工作很好。
对于测试,我重用该配置来处理单个中央入口脚本,该脚本同时加载源和测试文件。我找不到其他方法将模块从我的源代码导入到我的测试代码中进行测试。
Karma可以很好地重用我的web
我想在webpack通过卡玛测试跑步者将它们组合在一起之后,在一堆模块上运行我的测试,但是每当我运行测试时,Karma说,
错误:无法在找到模块“”
我有一个规范文件:
var a = require('hello.js');
describe("a test test", function() {
it("humperdink test", function() {
expect(a).toEqual('humperdink');
}); //end it
}); //end describe
he
我正在使用jasmine编写测试,并且我有许多工作测试不使用表示dom元素的类型。
现在,我已经编写了一个可以简化为以下内容的测试:
describe("A Test",
() => {
it("when an element is created then it is defined",
() => {
const element = new SVGGElement();
expect(element).toBeDefined();
我有10个测试用例,其中前8个测试用例应该在Chrome浏览器中运行,接下来的2个测试用例应该在Firefox浏览器中运行。
我尝试了以下代码:在conf.js中
var jasmineReporters = require('jasmine-reporters-master');
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-repo
我正在尝试使用protractor和phantomjs运行一些e2e测试。当我运行测试时,我得到以下错误:
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
测试是:
import { browser, element, by } from 'protractor';
describe('example test', () => {
it('stupid test
我已经将Jasmine设置为在JS中运行测试。测试在Specrunner中运行和工作,但是我想在命令行中使用jasmine来运行测试,但是我得到了
1) Account Account balance to be 0
Message:
ReferenceError: Account is not defined
Stack:
ReferenceError: Account is not defined
at UserContext.<anonymous> (/Users/student/Projects/week_9/tech_tests/b