From 2202bb07faffbe3e52adc113cb22298bb877aa3f Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 8 Aug 2014 08:49:12 +0200 Subject: [PATCH] feat(tests): gracefully handle missing jasmine-test-container-support This allows us to smoothly transition into a jasmine-free world. --- test/TestHelper.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/TestHelper.js b/test/TestHelper.js index cc45b86b..ea59812e 100644 --- a/test/TestHelper.js +++ b/test/TestHelper.js @@ -5,9 +5,12 @@ var _ = require('lodash'); var Modeler = require('../lib/Modeler'), Viewer = require('../lib/Viewer'); -// enhance jasmine with test container API -require('jasmine-test-container-support').extend(jasmine); - +try { + // enhance jasmine with test container API + require('jasmine-test-container-support').extend(jasmine); +} catch (e) { + // no test container :-( +} var OPTIONS, BPMN_JS; @@ -22,7 +25,14 @@ function options(opts) { function bootstrapBpmnJS(BpmnJS, options, locals) { - var testContainer = jasmine.getEnv().getTestContainer(); + var testContainer; + + try { + testContainer = jasmine.getEnv().getTestContainer(); + } catch (e) { + testContainer = document.createElement('div'); + document.body.appendChild(testContainer); + } var _options = options, _locals = locals;