My Angular 4.0 project was created using angular-cli 1.0.
I am utilizing global variables such as API endpoints that change based on the environment during deployment through Octopus Deploy.
global-tokens.js
var apis = {
foo: 'http://foobar.foo'
}
Everything works fine when served locally or in upper environments, except when running unit tests.
I have already attempted to include global tokens js in the "files"
node in tsconfig.spec.json, in addition to "assets"
and "scripts"
in .angular.cli.json.
However, when running ng test
, I encounter:
Uncaught ReferenceError: apis is not defined
Upon further investigation, I noticed that global-tokens.js is not being included in index.html while debugging tests.
Any suggestions on how I can ensure that file is present in my testing environment?
edit: added scripts attempt