File: spec_test.go

package info (click to toggle)
golang-ginkgo 1.2.0%2Bgit20161006.acfa16a-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,324 kB
  • ctags: 1,210
  • sloc: makefile: 12
file content (657 lines) | stat: -rw-r--r-- 20,268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
package spec_test

import (
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"

	. "github.com/onsi/ginkgo/internal/spec"

	"github.com/onsi/ginkgo/internal/codelocation"
	"github.com/onsi/ginkgo/internal/containernode"
	Failer "github.com/onsi/ginkgo/internal/failer"
	"github.com/onsi/ginkgo/internal/leafnodes"
	"github.com/onsi/ginkgo/types"
)

var noneFlag = types.FlagTypeNone
var focusedFlag = types.FlagTypeFocused
var pendingFlag = types.FlagTypePending

var _ = Describe("Spec", func() {
	var (
		failer       *Failer.Failer
		codeLocation types.CodeLocation
		nodesThatRan []string
		spec         *Spec
		buffer       *gbytes.Buffer
	)

	newBody := func(text string, fail bool) func() {
		return func() {
			nodesThatRan = append(nodesThatRan, text)
			if fail {
				failer.Fail(text, codeLocation)
			}
		}
	}

	newIt := func(text string, flag types.FlagType, fail bool) *leafnodes.ItNode {
		return leafnodes.NewItNode(text, newBody(text, fail), flag, codeLocation, 0, failer, 0)
	}

	newItWithBody := func(text string, body interface{}) *leafnodes.ItNode {
		return leafnodes.NewItNode(text, body, noneFlag, codeLocation, 0, failer, 0)
	}

	newMeasure := func(text string, flag types.FlagType, fail bool, samples int) *leafnodes.MeasureNode {
		return leafnodes.NewMeasureNode(text, func(Benchmarker) {
			nodesThatRan = append(nodesThatRan, text)
			if fail {
				failer.Fail(text, codeLocation)
			}
		}, flag, codeLocation, samples, failer, 0)
	}

	newBef := func(text string, fail bool) leafnodes.BasicNode {
		return leafnodes.NewBeforeEachNode(newBody(text, fail), codeLocation, 0, failer, 0)
	}

	newAft := func(text string, fail bool) leafnodes.BasicNode {
		return leafnodes.NewAfterEachNode(newBody(text, fail), codeLocation, 0, failer, 0)
	}

	newJusBef := func(text string, fail bool) leafnodes.BasicNode {
		return leafnodes.NewJustBeforeEachNode(newBody(text, fail), codeLocation, 0, failer, 0)
	}

	newContainer := func(text string, flag types.FlagType, setupNodes ...leafnodes.BasicNode) *containernode.ContainerNode {
		c := containernode.New(text, flag, codeLocation)
		for _, node := range setupNodes {
			c.PushSetupNode(node)
		}
		return c
	}

	containers := func(containers ...*containernode.ContainerNode) []*containernode.ContainerNode {
		return containers
	}

	BeforeEach(func() {
		buffer = gbytes.NewBuffer()
		failer = Failer.New()
		codeLocation = codelocation.New(0)
		nodesThatRan = []string{}
	})

	Describe("marking specs focused and pending", func() {
		It("should satisfy various caes", func() {
			cases := []struct {
				ContainerFlags []types.FlagType
				SubjectFlag    types.FlagType
				Pending        bool
				Focused        bool
			}{
				{[]types.FlagType{}, noneFlag, false, false},
				{[]types.FlagType{}, focusedFlag, false, true},
				{[]types.FlagType{}, pendingFlag, true, false},
				{[]types.FlagType{noneFlag}, noneFlag, false, false},
				{[]types.FlagType{focusedFlag}, noneFlag, false, true},
				{[]types.FlagType{pendingFlag}, noneFlag, true, false},
				{[]types.FlagType{noneFlag}, focusedFlag, false, true},
				{[]types.FlagType{focusedFlag}, focusedFlag, false, true},
				{[]types.FlagType{pendingFlag}, focusedFlag, true, true},
				{[]types.FlagType{noneFlag}, pendingFlag, true, false},
				{[]types.FlagType{focusedFlag}, pendingFlag, true, true},
				{[]types.FlagType{pendingFlag}, pendingFlag, true, false},
				{[]types.FlagType{focusedFlag, noneFlag}, noneFlag, false, true},
				{[]types.FlagType{noneFlag, focusedFlag}, noneFlag, false, true},
				{[]types.FlagType{pendingFlag, noneFlag}, noneFlag, true, false},
				{[]types.FlagType{noneFlag, pendingFlag}, noneFlag, true, false},
				{[]types.FlagType{focusedFlag, pendingFlag}, noneFlag, true, true},
			}

			for i, c := range cases {
				subject := newIt("it node", c.SubjectFlag, false)
				containers := []*containernode.ContainerNode{}
				for _, flag := range c.ContainerFlags {
					containers = append(containers, newContainer("container", flag))
				}

				spec := New(subject, containers, false)
				Ω(spec.Pending()).Should(Equal(c.Pending), "Case %d: %#v", i, c)
				Ω(spec.Focused()).Should(Equal(c.Focused), "Case %d: %#v", i, c)

				if c.Pending {
					Ω(spec.Summary("").State).Should(Equal(types.SpecStatePending))
				}
			}
		})
	})

	Describe("Skip", func() {
		It("should be skipped", func() {
			spec := New(newIt("it node", noneFlag, false), containers(newContainer("container", noneFlag)), false)
			Ω(spec.Skipped()).Should(BeFalse())
			spec.Skip()
			Ω(spec.Skipped()).Should(BeTrue())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStateSkipped))
		})
	})

	Describe("IsMeasurement", func() {
		It("should be true if the subject is a measurement node", func() {
			spec := New(newIt("it node", noneFlag, false), containers(newContainer("container", noneFlag)), false)
			Ω(spec.IsMeasurement()).Should(BeFalse())
			Ω(spec.Summary("").IsMeasurement).Should(BeFalse())
			Ω(spec.Summary("").NumberOfSamples).Should(Equal(1))

			spec = New(newMeasure("measure node", noneFlag, false, 10), containers(newContainer("container", noneFlag)), false)
			Ω(spec.IsMeasurement()).Should(BeTrue())
			Ω(spec.Summary("").IsMeasurement).Should(BeTrue())
			Ω(spec.Summary("").NumberOfSamples).Should(Equal(10))
		})
	})

	Describe("Passed", func() {
		It("should pass when the subject passed", func() {
			spec := New(newIt("it node", noneFlag, false), containers(), false)
			spec.Run(buffer)

			Ω(spec.Passed()).Should(BeTrue())
			Ω(spec.Failed()).Should(BeFalse())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStatePassed))
			Ω(spec.Summary("").Failure).Should(BeZero())
		})
	})

	Describe("Flaked", func() {
		It("should work if Run is called twice and gets different results", func() {
			i := 0
			spec := New(newItWithBody("flaky it", func() {
				i++
				if i == 1 {
					failer.Fail("oops", codeLocation)
				}
			}), containers(), false)
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeFalse())
			Ω(spec.Failed()).Should(BeTrue())
			Ω(spec.Flaked()).Should(BeFalse())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStateFailed))
			Ω(spec.Summary("").Failure.Message).Should(Equal("oops"))
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeTrue())
			Ω(spec.Failed()).Should(BeFalse())
			Ω(spec.Flaked()).Should(BeTrue())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStatePassed))
		})
	})

	Describe("Failed", func() {
		It("should be failed if the failure was panic", func() {
			spec := New(newItWithBody("panicky it", func() {
				panic("bam")
			}), containers(), false)
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeFalse())
			Ω(spec.Failed()).Should(BeTrue())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStatePanicked))
			Ω(spec.Summary("").Failure.Message).Should(Equal("Test Panicked"))
			Ω(spec.Summary("").Failure.ForwardedPanic).Should(Equal("bam"))
		})

		It("should be failed if the failure was a timeout", func() {
			spec := New(newItWithBody("sleepy it", func(done Done) {}), containers(), false)
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeFalse())
			Ω(spec.Failed()).Should(BeTrue())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStateTimedOut))
			Ω(spec.Summary("").Failure.Message).Should(Equal("Timed out"))
		})

		It("should be failed if the failure was... a failure", func() {
			spec := New(newItWithBody("failing it", func() {
				failer.Fail("bam", codeLocation)
			}), containers(), false)
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeFalse())
			Ω(spec.Failed()).Should(BeTrue())
			Ω(spec.Summary("").State).Should(Equal(types.SpecStateFailed))
			Ω(spec.Summary("").Failure.Message).Should(Equal("bam"))
		})
	})

	Describe("Concatenated string", func() {
		It("should concatenate the texts of the containers and the subject", func() {
			spec := New(
				newIt("it node", noneFlag, false),
				containers(
					newContainer("outer container", noneFlag),
					newContainer("inner container", noneFlag),
				),
				false,
			)

			Ω(spec.ConcatenatedString()).Should(Equal("outer container inner container it node"))
		})
	})

	Describe("running it specs", func() {
		Context("with just an it", func() {
			Context("that succeeds", func() {
				It("should run the it and report on its success", func() {
					spec := New(newIt("it node", noneFlag, false), containers(), false)
					spec.Run(buffer)
					Ω(spec.Passed()).Should(BeTrue())
					Ω(spec.Failed()).Should(BeFalse())
					Ω(nodesThatRan).Should(Equal([]string{"it node"}))
				})
			})

			Context("that fails", func() {
				It("should run the it and report on its success", func() {
					spec := New(newIt("it node", noneFlag, true), containers(), false)
					spec.Run(buffer)
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(spec.Summary("").Failure.Message).Should(Equal("it node"))
					Ω(nodesThatRan).Should(Equal([]string{"it node"}))
				})
			})
		})

		Context("with a full set of setup nodes", func() {
			var failingNodes map[string]bool

			BeforeEach(func() {
				failingNodes = map[string]bool{}
			})

			JustBeforeEach(func() {
				spec = New(
					newIt("it node", noneFlag, failingNodes["it node"]),
					containers(
						newContainer("outer container", noneFlag,
							newBef("outer bef A", failingNodes["outer bef A"]),
							newBef("outer bef B", failingNodes["outer bef B"]),
							newJusBef("outer jusbef A", failingNodes["outer jusbef A"]),
							newJusBef("outer jusbef B", failingNodes["outer jusbef B"]),
							newAft("outer aft A", failingNodes["outer aft A"]),
							newAft("outer aft B", failingNodes["outer aft B"]),
						),
						newContainer("inner container", noneFlag,
							newBef("inner bef A", failingNodes["inner bef A"]),
							newBef("inner bef B", failingNodes["inner bef B"]),
							newJusBef("inner jusbef A", failingNodes["inner jusbef A"]),
							newJusBef("inner jusbef B", failingNodes["inner jusbef B"]),
							newAft("inner aft A", failingNodes["inner aft A"]),
							newAft("inner aft B", failingNodes["inner aft B"]),
						),
					),
					false,
				)
				spec.Run(buffer)
			})

			Context("that all pass", func() {
				It("should walk through the nodes in the correct order", func() {
					Ω(spec.Passed()).Should(BeTrue())
					Ω(spec.Failed()).Should(BeFalse())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner bef B",
						"outer jusbef A",
						"outer jusbef B",
						"inner jusbef A",
						"inner jusbef B",
						"it node",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
				})
			})

			Context("when the subject fails", func() {
				BeforeEach(func() {
					failingNodes["it node"] = true
				})

				It("should run the afters", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner bef B",
						"outer jusbef A",
						"outer jusbef B",
						"inner jusbef A",
						"inner jusbef B",
						"it node",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("it node"))
				})
			})

			Context("when an inner before fails", func() {
				BeforeEach(func() {
					failingNodes["inner bef A"] = true
				})

				It("should not run any other befores, but it should run the subsequent afters", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("inner bef A"))
				})
			})

			Context("when an outer before fails", func() {
				BeforeEach(func() {
					failingNodes["outer bef B"] = true
				})

				It("should not run any other befores, but it should run the subsequent afters", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("outer bef B"))
				})
			})

			Context("when an after fails", func() {
				BeforeEach(func() {
					failingNodes["inner aft B"] = true
				})

				It("should run all other afters, but mark the test as failed", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner bef B",
						"outer jusbef A",
						"outer jusbef B",
						"inner jusbef A",
						"inner jusbef B",
						"it node",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("inner aft B"))
				})
			})

			Context("when a just before each fails", func() {
				BeforeEach(func() {
					failingNodes["outer jusbef B"] = true
				})

				It("should run the afters, but not the subject", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner bef B",
						"outer jusbef A",
						"outer jusbef B",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("outer jusbef B"))
				})
			})

			Context("when an after fails after an earlier node has failed", func() {
				BeforeEach(func() {
					failingNodes["it node"] = true
					failingNodes["inner aft B"] = true
				})

				It("should record the earlier failure", func() {
					Ω(spec.Passed()).Should(BeFalse())
					Ω(spec.Failed()).Should(BeTrue())
					Ω(nodesThatRan).Should(Equal([]string{
						"outer bef A",
						"outer bef B",
						"inner bef A",
						"inner bef B",
						"outer jusbef A",
						"outer jusbef B",
						"inner jusbef A",
						"inner jusbef B",
						"it node",
						"inner aft A",
						"inner aft B",
						"outer aft A",
						"outer aft B",
					}))
					Ω(spec.Summary("").Failure.Message).Should(Equal("it node"))
				})
			})
		})
	})

	Describe("running measurement specs", func() {
		Context("when the measurement succeeds", func() {
			It("should run N samples", func() {
				spec = New(
					newMeasure("measure node", noneFlag, false, 3),
					containers(
						newContainer("container", noneFlag,
							newBef("bef A", false),
							newJusBef("jusbef A", false),
							newAft("aft A", false),
						),
					),
					false,
				)
				spec.Run(buffer)

				Ω(spec.Passed()).Should(BeTrue())
				Ω(spec.Failed()).Should(BeFalse())
				Ω(nodesThatRan).Should(Equal([]string{
					"bef A",
					"jusbef A",
					"measure node",
					"aft A",
					"bef A",
					"jusbef A",
					"measure node",
					"aft A",
					"bef A",
					"jusbef A",
					"measure node",
					"aft A",
				}))
			})
		})

		Context("when the measurement fails", func() {
			It("should bail after the failure occurs", func() {
				spec = New(
					newMeasure("measure node", noneFlag, true, 3),
					containers(
						newContainer("container", noneFlag,
							newBef("bef A", false),
							newJusBef("jusbef A", false),
							newAft("aft A", false),
						),
					),
					false,
				)
				spec.Run(buffer)

				Ω(spec.Passed()).Should(BeFalse())
				Ω(spec.Failed()).Should(BeTrue())
				Ω(nodesThatRan).Should(Equal([]string{
					"bef A",
					"jusbef A",
					"measure node",
					"aft A",
				}))
			})
		})
	})

	Describe("Summary", func() {
		var (
			subjectCodeLocation        types.CodeLocation
			outerContainerCodeLocation types.CodeLocation
			innerContainerCodeLocation types.CodeLocation
			summary                    *types.SpecSummary
		)

		BeforeEach(func() {
			subjectCodeLocation = codelocation.New(0)
			outerContainerCodeLocation = codelocation.New(0)
			innerContainerCodeLocation = codelocation.New(0)

			spec = New(
				leafnodes.NewItNode("it node", func() {
					time.Sleep(10 * time.Millisecond)
				}, noneFlag, subjectCodeLocation, 0, failer, 0),
				containers(
					containernode.New("outer container", noneFlag, outerContainerCodeLocation),
					containernode.New("inner container", noneFlag, innerContainerCodeLocation),
				),
				false,
			)

			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeTrue())
			summary = spec.Summary("suite id")
		})

		It("should have the suite id", func() {
			Ω(summary.SuiteID).Should(Equal("suite id"))
		})

		It("should have the component texts and code locations", func() {
			Ω(summary.ComponentTexts).Should(Equal([]string{"outer container", "inner container", "it node"}))
			Ω(summary.ComponentCodeLocations).Should(Equal([]types.CodeLocation{outerContainerCodeLocation, innerContainerCodeLocation, subjectCodeLocation}))
		})

		It("should have a runtime", func() {
			Ω(summary.RunTime).Should(BeNumerically(">=", 10*time.Millisecond))
		})

		It("should not be a measurement, or have a measurement summary", func() {
			Ω(summary.IsMeasurement).Should(BeFalse())
			Ω(summary.Measurements).Should(BeEmpty())
		})
	})

	Describe("Summaries for measurements", func() {
		var summary *types.SpecSummary

		BeforeEach(func() {
			spec = New(leafnodes.NewMeasureNode("measure node", func(b Benchmarker) {
				b.RecordValue("a value", 7, "some info")
				b.RecordValueWithPrecision("another value", 8, "ns", 5, "more info")
			}, noneFlag, codeLocation, 4, failer, 0), containers(), false)
			spec.Run(buffer)
			Ω(spec.Passed()).Should(BeTrue())
			summary = spec.Summary("suite id")
		})

		It("should include the number of samples", func() {
			Ω(summary.NumberOfSamples).Should(Equal(4))
		})

		It("should be a measurement", func() {
			Ω(summary.IsMeasurement).Should(BeTrue())
		})

		It("should have the measurements report", func() {
			Ω(summary.Measurements).Should(HaveKey("a value"))
			report := summary.Measurements["a value"]
			Ω(report.Name).Should(Equal("a value"))
			Ω(report.Info).Should(Equal("some info"))
			Ω(report.Results).Should(Equal([]float64{7, 7, 7, 7}))

			Ω(summary.Measurements).Should(HaveKey("another value"))
			report = summary.Measurements["another value"]
			Ω(report.Name).Should(Equal("another value"))
			Ω(report.Info).Should(Equal("more info"))
			Ω(report.Results).Should(Equal([]float64{8, 8, 8, 8}))
			Ω(report.Units).Should(Equal("ns"))
			Ω(report.Precision).Should(Equal(5))
		})
	})

	Describe("When told to emit progress", func() {
		It("should emit progress to the writer as it runs Befores, JustBefores, Afters, and Its", func() {
			spec = New(
				newIt("it node", noneFlag, false),
				containers(
					newContainer("outer container", noneFlag,
						newBef("outer bef A", false),
						newJusBef("outer jusbef A", false),
						newAft("outer aft A", false),
					),
					newContainer("inner container", noneFlag,
						newBef("inner bef A", false),
						newJusBef("inner jusbef A", false),
						newAft("inner aft A", false),
					),
				),
				true,
			)
			spec.Run(buffer)

			Ω(buffer).Should(gbytes.Say(`\[BeforeEach\] outer container`))
			Ω(buffer).Should(gbytes.Say(`\[BeforeEach\] inner container`))
			Ω(buffer).Should(gbytes.Say(`\[JustBeforeEach\] outer container`))
			Ω(buffer).Should(gbytes.Say(`\[JustBeforeEach\] inner container`))
			Ω(buffer).Should(gbytes.Say(`\[It\] it node`))
			Ω(buffer).Should(gbytes.Say(`\[AfterEach\] inner container`))
			Ω(buffer).Should(gbytes.Say(`\[AfterEach\] outer container`))
		})

		It("should emit progress to the writer as it runs Befores, JustBefores, Afters, and Measures", func() {
			spec = New(
				newMeasure("measure node", noneFlag, false, 2),
				containers(),
				true,
			)
			spec.Run(buffer)

			Ω(buffer).Should(gbytes.Say(`\[Measure\] measure node`))
			Ω(buffer).Should(gbytes.Say(`\[Measure\] measure node`))
		})
	})
})