mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
include all modules in coverage
This commit is contained in:
@@ -38,25 +38,11 @@ testing.TestBed.initTestEnvironment(
|
||||
browser.platformBrowserDynamicTesting()
|
||||
);
|
||||
|
||||
/*
|
||||
* Ok, this is kinda crazy. We can use the context method on
|
||||
* require that webpack created in order to tell webpack
|
||||
* what files we actually want to require or import.
|
||||
* Below, context will be a function/object with file names as keys.
|
||||
* Using that regex we are saying look in ../src then find
|
||||
* any file that ends with spec.ts and get its path. By passing in true
|
||||
* we say do this recursively
|
||||
*/
|
||||
var testContext = require.context('./src', 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);
|
||||
}
|
||||
var tests = require.context('./src', true, /\.spec\.ts$/);
|
||||
|
||||
// requires and returns all modules that match
|
||||
var modules = requireAll(testContext);
|
||||
tests.keys().forEach(tests);
|
||||
|
||||
const components = require.context('./src/app', true, /\.module\.ts$/);
|
||||
|
||||
components.keys().forEach(components);
|
||||
|
Reference in New Issue
Block a user