redoc/tests/spec-bundle.js

79 lines
2.6 KiB
JavaScript
Raw Normal View History

2016-08-28 21:46:10 +03:00
'use strict';
Error.stackTraceLimit = Infinity;
require('core-js/es6');
require('core-js/es7/reflect');
// Typescript emit helpers polyfill
require('ts-helpers');
require('zone.js/dist/zone');
require('zone.js/dist/long-stack-trace-zone');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
require('zone.js/dist/sync-test');
require('zone.js/dist/proxy');
require('zone.js/dist/jasmine-patch');
require('../lib/vendor');
var TestBed = require('@angular/core/testing').TestBed;
2016-10-23 20:18:42 +03:00
var ErrorHandler = require('@angular/core').ErrorHandler;
2016-08-28 21:46:10 +03:00
var BrowserDynamicTestingModule = require('@angular/platform-browser-dynamic/testing').BrowserDynamicTestingModule;
var platformBrowserDynamicTesting = require('@angular/platform-browser-dynamic/testing').platformBrowserDynamicTesting;
2016-10-31 11:15:04 +03:00
2016-10-23 20:18:42 +03:00
var SpecManager = require('../lib/utils/spec-manager').SpecManager;
2016-10-31 11:15:04 +03:00
var services = require('../lib/services/index');
2016-08-28 21:46:10 +03:00
var REDOC_PIPES = require('../lib/utils/pipes').REDOC_PIPES;
2016-10-31 11:15:04 +03:00
var sharedComponents = require('../lib/shared/components/');
var REDOC_COMMON_DIRECTIVES = sharedComponents.REDOC_COMMON_DIRECTIVES;
var components = require('../lib/components/');
var REDOC_DIRECTIVES = components.REDOC_DIRECTIVES;
2016-08-28 21:46:10 +03:00
TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
beforeEach(function() {
TestBed.configureTestingModule({
providers: [
SpecManager,
2016-10-23 20:18:42 +03:00
services.AppStateService,
2016-08-28 21:46:10 +03:00
services.ScrollService,
services.Hash,
services.MenuService,
services.WarningsService,
2016-10-23 20:18:42 +03:00
services.OptionsService,
2016-10-31 11:15:04 +03:00
services.ComponentParser,
services.ContentProjector,
2017-01-28 16:57:22 +03:00
services.Marker,
services.SearchService,
2016-11-24 16:29:29 +03:00
{ provide: sharedComponents.LazyTasksService, useClass: sharedComponents.LazyTasksServiceSync },
2016-10-31 11:15:04 +03:00
{ provide: ErrorHandler, useClass: services.CustomErrorHandler },
{ provide: services.COMPONENT_PARSER_ALLOWED, useValue: { 'security-definitions': components.SecurityDefinitions }}
2016-08-28 21:46:10 +03:00
],
declarations: [REDOC_PIPES, REDOC_DIRECTIVES, REDOC_COMMON_DIRECTIVES]
});
2016-10-31 11:15:04 +03:00
TestBed.overrideModule(BrowserDynamicTestingModule, {
set: {
entryComponents: [ sharedComponents.DynamicNg2Wrapper, components.SecurityDefinitions ]
},
});
2016-08-28 21:46:10 +03:00
});
var testContext = require.context('..', 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 wil);
* loop and require those spec files here
*/
function requireAll(requireContext) {
return requireContext.keys().map(requireContext);
}
// requires and returns all modules that match
var modules = requireAll(testContext);