Run before,afterAlls as 'eachs' when specifying runnablesToRun
- Fix bug where beforeAlls were being mutated in Suite#execute - When Env.execute() receives a list of runnables, beforeAlls and afterAlls are collected as beforeEachs and afterEachs. This allows runnables to be specified in any order, regardless of if any of them have before/afterAlls. - Spec constructor takes a single function that returns both before and afters, instead of two functions. This breaks the current interface for constructing a Spec. [#73742528]
This commit is contained in:
committed by
Greg Cobb and Tim Jarratt
parent
61bf9ac7d7
commit
b984ff2fa6
@@ -460,8 +460,6 @@ describe("Env integration", function() {
|
||||
env.execute();
|
||||
});
|
||||
|
||||
|
||||
|
||||
it("Allows specifying which specs and suites to run", function(done) {
|
||||
var env = new j$.Env(),
|
||||
calls = [],
|
||||
@@ -498,6 +496,44 @@ describe("Env integration", function() {
|
||||
env.execute([secondSuite.id, firstSpec.id]);
|
||||
});
|
||||
|
||||
it('runs before and after all functions for focused specs', function(done) {
|
||||
var env = new j$.Env(),
|
||||
calls = [],
|
||||
first_spec,
|
||||
second_spec;
|
||||
|
||||
var assertions = function() {
|
||||
expect(calls).toEqual([
|
||||
"before",
|
||||
"first spec",
|
||||
"after",
|
||||
"before",
|
||||
"second spec",
|
||||
"after"
|
||||
]);
|
||||
done();
|
||||
};
|
||||
|
||||
env.addReporter({jasmineDone: assertions});
|
||||
|
||||
env.describe("first suite", function() {
|
||||
env.beforeAll(function() {
|
||||
calls.push("before");
|
||||
});
|
||||
env.afterAll(function() {
|
||||
calls.push("after")
|
||||
});
|
||||
first_spec = env.it("spec", function() {
|
||||
calls.push('first spec');
|
||||
});
|
||||
second_spec = env.it("spec 2", function() {
|
||||
calls.push("second spec");
|
||||
});
|
||||
});
|
||||
|
||||
env.execute([first_spec.id, second_spec.id]);
|
||||
});
|
||||
|
||||
it("Functions can be spied on and have their calls tracked", function (done) {
|
||||
var env = new j$.Env();
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ describe("jasmine spec running", function () {
|
||||
];
|
||||
expect(actions).toEqual(expected);
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
env.addReporter({jasmineDone: assertions});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user