Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / karma-jasmine / lib / boot.js
1 /**
2  * Jasmine 2.0 standalone `boot.js` modified for Karma.
3  * This file is registered in `index.js`. This version
4  * does not include `HtmlReporter` setup.
5  */
6 (function(){
7
8   /**
9    * Require Jasmine's core files. Specifically, this requires and
10    * attaches all of Jasmine's code to the `jasmine` reference.
11    */
12   window.jasmine = jasmineRequire.core(jasmineRequire);
13
14
15   /**
16    * Create the Jasmine environment. This is used to run all specs
17    * in a project.
18    */
19   var env = jasmine.getEnv();
20
21   var focusedSuites = [];
22   var focusedSpecs  = [];
23   var insideFocusedSuite = false;
24
25   var focuseSpec = function(env, description, body) {
26     var spec = env.it(description, body);
27     focusedSpecs.push(spec.id);
28     return spec;
29   };
30
31   var focuseSuite = function(env, description, body) {
32     if (insideFocusedSuite) {
33       return env.describe(description, body);
34     }
35
36     insideFocusedSuite = true;
37     var suite = env.describe(description, body);
38     insideFocusedSuite = false
39     focusedSuites.push(suite.id);
40     return suite;
41   };
42
43   /**
44    * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require
45    * this hack.
46    */
47   window.setTimeout = window.setTimeout;
48   window.setInterval = window.setInterval;
49   window.clearTimeout = window.clearTimeout;
50   window.clearInterval = window.clearInterval;
51
52
53   /**
54    * Build up the functions that will be exposed as the Jasmine
55    * public interface.
56    */
57   var jasmineInterface = {
58     describe: function(description, specDefinitions) {
59       return env.describe(description, specDefinitions);
60     },
61
62     xdescribe: function(description, specDefinitions) {
63       return env.xdescribe(description, specDefinitions);
64     },
65
66     ddescribe: function(description, specDefinitions) {
67       return focuseSuite(env, description, specDefinitions);
68     },
69
70     it: function(desc, func) {
71       return env.it(desc, func);
72     },
73
74     xit: function(desc, func) {
75       return env.xit(desc, func);
76     },
77
78     iit: function(desc, func) {
79       return focuseSpec(env, desc, func);
80     },
81
82     beforeEach: function(beforeEachFunction) {
83       return env.beforeEach(beforeEachFunction);
84     },
85
86     afterEach: function(afterEachFunction) {
87       return env.afterEach(afterEachFunction);
88     },
89
90     expect: function(actual) {
91       return env.expect(actual);
92     },
93
94     pending: function() {
95       return env.pending();
96     },
97
98     spyOn: function(obj, methodName) {
99       return env.spyOn(obj, methodName);
100     },
101
102     jsApiReporter: new jasmine.JsApiReporter({
103       timer: new jasmine.Timer()
104     })
105   };
106
107
108   /**
109    * Add all of the Jasmine global/public interface to the proper
110    * global, so a project can use the public interface directly.
111    * For example, calling `describe` in specs instead of
112    * `jasmine.getEnv().describe`.
113    */
114   for (var property in jasmineInterface) {
115     if (jasmineInterface.hasOwnProperty(property)) {
116       window[property] = jasmineInterface[property];
117     }
118   }
119
120   env.executeFiltered = function() {
121     if (focusedSpecs.length) {
122       env.execute(focusedSpecs);
123     } else if (focusedSuites.length) {
124       env.execute(focusedSuites);
125     } else {
126       env.execute();
127     }
128   };
129
130
131   /**
132    * Expose the interface for adding custom equality testers.
133    */
134   jasmine.addCustomEqualityTester = function(tester) {
135     env.addCustomEqualityTester(tester);
136   };
137
138
139   /**
140    * Expose the interface for adding custom expectation matchers
141    */
142   jasmine.addMatchers = function(matchers) {
143     return env.addMatchers(matchers);
144   };
145
146
147   /**
148    * Expose the mock interface for the JavaScript timeout functions
149    */
150   jasmine.clock = function() {
151     return env.clock;
152   };
153
154
155 })();