xdescribe marks pending, plus associated tests.
This commit is contained in:
@@ -90,6 +90,21 @@ describe("Suite", function() {
|
||||
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() {
|
||||
var suite = new j$.Suite({});
|
||||
|
||||
|
||||
@@ -1115,6 +1115,78 @@ describe("Env integration", function() {
|
||||
|
||||
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) {
|
||||
@@ -1227,9 +1299,10 @@ describe("Env integration", function() {
|
||||
totalSpecsDefined: 1
|
||||
});
|
||||
|
||||
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'disabled' }));
|
||||
expect(reporter.suiteDone.calls.count()).toBe(3);
|
||||
|
||||
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({ status: 'pending' }));
|
||||
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({ description: 'xd out', status: 'pending' }));
|
||||
expect(reporter.suiteDone.calls.count()).toBe(4);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -1238,8 +1311,10 @@ describe("Env integration", function() {
|
||||
env.describe("A Suite", function() {
|
||||
env.describe("nested", function() {
|
||||
env.xdescribe("xd out", function() {
|
||||
env.it("with a spec", function() {
|
||||
env.expect(true).toBe(false);
|
||||
env.describe("nested again", function() {
|
||||
env.it("with a spec", function() {
|
||||
env.expect(true).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -261,13 +261,17 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.describe = function(description, specDefinitions) {
|
||||
var suite = suiteFactory(description);
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
suite.pend();
|
||||
}
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
|
||||
this.xdescribe = function(description, specDefinitions) {
|
||||
var suite = this.describe(description, specDefinitions);
|
||||
suite.disable();
|
||||
var suite = suiteFactory(description);
|
||||
suite.pend();
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
return suite;
|
||||
};
|
||||
|
||||
@@ -373,6 +377,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.it = function(description, fn, timeout) {
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
if (currentDeclarationSuite.markedPending) {
|
||||
spec.pend();
|
||||
}
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
return spec;
|
||||
};
|
||||
@@ -383,9 +390,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
return spec;
|
||||
};
|
||||
|
||||
this.fit = function(){
|
||||
var spec = this.it.apply(this, arguments);
|
||||
|
||||
this.fit = function(description, fn, timeout){
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
currentDeclarationSuite.addChild(spec);
|
||||
focusedRunnables.push(spec.id);
|
||||
unfocusAncestor();
|
||||
return spec;
|
||||
|
||||
@@ -42,6 +42,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
this.disabled = true;
|
||||
};
|
||||
|
||||
Suite.prototype.pend = function(message) {
|
||||
this.markedPending = true;
|
||||
};
|
||||
|
||||
Suite.prototype.beforeEach = function(fn) {
|
||||
this.beforeFns.unshift(fn);
|
||||
};
|
||||
@@ -67,6 +71,10 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
return 'disabled';
|
||||
}
|
||||
|
||||
if (this.markedPending) {
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
if (this.result.failedExpectations.length > 0) {
|
||||
return 'failed';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user