File tree Expand file tree Collapse file tree 2 files changed +63
-23
lines changed
Expand file tree Collapse file tree 2 files changed +63
-23
lines changed Original file line number Diff line number Diff line change 11version : 2
22jobs :
3- build :
3+ build_and_test :
44 working_directory : ~/mern-starter
55 # The primary container is an instance of the first image listed. The job's commands run in this container.
66 docker :
2020 key : dependency-cache-{{ checksum "package-lock.json" }}
2121 paths :
2222 - node_modules
23- test :
24- docker :
25- - image : circleci/node:latest
26- steps :
27- - checkout
28- # needed to add here also as both install and test are different docker instances and need to do same thing again in different instance
29- - run :
30- name : Update npm
31- command : ' sudo npm install -g npm@latest'
32- - restore_cache :
33- key : dependency-cache-{{ checksum "package-lock.json" }}
34- - run :
35- name : Install npm dependencies
36- command : npm install
37- - save_cache :
38- key : dependency-cache-{{ checksum "package-lock.json" }}
39- paths :
40- - node_modules
4123 - run :
4224 name : Test
4325 command : npm test
@@ -55,7 +37,4 @@ workflows:
5537 version : 2
5638 build_and_test :
5739 jobs :
58- - build
59- - test :
60- requires :
61- - build
40+ - build_and_test
Original file line number Diff line number Diff line change 1+ version : 2
2+ jobs :
3+ build :
4+ working_directory : ~/mern-starter
5+ # The primary container is an instance of the first image listed. The job's commands run in this container.
6+ docker :
7+ - image : circleci/node:latest
8+ # The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost.
9+ steps :
10+ - checkout
11+ - run :
12+ name : Update npm
13+ command : ' sudo npm install -g npm@latest'
14+ - restore_cache :
15+ key : dependency-cache-{{ checksum "package-lock.json" }}
16+ - run :
17+ name : Install npm dependencies
18+ command : npm install
19+ - save_cache :
20+ key : dependency-cache-{{ checksum "package-lock.json" }}
21+ paths :
22+ - node_modules
23+ test :
24+ docker :
25+ - image : circleci/node:latest
26+ steps :
27+ - checkout
28+ # needed to add here also as both install and test are different docker instances and need to do same thing again in different instance
29+ - run :
30+ name : Update npm
31+ command : ' sudo npm install -g npm@latest'
32+ - restore_cache :
33+ key : dependency-cache-{{ checksum "package-lock.json" }}
34+ - run :
35+ name : Install npm dependencies
36+ command : npm install
37+ - save_cache :
38+ key : dependency-cache-{{ checksum "package-lock.json" }}
39+ paths :
40+ - node_modules
41+ - run :
42+ name : Test
43+ command : npm test
44+ - run :
45+ name : Generate code coverage
46+ command : ' ./node_modules/.bin/nyc report --reporter=text-lcov'
47+ - store_artifacts :
48+ path : test-results.xml
49+ prefix : tests
50+ - store_artifacts :
51+ path : coverage
52+ prefix : coverage
53+
54+ workflows :
55+ version : 2
56+ build_and_test :
57+ jobs :
58+ - build
59+ - test :
60+ requires :
61+ - build
You can’t perform that action at this time.
0 commit comments