Given angular version 4.2.4 with angular-cli (version 1.1.3) and following code:
import languagesJsonRaw from './languages/en.json';
import countriesJsonRaw from './countries/en.json';
export const languages = prepareLanguages(languagesJsonRaw);
export const countries = prepareCountries(countriesJsonRaw);
This works when I run npm start (which triggers ng serve) - languages and countries are available to the application.
When I run npm test, which basically triggers:
ng test --reporters dots,html --browsers Chrome --watch
then languagesJsonRaw and countriesJsonRaw are undefined.
How can I provide those files also to the test runner? I don't think we needed to do anything special for them to be available from ng serve or ng build, works even with AOT.
It's default angular-cli project, so test runner is karma I think.
Github Issue: https://github.com/angular/angular-cli/issues/6786