return function()describe("\102\117\108\108 \101\120\097\109\112\108\101",function()beforeAll(function(J)J.globalState={}table.insert(J.globalState,"\098\101\102\111\114\101\065\108\108");(expect(table.find(J.globalState,"\098\101\102\111\114\101\065\108\108"))).to.equal(1)end)beforeEach(function(J)table.insert(J.globalState,"\098\101\102\111\114\101\069\097\099\104");(expect(table.find(J.globalState,"\098\101\102\111\114\101\069\097\099\104"))).to.equal(2)end)it("\105\116 \098\108\111\099\107",function(J)table.insert(J.globalState,"\116\101\115\116");(expect(table.find(J.globalState,"\116\101\115\116"))).to.equal(3)end)afterEach(function(J)table.insert(J.globalState,"\097\102\116\101\114\069\097\099\104");(expect(table.find(J.globalState,"\097\102\116\101\114\069\097\099\104"))).to.equal(4)end)afterAll(function(J)table.insert(J.globalState,"\097\102\116\101\114\065\108\108");(expect(table.find(J.globalState,"\097\102\116\101\114\065\108\108"))).to.equal(5)end)end)describe("\110\111 \105\116 \098\108\111\099\107 - \115\104\111\117\108\100 \110\111\116 \099\097\108\108 \098\101\102\111\114\101\069\097\099\104 \111\114 \097\102\116\101\114\069\097\099\104",function()beforeAll(function(J)J.globalState={}table.insert(J.globalState,"\098\101\102\111\114\101\065\108\108");(expect(table.find(J.globalState,"\098\101\102\111\114\101\065\108\108"))).to.equal(1)end)beforeEach(function()fail("\115\104\111\117\108\100 \110\111\116 \098\101 \099\097\108\108\101\100")end)afterEach(function()fail("\115\104\111\117\108\100 \110\111\116 \098\101 \099\097\108\108\101\100")end)afterAll(function(J)table.insert(J.globalState,"\097\102\116\101\114\065\108\108");(expect(table.find(J.globalState,"\097\102\116\101\114\065\108\108"))).to.equal(2)end)end)end
-- Shared test cases asserting lifecycle hooks are firing in the correct order

return function()
	describe("full example", function()
		beforeAll(function(context)
			context.globalState = {}

			table.insert(context.globalState, "beforeAll")
			expect(table.find(context.globalState, "beforeAll")).to.equal(1)
		end)

		beforeEach(function(context)
			table.insert(context.globalState, "beforeEach")
			expect(table.find(context.globalState, "beforeEach")).to.equal(2)
		end)

		it("it block", function(context)
			table.insert(context.globalState, "test")
			expect(table.find(context.globalState, "test")).to.equal(3)
		end)

		afterEach(function(context)
			table.insert(context.globalState, "afterEach")
			expect(table.find(context.globalState, "afterEach")).to.equal(4)
		end)

		afterAll(function(context)
			table.insert(context.globalState, "afterAll")
			expect(table.find(context.globalState, "afterAll")).to.equal(5)
		end)
	end)

	describe("no it block - should not call beforeEach or afterEach", function()
		beforeAll(function(context)
			context.globalState = {}

			table.insert(context.globalState, "beforeAll")
			expect(table.find(context.globalState, "beforeAll")).to.equal(1)
		end)

		beforeEach(function()
			fail("should not be called")
		end)

		afterEach(function()
			fail("should not be called")
		end)

		afterAll(function(context)
			table.insert(context.globalState, "afterAll")
			expect(table.find(context.globalState, "afterAll")).to.equal(2)
		end)
	end)
end
