@@ -711,13 +711,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.describe = function(description, specDefinitions) {
|
this.describe = function(description, specDefinitions) {
|
||||||
var suite = suiteFactory(description);
|
var suite = suiteFactory(description);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
suite.pend();
|
||||||
|
}
|
||||||
addSpecsToSuite(suite, specDefinitions);
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xdescribe = function(description, specDefinitions) {
|
this.xdescribe = function(description, specDefinitions) {
|
||||||
var suite = this.describe(description, specDefinitions);
|
var suite = suiteFactory(description);
|
||||||
suite.disable();
|
suite.pend();
|
||||||
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -823,6 +827,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
spec.pend();
|
||||||
|
}
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
@@ -833,9 +840,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.fit = function(){
|
this.fit = function(description, fn, timeout){
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
unfocusAncestor();
|
unfocusAncestor();
|
||||||
return spec;
|
return spec;
|
||||||
@@ -2031,6 +2038,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Suite.prototype.pend = function(message) {
|
||||||
|
this.markedPending = true;
|
||||||
|
};
|
||||||
|
|
||||||
Suite.prototype.beforeEach = function(fn) {
|
Suite.prototype.beforeEach = function(fn) {
|
||||||
this.beforeFns.unshift(fn);
|
this.beforeFns.unshift(fn);
|
||||||
};
|
};
|
||||||
@@ -2056,6 +2067,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.markedPending) {
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.result.failedExpectations.length > 0) {
|
if (this.result.failedExpectations.length > 0) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -90,6 +90,21 @@ describe("Suite", function() {
|
|||||||
expect(suite.getResult().status).toBe('disabled');
|
expect(suite.getResult().status).toBe('disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("retrieves a result with pending status", function() {
|
||||||
|
var suite = new j$.Suite({});
|
||||||
|
suite.pend();
|
||||||
|
|
||||||
|
expect(suite.getResult().status).toBe('pending');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("priviledges a disabled status over pending status", function() {
|
||||||
|
var suite = new j$.Suite({});
|
||||||
|
suite.disable();
|
||||||
|
suite.pend();
|
||||||
|
|
||||||
|
expect(suite.getResult().status).toBe('disabled');
|
||||||
|
});
|
||||||
|
|
||||||
it("is executable if not disabled", function() {
|
it("is executable if not disabled", function() {
|
||||||
var suite = new j$.Suite({});
|
var suite = new j$.Suite({});
|
||||||
|
|
||||||
|
|||||||
@@ -1115,6 +1115,78 @@ describe("Env integration", function() {
|
|||||||
|
|
||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should run focused tests inside an xdescribe', function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
|
"jasmineStarted",
|
||||||
|
"jasmineDone",
|
||||||
|
"suiteStarted",
|
||||||
|
"suiteDone",
|
||||||
|
"specStarted",
|
||||||
|
"specDone"
|
||||||
|
]);
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
|
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||||
|
totalSpecsDefined: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
description: 'with a fit spec',
|
||||||
|
status: 'failed'
|
||||||
|
}));
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.xdescribe("xd suite", function() {
|
||||||
|
env.fit("with a fit spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run focused suites inside an xdescribe', function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
|
"jasmineStarted",
|
||||||
|
"jasmineDone",
|
||||||
|
"suiteStarted",
|
||||||
|
"suiteDone",
|
||||||
|
"specStarted",
|
||||||
|
"specDone"
|
||||||
|
]);
|
||||||
|
|
||||||
|
reporter.jasmineDone.and.callFake(function() {
|
||||||
|
expect(reporter.jasmineStarted).toHaveBeenCalledWith({
|
||||||
|
totalSpecsDefined: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
|
description: 'with a spec',
|
||||||
|
status: 'failed'
|
||||||
|
}));
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
env.addReporter(reporter);
|
||||||
|
|
||||||
|
env.xdescribe("xd suite", function() {
|
||||||
|
env.fdescribe("fd suite", function() {
|
||||||
|
env.it("with a spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should report as expected", function(done) {
|
it("should report as expected", function(done) {
|
||||||
@@ -1227,9 +1299,10 @@ describe("Env integration", function() {
|
|||||||
totalSpecsDefined: 1
|
totalSpecsDefined: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'disabled' }));
|
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'pending' }));
|
||||||
expect(reporter.suiteDone.calls.count()).toBe(3);
|
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({ description: 'xd out', status: 'pending' }));
|
||||||
|
expect(reporter.suiteDone.calls.count()).toBe(4);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1238,8 +1311,10 @@ describe("Env integration", function() {
|
|||||||
env.describe("A Suite", function() {
|
env.describe("A Suite", function() {
|
||||||
env.describe("nested", function() {
|
env.describe("nested", function() {
|
||||||
env.xdescribe("xd out", function() {
|
env.xdescribe("xd out", function() {
|
||||||
env.it("with a spec", function() {
|
env.describe("nested again", function() {
|
||||||
env.expect(true).toBe(false);
|
env.it("with a spec", function() {
|
||||||
|
env.expect(true).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -261,13 +261,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.describe = function(description, specDefinitions) {
|
this.describe = function(description, specDefinitions) {
|
||||||
var suite = suiteFactory(description);
|
var suite = suiteFactory(description);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
suite.pend();
|
||||||
|
}
|
||||||
addSpecsToSuite(suite, specDefinitions);
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.xdescribe = function(description, specDefinitions) {
|
this.xdescribe = function(description, specDefinitions) {
|
||||||
var suite = this.describe(description, specDefinitions);
|
var suite = suiteFactory(description);
|
||||||
suite.disable();
|
suite.pend();
|
||||||
|
addSpecsToSuite(suite, specDefinitions);
|
||||||
return suite;
|
return suite;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -373,6 +377,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.it = function(description, fn, timeout) {
|
this.it = function(description, fn, timeout) {
|
||||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
if (currentDeclarationSuite.markedPending) {
|
||||||
|
spec.pend();
|
||||||
|
}
|
||||||
currentDeclarationSuite.addChild(spec);
|
currentDeclarationSuite.addChild(spec);
|
||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
@@ -383,9 +390,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.fit = function(){
|
this.fit = function(description, fn, timeout){
|
||||||
var spec = this.it.apply(this, arguments);
|
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||||
|
currentDeclarationSuite.addChild(spec);
|
||||||
focusedRunnables.push(spec.id);
|
focusedRunnables.push(spec.id);
|
||||||
unfocusAncestor();
|
unfocusAncestor();
|
||||||
return spec;
|
return spec;
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Suite.prototype.pend = function(message) {
|
||||||
|
this.markedPending = true;
|
||||||
|
};
|
||||||
|
|
||||||
Suite.prototype.beforeEach = function(fn) {
|
Suite.prototype.beforeEach = function(fn) {
|
||||||
this.beforeFns.unshift(fn);
|
this.beforeFns.unshift(fn);
|
||||||
};
|
};
|
||||||
@@ -67,6 +71,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.markedPending) {
|
||||||
|
return 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.result.failedExpectations.length > 0) {
|
if (this.result.failedExpectations.length > 0) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user