- Run `afterEach` in reverse order declared as before
This commit is contained in:
Gregg Van Hove
2015-12-03 16:00:05 -08:00
parent 3b53e469fd
commit e2e2d1b343
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -612,7 +612,7 @@ getJasmineRequireObj().Env = function(j$) {
while(suite) { while(suite) {
befores = befores.concat(suite.beforeFns); befores = befores.concat(suite.beforeFns);
afters = afters.concat(suite.afterFns.reverse()); afters = afters.concat(suite.afterFns);
suite = suite.parentSuite; suite = suite.parentSuite;
} }
+4 -4
View File
@@ -169,7 +169,7 @@ describe("jasmine spec running", function () {
env.execute(); env.execute();
}); });
it("should run multiple befores and afters in the order they are declared", function(done) { it("should run multiple befores and afters ordered so functions declared later are treated as more specific", function(done) {
var actions = []; var actions = [];
env.beforeEach(function () { env.beforeEach(function () {
@@ -217,10 +217,10 @@ describe("jasmine spec running", function () {
"beforeEach1", "beforeEach1",
"beforeEach2", "beforeEach2",
"outer it 1", "outer it 1",
"afterEach1",
"afterEach2", "afterEach2",
"runner afterEach1", "afterEach1",
"runner afterEach2" "runner afterEach2",
"runner afterEach1"
]; ];
expect(actions).toEqual(expected); expect(actions).toEqual(expected);
done(); done();
+1 -1
View File
@@ -110,7 +110,7 @@ getJasmineRequireObj().Env = function(j$) {
while(suite) { while(suite) {
befores = befores.concat(suite.beforeFns); befores = befores.concat(suite.beforeFns);
afters = afters.concat(suite.afterFns.reverse()); afters = afters.concat(suite.afterFns);
suite = suite.parentSuite; suite = suite.parentSuite;
} }