Implement GitLab CI on Angular tests
This MR implements GitLab CI on Angular tests
How/Why has this been done:
- Added .gitlab.ci.yml with two (optional third) stages
-Build: to build the application and install node modules
-Lint: to run a node linter based on project preferences to ensure our code is homogeneous and not messy [OPTIONAL]
-Test: to run Karma unit tests - Modified karma.conf.js to include ChromeHeadless
- Docker image used is node:carbon which includes the stable version of Node
- In the testing phase, the dependencies for Puppeteer and ChromeHeadless are installed
- Unit tests run on ChromeHeadless, a headless version of Chrome which Karma launches and performs the tests on
-Chrome Headless is run by Google's Puppeteer which was been added as a dependency -Chrome Headless was recommended after PhantomJS's development was ceased and it promises to be faster overall
-Chrome Headless also allows e2e tests to be performed in the future if we decide to implement them - Output is displayed in the terminal and prints a log to help us identify any issues
- A long list of flags have been added to help Chrome launch as minimally as possible and prevent issues
Current Status/Notes:
- Currently available tests are the auto-generated ones after component generation and test:
-Creation of the component -
Unit tests are FAILING with some of the more common issues being:FIXED IN !97 (closed)
-Missing imports on the TestBed (Routes, Pipes, Services, Components not being part of the module)#117 (closed)
On the bright side:
- Semester Pipe is the only project file that has proper tests running and passing successfully! Be sure to create tests for your code in a similar manner
Edited by George Katsikas