@@ -44,44 +44,47 @@ Feature: hooks ordering
4444 beforeEach(function() {
4545 expect(counter++, "Expected beforeEach() to be called after before()").to.equal(1)
4646 })
47- Before(function() {
47+ Before({ order: 2 }, function() {
48+ expect(counter++, "Expected Before() to be called after beforeEach()").to.equal(3)
49+ })
50+ Before({ order: 1 }, function() {
4851 expect(counter++, "Expected Before() to be called after beforeEach()").to.equal(2)
4952 })
5053 Given("a background step", function() {
51- expect(counter++, "Expected a background step to be called after Before()").to.equal(3 )
54+ expect(counter++, "Expected a background step to be called after Before()").to.equal(4 )
5255 })
5356 BeforeStep(function ({ pickleStep }) {
5457 if (pickleStep.text === "an ordinary step") {
55- expect(counter++, "Expected BeforeStep() to be called before ordinary steps").to.equal(4 )
58+ expect(counter++, "Expected BeforeStep() to be called before ordinary steps").to.equal(5 )
5659 }
5760 })
5861 Given("an ordinary step", function() {
59- expect(counter++, "Expected an ordinary step to be called after a background step").to.equal(5 )
62+ expect(counter++, "Expected an ordinary step to be called after a background step").to.equal(6 )
6063 })
6164 AfterStep(function ({ pickleStep }) {
6265 if (pickleStep.text === "an ordinary step") {
63- expect(counter++, "Expected AfterStep() to be called after ordinary steps").to.equal(7 )
66+ expect(counter++, "Expected AfterStep() to be called after ordinary steps").to.equal(8 )
6467 }
6568 })
6669 AfterStep(function ({ pickleStep }) {
6770 if (pickleStep.text === "an ordinary step") {
68- expect(counter++, "Expected AfterStep() to be called after ordinary steps").to.equal(6 )
71+ expect(counter++, "Expected AfterStep() to be called after ordinary steps").to.equal(7 )
6972 }
7073 })
7174 After(function() {
72- expect(counter++, "Expected After() to be called in reverse order of definition").to.equal(9 )
75+ expect(counter++, "Expected After() to be called in reverse order of definition").to.equal(10 )
7376 })
7477 After(function() {
75- expect(counter++, "Expected After() to be called after ordinary steps").to.equal(8 )
78+ expect(counter++, "Expected After() to be called after ordinary steps").to.equal(9 )
7679 })
7780 afterEach(function() {
78- expect(counter++, "Expected afterEach() to be called after After()").to.equal(10 )
81+ expect(counter++, "Expected afterEach() to be called after After()").to.equal(11 )
7982 })
8083 AfterAll(function() {
81- expect(counter++, "Expected AfterAll() to be called after afterEach()").to.equal(11 )
84+ expect(counter++, "Expected AfterAll() to be called after afterEach()").to.equal(12 )
8285 })
8386 after(function() {
84- expect(counter++, "Expected after() to be called after AfterAll()").to.equal(12 )
87+ expect(counter++, "Expected after() to be called after AfterAll()").to.equal(13 )
8588 })
8689 """
8790 When I run cypress
0 commit comments