Merge branch 'gdborton-afterAll-order'
- Merges #1312 from @gdborton - Fixes #1311
This commit is contained in:
@@ -4592,7 +4592,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.afterAll = function(fn) {
|
Suite.prototype.afterAll = function(fn) {
|
||||||
this.afterAllFns.push(fn);
|
this.afterAllFns.unshift(fn);
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.addChild = function(child) {
|
Suite.prototype.addChild = function(child) {
|
||||||
|
|||||||
@@ -172,6 +172,22 @@ describe("jasmine spec running", function () {
|
|||||||
it("should run multiple befores and afters ordered so functions declared later are treated as more specific", 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.beforeAll(function() {
|
||||||
|
actions.push('runner beforeAll1');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterAll(function() {
|
||||||
|
actions.push('runner afterAll1');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.beforeAll(function() {
|
||||||
|
actions.push('runner beforeAll2');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.afterAll(function() {
|
||||||
|
actions.push('runner afterAll2');
|
||||||
|
});
|
||||||
|
|
||||||
env.beforeEach(function () {
|
env.beforeEach(function () {
|
||||||
actions.push('runner beforeEach1');
|
actions.push('runner beforeEach1');
|
||||||
});
|
});
|
||||||
@@ -212,6 +228,8 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
var assertions = function() {
|
var assertions = function() {
|
||||||
var expected = [
|
var expected = [
|
||||||
|
"runner beforeAll1",
|
||||||
|
"runner beforeAll2",
|
||||||
"runner beforeEach1",
|
"runner beforeEach1",
|
||||||
"runner beforeEach2",
|
"runner beforeEach2",
|
||||||
"beforeEach1",
|
"beforeEach1",
|
||||||
@@ -220,7 +238,9 @@ describe("jasmine spec running", function () {
|
|||||||
"afterEach2",
|
"afterEach2",
|
||||||
"afterEach1",
|
"afterEach1",
|
||||||
"runner afterEach2",
|
"runner afterEach2",
|
||||||
"runner afterEach1"
|
"runner afterEach1",
|
||||||
|
"runner afterAll2",
|
||||||
|
"runner afterAll1"
|
||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(actions).toEqual(expected);
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.afterAll = function(fn) {
|
Suite.prototype.afterAll = function(fn) {
|
||||||
this.afterAllFns.push(fn);
|
this.afterAllFns.unshift(fn);
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.addChild = function(child) {
|
Suite.prototype.addChild = function(child) {
|
||||||
|
|||||||
Reference in New Issue
Block a user