5252 name : dist.${{ matrix.target }}
5353 path : dist.${{ matrix.target }}
5454 if-no-files-found : error
55+
5556 test-standard :
5657 name : test standard
5758 runs-on : ubuntu-latest
9192 name : ${{ env.STANDARD_REPORTS_ARTIFACT }}
9293 path : ${{ env.REPORTS_DIR }}
9394 if-no-files-found : error
95+
9496 test-node :
9597 needs : [ 'build' ]
9698 name : test node (${{ matrix.node-version }}, ${{ matrix.os }})
@@ -168,26 +170,65 @@ jobs:
168170 with :
169171 project-token : ${{ env.CODACY_PROJECT_TOKEN }}
170172 coverage-reports : ${{ env.REPORTS_DIR }}/coverage/*/*
171- test-declaration :
173+
174+ examples-JS :
172175 needs : [ 'build' ]
173- name : digest declarations (TS${{ matrix.typescript-version }})
176+ name : example JS ${{ matrix.js-type }}
177+ runs-on : ubuntu-latest
178+ strategy :
179+ fail-fast : false
180+ matrix :
181+ js-type : [ 'cjs', 'mjs' ]
182+ env :
183+ EXAMPLE_DIR : examples/node-javascript
184+ steps :
185+ - name : Checkout
186+ # see https://github.com/actions/checkout
187+ uses : actions/checkout@v3
188+ - name : Setup Node.js ${{ env.NODE_ACTIVE_LTS }}
189+ # see https://github.com/actions/setup-node
190+ uses : actions/setup-node@v3
191+ with :
192+ node-version : ${{ env.NODE_ACTIVE_LTS }}
193+ - name : fetch build artifact 'node'
194+ # see https://github.com/actions/download-artifact
195+ uses : actions/download-artifact@v3
196+ with :
197+ name : dist.node
198+ path : dist.node
199+ - name : setup library
200+ run : npm i --ignore-scripts --omit=dev --include=optional
201+ - name : setup example project
202+ run : npm i --no-save
203+ working-directory : ${{ env.EXAMPLE_DIR }}
204+ - name : run example
205+ run : node -- 'example.${{ matrix.js-type }}'
206+ working-directory : ${{ env.EXAMPLE_DIR }}
207+
208+ example-typescript :
209+ needs : [ 'build' ]
210+ name : example TS${{ matrix.typescript-version }} ${{ matrix.js-type }}
174211 runs-on : ubuntu-latest
175212 strategy :
176213 fail-fast : false
177214 matrix :
178215 typescript-version :
179216 - ' ^5' # latest 5.X
180217 - ' ^4' # latest 4.X
181- # - '~4.0' # some 4.0.x
182218 - ' ^3' # latest 3.X
219+ js-type : [ 'cjs', 'mjs' ]
183220 include :
184221 # # some @types/node versions were incompatible or caused issues
185222 - typescript-version : ' ^3'
186223 nodeTypes-version : ' ^16'
187224 - typescript-version : ' 3.8.2' # lowest reasonable number that works
188- nodeTypes-version : ' ^16'
225+ js-type : ' cjs'
226+ nodeTypes-version : ' ^14'
227+ exclude :
228+ - typescript-version : ' ^3'
229+ js-type : ' mjs'
189230 env :
190- EXAMPLE_DIR : examples/node-typescript
231+ EXAMPLE_DIR : examples/node-typescript/example.${{ matrix.js-type }}
191232 timeout-minutes : 10
192233 steps :
193234 - name : Checkout
@@ -198,25 +239,33 @@ jobs:
198239 uses : actions/setup-node@v3
199240 with :
200241 node-version : ${{ env.NODE_ACTIVE_LTS }}
201- - name : fetch build artifact
242+ - name : fetch build artifact 'd'
202243 # see https://github.com/actions/download-artifact
203244 uses : actions/download-artifact@v3
204245 with :
205246 name : dist.d
206247 path : dist.d
248+ - name : fetch build artifact 'node'
249+ # see https://github.com/actions/download-artifact
250+ uses : actions/download-artifact@v3
251+ with :
252+ name : dist.node
253+ path : dist.node
207254 - name : setup library
208- run : npm i --ignore-scripts --omit=dev
255+ run : npm i --ignore-scripts --omit=dev --include=optional
209256 - name : setup example project
210257 run : >
211258 npm i --no-save
212259 'typescript@${{ matrix.typescript-version }}'
213260 '@types/node@${{ matrix.nodeTypes-version || env.NODE_ACTIVE_LTS }}'
214261 working-directory : ${{ env.EXAMPLE_DIR }}
215- - run : npm ls
216- working-directory : ${{ env.EXAMPLE_DIR }}
217- - name : use type declarations
262+ - name : build example
218263 run : npm run build
219264 working-directory : ${{ env.EXAMPLE_DIR }}
265+ - name : run example
266+ run : npm run example
267+ working-directory : ${{ env.EXAMPLE_DIR }}
268+
220269 api-doc :
221270 name : api-doc ${{ matrix.target }}
222271 runs-on : " ubuntu-latest"
0 commit comments