Updates all steps within top level suite to have ignore set to true if only is not set to true on step.
(suite: TestSuiteInternal<T>)
| 273 | |
| 274 | /** Updates all steps within top level suite to have ignore set to true if only is not set to true on step. */ |
| 275 | static addingOnlyStep<T>(suite: TestSuiteInternal<T>) { |
| 276 | if (!suite.hasOnlyStep) { |
| 277 | for (let i = 0; i < suite.steps.length; i++) { |
| 278 | const step = suite.steps[i]!; |
| 279 | if (!(step instanceof TestSuiteInternal) && !step.only) { |
| 280 | suite.steps.splice(i--, 1); |
| 281 | } |
| 282 | } |
| 283 | suite.hasOnlyStep = true; |
| 284 | } |
| 285 | |
| 286 | const parentSuite = suite.describe.suite; |
| 287 | const parentTestSuite = parentSuite && |
| 288 | TestSuiteInternal.suites.get(parentSuite.symbol); |
| 289 | if (parentTestSuite) { |
| 290 | TestSuiteInternal.addingOnlyStep(parentTestSuite); |
| 291 | } |
| 292 | |
| 293 | // If this suite was already registered with Deno.test (e.g. a global |
| 294 | // suite created by beforeAll), retroactively mark it as only. |
| 295 | if (suite.#registeredOptions) { |
| 296 | suite.#registeredOptions.only = true; |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /** This is used internally to add steps to a test suite. */ |
| 301 | static addStep<T>( |