From 71ef27f4d1ecd2d7d4ec785f01a8995ae4d80bc2 Mon Sep 17 00:00:00 2001 From: Steve Fenton Date: Sun, 22 Oct 2017 19:47:07 +0100 Subject: [PATCH] Further adjustments for promise return, Issue #29 --- README.md | 8 +++++++- TypeSpec/app.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a3343e1..3312a40 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,10 @@ in your file, you should use the import style shown for CalculatorSteps for your AutoRunner.run( '/Specifications/Basic.txt' - ); + ).then(() => { + // The promises resolves after all specifications have run + // including async steps. + }); ## Step Definitions @@ -215,6 +218,9 @@ The composition of the test is shown below. You pass the list of specifications into the `run` method. Each specification is loaded, parsed, and executed. +The `run` method returns a promise, should you need to execute code after the test. This allows you to run code after +all specifications have run, including where there are async steps. + ## Excluding Specifications You can exclude specifications by tag, by passing the tags to exclude to the SpecRunner before calling `runner.run(...`: diff --git a/TypeSpec/app.ts b/TypeSpec/app.ts index d909850..6087631 100644 --- a/TypeSpec/app.ts +++ b/TypeSpec/app.ts @@ -33,5 +33,10 @@ AutoRunner.run( '/Specifications/MissingStep.txt', //Excluded by tag - '/Specifications/ExcludedByTag.txt' -).then(() => { alert('Done'); }).catch((error) => { alert('Error! ' + error); }); + '/Specifications/ExcludedByTag.txt') + .then(() => { + alert('Done'); + }) + .catch((error) => { + alert('Error! ' + error); + });