From fcdd9b3f3d238de7aa0b665bf07fd5490ab30bce Mon Sep 17 00:00:00 2001
From: MichaelRedM <michael.rudolph@redmedical.de>
Date: Mon, 2 Mar 2020 13:08:27 +0100
Subject: [PATCH] feat(jasmine): add support for stopOnSpecFailure option

---
 lib/config.ts             | 5 +++++
 lib/frameworks/jasmine.js | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/lib/config.ts b/lib/config.ts
index c04849088..ee1ef0cee 100644
--- a/lib/config.ts
+++ b/lib/config.ts
@@ -648,6 +648,11 @@ export interface Config {
      * Set the randomization seed if randomization is turned on
      */
     seed?: string,
+    /**
+     * Enables failFast option in jasmine, which stops the execution of the suite whether the first
+     * spec is failed.
+     */
+    stopOnSpecFailure?: boolean,
   };
 
   /**
diff --git a/lib/frameworks/jasmine.js b/lib/frameworks/jasmine.js
index 821c12028..1e62598cf 100644
--- a/lib/frameworks/jasmine.js
+++ b/lib/frameworks/jasmine.js
@@ -100,6 +100,10 @@ exports.run = async function(runner, specs) {
     }
   }
 
+  if (jasmineNodeOpts.stopOnSpecFailure) {
+    jasmine.getEnv().stopOnSpecFailure(jasmineNodeOpts.stopOnSpecFailure);
+  }
+
   await runner.runTestPreparer();
   return new Promise((resolve, reject) => {
     if (jasmineNodeOpts && jasmineNodeOpts.defaultTimeoutInterval) {