summaryrefslogtreecommitdiffstats
path: root/karma.entry.js
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-05-21 20:19:48 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-21 20:19:48 +0000
commit05b37297177e8a342668c15e5d6f738b51f7aedd (patch)
treee236c96df52a13f935292db8aa73e84d0c41ad8a /karma.entry.js
parent884dfb789593d2a3cc319047ab1f0215778aec9f (diff)
parent1994c98063c27a41797dec01f2ca9fcbe33ceab0 (diff)
Merge "init commit onap ui"2.0.0-ONAPbeijing2.0.0-ONAP
Diffstat (limited to 'karma.entry.js')
-rw-r--r--karma.entry.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/karma.entry.js b/karma.entry.js
new file mode 100644
index 0000000..acd16cc
--- /dev/null
+++ b/karma.entry.js
@@ -0,0 +1,66 @@
+/****************************************************************************************
+ * Karma entry file.
+ * Starting point for pulling in our test and application files when using karma.
+ ***************************************************************************************/
+
+/**
+ * Load dependencies:
+ * - core-js/es6 - Javascript polyfills support es6 code on unsupported browsers
+ * - reflect-metadata - support for decorators and reflection.
+ * - Zone library - Monkey patch all asynchronous actions and jasmine so changes could be detected
+ * as well as long stack traces (To get the root cause of errors).
+ */
+
+require('core-js/es6');
+
+require('reflect-metadata');
+
+require('zone.js/dist/zone');
+require('zone.js/dist/async-test');
+require('zone.js/dist/fake-async-test');
+require('zone.js/dist/long-stack-trace-zone'); // Gives us a long backward trace of actions and errors
+require('zone.js/dist/proxy');
+require('zone.js/dist/sync-test');
+require('zone.js/dist/jasmine-patch');
+
+/**
+ * RxJS
+ */
+require('rxjs/Rx');
+
+
+/**
+ * Angular testing libraries dependencies
+ */
+const browserTesting = require('@angular/platform-browser-dynamic/testing');
+const coreTesting = require('@angular/core/testing');
+
+coreTesting.TestBed.initTestEnvironment(
+ browserTesting.BrowserDynamicTestingModule,
+ browserTesting.platformBrowserDynamicTesting()
+);
+
+/**
+ * Webpack method. requires all the files and subdirectories of a pattern.
+ * Checkout {@link https://webpack.github.io/docs/context.html}
+ */
+const context = require.context('./src/angular/', true, /\.spec\.ts$/);
+
+/**
+ * Get all the files, for each file, call the context function
+ * that will require the file and load it up here. Context will
+ * loop and require those spec files here
+ */
+function requireAll(requireContext) {
+ return requireContext.keys().map(requireContext);
+}
+
+requireAll(context);
+
+/**
+ * These lines are the Jasmine setup . We'll make sure that we get full stack traces when we have a
+ * problem and that Jasmine uses two seconds as its default timeout.
+ * The timeout is used when we test asynchronous processes. If we don't set this properly, some of our tests could hang forever.
+ */
+Error.stackTraceLimit = Infinity;
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 2000;