@@ -496,7 +496,7 @@ describe("Env integration", function() {
|
|||||||
env.execute([secondSuite.id, firstSpec.id]);
|
env.execute([secondSuite.id, firstSpec.id]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('runs before and after all functions for focused specs', function(done) {
|
it('runs before and after all functions for runnables provided to .execute()', function(done) {
|
||||||
var env = new j$.Env(),
|
var env = new j$.Env(),
|
||||||
calls = [],
|
calls = [],
|
||||||
first_spec,
|
first_spec,
|
||||||
@@ -772,7 +772,32 @@ describe("Env integration", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: something is wrong with this spec
|
describe('focused tests', function() {
|
||||||
|
it('should only run the focused tests', function(done) {
|
||||||
|
var env = new j$.Env(),
|
||||||
|
calls = [];
|
||||||
|
|
||||||
|
var assertions = function() {
|
||||||
|
expect(calls).toEqual(['focused']);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
env.addReporter({jasmineDone: assertions});
|
||||||
|
|
||||||
|
env.describe('a suite', function() {
|
||||||
|
env.fit('is focused', function() {
|
||||||
|
calls.push('focused');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('is not focused', function() {
|
||||||
|
calls.push('freakout');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("should report as expected", function(done) {
|
it("should report as expected", function(done) {
|
||||||
var env = new j$.Env(),
|
var env = new j$.Env(),
|
||||||
reporter = jasmine.createSpyObj('fakeReporter', [
|
reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
|
|||||||
+11
-1
@@ -199,8 +199,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.execute = function(runnablesToRun) {
|
this.execute = function(runnablesToRun) {
|
||||||
if(runnablesToRun) {
|
if(runnablesToRun) {
|
||||||
runnablesExplictlySet = true;
|
runnablesExplictlySet = true;
|
||||||
|
} else if (focusedRunnables.length) {
|
||||||
|
runnablesToRun = focusedRunnables;
|
||||||
|
} else {
|
||||||
|
runnablesToRun = [topSuite.id];
|
||||||
}
|
}
|
||||||
runnablesToRun = runnablesToRun || [topSuite.id];
|
|
||||||
|
|
||||||
var allFns = [];
|
var allFns = [];
|
||||||
for(var i = 0; i < runnablesToRun.length; i++) {
|
for(var i = 0; i < runnablesToRun.length; i++) {
|
||||||
@@ -348,6 +351,13 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return spec;
|
return spec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var focusedRunnables = [];
|
||||||
|
this.fit = function(description, fn ){
|
||||||
|
var spec = this.it(description, fn);
|
||||||
|
focusedRunnables.push(spec.id);
|
||||||
|
return spec;
|
||||||
|
};
|
||||||
|
|
||||||
this.expect = function(actual) {
|
this.expect = function(actual) {
|
||||||
return currentRunnable().expect(actual);
|
return currentRunnable().expect(actual);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user