@@ -4,7 +4,7 @@ import toReadableStream from 'to-readable-stream';
44import { default as hookStd } from 'hook-std' ;
55import * as glob from '@actions/glob' ;
66import sinon from 'sinon' ;
7- import { default as os , tmpdir } from 'node:os' ;
7+ import { default as os , tmpdir , EOL } from 'node:os' ;
88import { join as joinPath } from 'node:path' ;
99import {
1010 writeFileSync ,
@@ -109,22 +109,23 @@ test('🧪 run() should run the CC reporter (happy path).', async (t) => {
109109
110110 t . equal (
111111 capturedOutput ,
112- // prettier-ignore
113- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
114- ::debug::✅ CC Reporter downloaded...
115- ::debug::ℹ️ Verifying CC Reporter checksum...
116- ::debug::✅ CC Reported checksum verification completed...
117- ::debug::ℹ️ Verifying CC Reporter GPG signature...
118- ::debug::✅ CC Reported GPG signature verification completed...
119- [command]${ DEFAULT_WORKDIR } /test.sh before-build\nbefore-build
120- ::debug::✅ CC Reporter before-build checkin completed...
121- [command]${ DEFAULT_ECHO } \'coverage ok\'
122- \'coverage ok\'
123- ::debug::✅ Coverage run completed...
124- [command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0
125- after-build --exit-code 0
126- ::debug::✅ CC Reporter after-build checkin completed!
127- ` ,
112+ [
113+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
114+ `::debug::✅ CC Reporter downloaded...` ,
115+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
116+ `::debug::✅ CC Reported checksum verification completed...` ,
117+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
118+ `::debug::✅ CC Reported GPG signature verification completed...` ,
119+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build\nbefore-build` ,
120+ `::debug::✅ CC Reporter before-build checkin completed...` ,
121+ `[command]${ DEFAULT_ECHO } 'coverage ok'` ,
122+ `'coverage ok'` ,
123+ `::debug::✅ Coverage run completed...` ,
124+ `[command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0` ,
125+ `after-build --exit-code 0` ,
126+ `::debug::✅ CC Reporter after-build checkin completed!` ,
127+ `` ,
128+ ] . join ( EOL ) ,
128129 'should execute all steps.'
129130 ) ;
130131 unlinkSync ( filePath ) ;
@@ -173,18 +174,20 @@ test('🧪 run() should run the CC reporter without verification if configured.'
173174
174175 t . equal (
175176 capturedOutput ,
176- // prettier-ignore
177- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
178- ::debug::✅ CC Reporter downloaded...
179- [command]${ DEFAULT_WORKDIR } /test.sh before-build\nbefore-build
180- ::debug::✅ CC Reporter before-build checkin completed...
181- [command]${ DEFAULT_ECHO } \'coverage ok\'
182- \'coverage ok\'
183- ::debug::✅ Coverage run completed...
184- [command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0
185- after-build --exit-code 0
186- ::debug::✅ CC Reporter after-build checkin completed!
187- ` ,
177+ [
178+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
179+ `::debug::✅ CC Reporter downloaded...` ,
180+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
181+ `before-build` ,
182+ `::debug::✅ CC Reporter before-build checkin completed...` ,
183+ `[command]${ DEFAULT_ECHO } 'coverage ok'` ,
184+ `'coverage ok'` ,
185+ `::debug::✅ Coverage run completed...` ,
186+ `[command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0` ,
187+ `after-build --exit-code 0` ,
188+ `::debug::✅ CC Reporter after-build checkin completed!` ,
189+ `` ,
190+ ] . join ( EOL ) ,
188191 'should execute all steps (except verification).'
189192 ) ;
190193 unlinkSync ( filePath ) ;
@@ -247,20 +250,22 @@ test('🧪 run() should run the CC reporter without a coverage command.', async
247250
248251 t . equal (
249252 capturedOutput ,
250- // prettier-ignore
251- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
252- ::debug::✅ CC Reporter downloaded...
253- ::debug::ℹ️ Verifying CC Reporter checksum...
254- ::debug::✅ CC Reported checksum verification completed...
255- ::debug::ℹ️ Verifying CC Reporter GPG signature...
256- ::debug::✅ CC Reported GPG signature verification completed...
257- [command]${ DEFAULT_WORKDIR } /test.sh before-build\nbefore-build
258- ::debug::✅ CC Reporter before-build checkin completed...
259- ℹ️ 'coverageCommand' not set, so skipping building coverage report!
260- [command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0
261- after-build --exit-code 0
262- ::debug::✅ CC Reporter after-build checkin completed!
263- ` ,
253+ [
254+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
255+ `::debug::✅ CC Reporter downloaded...` ,
256+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
257+ `::debug::✅ CC Reported checksum verification completed...` ,
258+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
259+ `::debug::✅ CC Reported GPG signature verification completed...` ,
260+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
261+ `before-build` ,
262+ `::debug::✅ CC Reporter before-build checkin completed...` ,
263+ `ℹ️ 'coverageCommand' not set, so skipping building coverage report!` ,
264+ `[command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0` ,
265+ `after-build --exit-code 0` ,
266+ `::debug::✅ CC Reporter after-build checkin completed!` ,
267+ `` ,
268+ ] . join ( EOL ) ,
264269 'should execute all steps (except running the coverage command).'
265270 ) ;
266271 unlinkSync ( filePath ) ;
@@ -360,28 +365,29 @@ test('🧪 run() should convert patterns to locations.', async (t) => {
360365 ) ;
361366 t . equal (
362367 capturedOutput ,
363- // prettier-ignore
364- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
365- ::debug::✅ CC Reporter downloaded...
366- ::debug::ℹ️ Verifying CC Reporter checksum...
367- ::debug::✅ CC Reported checksum verification completed...
368- ::debug::ℹ️ Verifying CC Reporter GPG signature...
369- ::debug::✅ CC Reported GPG signature verification completed...
370- [command]${ DEFAULT_WORKDIR } /test.sh before-build
371- before-build
372- ::debug::✅ CC Reporter before-build checkin completed...
373- ℹ️ 'coverageCommand' not set, so skipping building coverage report!
374- ::debug::Parsing 2 coverage location(s) — ${ DEFAULT_WORKDIR } /file-a.lcov:lcov,${ DEFAULT_WORKDIR } /file-b.lcov:lcov (object)
375- [command]${ DEFAULT_WORKDIR } /test.sh format-coverage ${ DEFAULT_WORKDIR } /file-a.lcov -t lcov -o codeclimate.0.json
376- format-coverage ${ DEFAULT_WORKDIR } /file-a.lcov -t lcov -o codeclimate.0.json
377- [command]${ DEFAULT_WORKDIR } /test.sh format-coverage ${ DEFAULT_WORKDIR } /file-b.lcov -t lcov -o codeclimate.1.json
378- format-coverage ${ DEFAULT_WORKDIR } /file-b.lcov -t lcov -o codeclimate.1.json
379- [command]${ DEFAULT_WORKDIR } /test.sh sum-coverage codeclimate.0.json codeclimate.1.json -p 2 -o coverage.total.json
380- sum-coverage codeclimate.0.json codeclimate.1.json -p 2 -o coverage.total.json
381- [command]${ DEFAULT_WORKDIR } /test.sh upload-coverage -i coverage.total.json
382- upload-coverage -i coverage.total.json
383- ::debug::✅ CC Reporter upload coverage completed!
384- ` ,
368+ [
369+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
370+ `::debug::✅ CC Reporter downloaded...` ,
371+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
372+ `::debug::✅ CC Reported checksum verification completed...` ,
373+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
374+ `::debug::✅ CC Reported GPG signature verification completed...` ,
375+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
376+ `before-build` ,
377+ `::debug::✅ CC Reporter before-build checkin completed...` ,
378+ `ℹ️ 'coverageCommand' not set, so skipping building coverage report!` ,
379+ `::debug::Parsing 2 coverage location(s) — ${ DEFAULT_WORKDIR } /file-a.lcov:lcov,${ DEFAULT_WORKDIR } /file-b.lcov:lcov (object)` ,
380+ `[command]${ DEFAULT_WORKDIR } /test.sh format-coverage ${ DEFAULT_WORKDIR } /file-a.lcov -t lcov -o codeclimate.0.json` ,
381+ `format-coverage ${ DEFAULT_WORKDIR } /file-a.lcov -t lcov -o codeclimate.0.json` ,
382+ `[command]${ DEFAULT_WORKDIR } /test.sh format-coverage ${ DEFAULT_WORKDIR } /file-b.lcov -t lcov -o codeclimate.1.json` ,
383+ `format-coverage ${ DEFAULT_WORKDIR } /file-b.lcov -t lcov -o codeclimate.1.json` ,
384+ `[command]${ DEFAULT_WORKDIR } /test.sh sum-coverage codeclimate.0.json codeclimate.1.json -p 2 -o coverage.total.json` ,
385+ `sum-coverage codeclimate.0.json codeclimate.1.json -p 2 -o coverage.total.json` ,
386+ `[command]${ DEFAULT_WORKDIR } /test.sh upload-coverage -i coverage.total.json` ,
387+ `upload-coverage -i coverage.total.json` ,
388+ `::debug::✅ CC Reporter upload coverage completed!` ,
389+ `` ,
390+ ] . join ( EOL ) ,
385391 'should execute all steps (except running the coverage command).'
386392 ) ;
387393 unlinkSync ( filePath ) ;
@@ -467,25 +473,26 @@ test('🧪 run() should correctly switch the working directory if given.', async
467473
468474 t . equal (
469475 capturedOutput ,
470- // prettier-ignore
471- `::debug::Changing working directory to ${ CUSTOM_WORKDIR }
472- ::debug::✅ Changing working directory completed...
473- ::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
474- ::debug::✅ CC Reporter downloaded...
475- ::debug::ℹ️ Verifying CC Reporter checksum...
476- ::debug::✅ CC Reported checksum verification completed...
477- ::debug::ℹ️ Verifying CC Reporter GPG signature...
478- ::debug::✅ CC Reported GPG signature verification completed...
479- [command]${ CUSTOM_WORKDIR } /test.sh before-build
480- before-build
481- ::debug::✅ CC Reporter before-build checkin completed...
482- [command]${ DEFAULT_ECHO } 'coverage ok'
483- 'coverage ok'
484- ::debug::✅ Coverage run completed...
485- [command]${ CUSTOM_WORKDIR } /test.sh after-build --exit-code 0
486- after-build --exit-code 0
487- ::debug::✅ CC Reporter after-build checkin completed!
488- ` ,
476+ [
477+ `::debug::Changing working directory to ${ CUSTOM_WORKDIR } ` ,
478+ `::debug::✅ Changing working directory completed...` ,
479+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
480+ `::debug::✅ CC Reporter downloaded...` ,
481+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
482+ `::debug::✅ CC Reported checksum verification completed...` ,
483+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
484+ `::debug::✅ CC Reported GPG signature verification completed...` ,
485+ `[command]${ CUSTOM_WORKDIR } /test.sh before-build` ,
486+ `before-build` ,
487+ `::debug::✅ CC Reporter before-build checkin completed...` ,
488+ `[command]${ DEFAULT_ECHO } 'coverage ok'` ,
489+ `'coverage ok'` ,
490+ `::debug::✅ Coverage run completed...` ,
491+ `[command]${ CUSTOM_WORKDIR } /test.sh after-build --exit-code 0` ,
492+ `after-build --exit-code 0` ,
493+ `::debug::✅ CC Reporter after-build checkin completed!` ,
494+ `` ,
495+ ] . join ( EOL ) ,
489496 'should execute all steps.'
490497 ) ;
491498 unlinkSync ( filePath ) ;
@@ -536,13 +543,14 @@ test('🧪 run() should throw an error if the checksum verification fails.', asy
536543
537544 t . equal (
538545 capturedOutput ,
539- // prettier-ignore
540- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
541- ::debug::✅ CC Reporter downloaded...
542- ::debug::ℹ️ Verifying CC Reporter checksum...
543- ::error::CC Reporter checksum does not match!
544- ::error::🚨 CC Reporter checksum verfication failed!
545- ` ,
546+ [
547+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
548+ `::debug::✅ CC Reporter downloaded...` ,
549+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
550+ `::error::CC Reporter checksum does not match!` ,
551+ `::error::🚨 CC Reporter checksum verfication failed!` ,
552+ `` ,
553+ ] . join ( EOL ) ,
546554 'should correctly throw the error.'
547555 ) ;
548556 unlinkSync ( filePath ) ;
@@ -611,15 +619,16 @@ test('🧪 run() should throw an error if the GPG signature verification fails.'
611619
612620 t . equal (
613621 capturedOutput ,
614- // prettier-ignore
615- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
616- ::debug::✅ CC Reporter downloaded...
617- ::debug::ℹ️ Verifying CC Reporter checksum...
618- ::debug::✅ CC Reported checksum verification completed...
619- ::debug::ℹ️ Verifying CC Reporter GPG signature...
620- ::error::CC Reporter GPG signature is invalid!
621- ::error::🚨 CC Reporter GPG signature verfication failed!
622- ` ,
622+ [
623+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
624+ `::debug::✅ CC Reporter downloaded...` ,
625+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
626+ `::debug::✅ CC Reported checksum verification completed...` ,
627+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
628+ `::error::CC Reporter GPG signature is invalid!` ,
629+ `::error::🚨 CC Reporter GPG signature verfication failed!` ,
630+ `` ,
631+ ] . join ( EOL ) ,
623632 'should correctly throw the error.'
624633 ) ;
625634 unlinkSync ( filePath ) ;
@@ -690,17 +699,18 @@ test('🧪 run() should throw an error if the before-build step throws an error.
690699
691700 t . equal (
692701 capturedOutput ,
693- // prettier-ignore
694- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
695- ::debug::✅ CC Reporter downloaded...
696- ::debug::ℹ️ Verifying CC Reporter checksum...
697- ::debug::✅ CC Reported checksum verification completed...
698- ::debug::ℹ️ Verifying CC Reporter GPG signature...
699- ::debug::✅ CC Reported GPG signature verification completed...
700- [command]${ DEFAULT_WORKDIR } /test.sh before-build
701- ::error::The process '${ DEFAULT_WORKDIR } /test.sh' failed with exit code 69
702- ::error::🚨 CC Reporter before-build checkin failed!
703- ` ,
702+ [
703+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
704+ `::debug::✅ CC Reporter downloaded...` ,
705+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
706+ `::debug::✅ CC Reported checksum verification completed...` ,
707+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
708+ `::debug::✅ CC Reported GPG signature verification completed...` ,
709+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
710+ `::error::The process '${ DEFAULT_WORKDIR } /test.sh' failed with exit code 69` ,
711+ `::error::🚨 CC Reporter before-build checkin failed!` ,
712+ `` ,
713+ ] . join ( EOL ) ,
704714 'should correctly throw the error.'
705715 ) ;
706716 unlinkSync ( filePath ) ;
@@ -771,22 +781,23 @@ test('🧪 run() should throw an error if the after-build step throws an error.'
771781
772782 t . equal (
773783 capturedOutput ,
774- // prettier-ignore
775- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
776- ::debug::✅ CC Reporter downloaded...
777- ::debug::ℹ️ Verifying CC Reporter checksum...
778- ::debug::✅ CC Reported checksum verification completed...
779- ::debug::ℹ️ Verifying CC Reporter GPG signature...
780- ::debug::✅ CC Reported GPG signature verification completed...
781- [command]${ DEFAULT_WORKDIR } /test.sh before-build
782- ::debug::✅ CC Reporter before-build checkin completed...
783- [command]${ DEFAULT_ECHO } 'coverage ok'
784- 'coverage ok'
785- ::debug::✅ Coverage run completed...
786- [command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0
787- ::error::The process '${ DEFAULT_WORKDIR } /test.sh' failed with exit code 69
788- ::error::🚨 CC Reporter after-build checkin failed!
789- ` ,
784+ [
785+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
786+ `::debug::✅ CC Reporter downloaded...` ,
787+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
788+ `::debug::✅ CC Reported checksum verification completed...` ,
789+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
790+ `::debug::✅ CC Reported GPG signature verification completed...` ,
791+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
792+ `::debug::✅ CC Reporter before-build checkin completed...` ,
793+ `[command]${ DEFAULT_ECHO } 'coverage ok'` ,
794+ `'coverage ok'` ,
795+ `::debug::✅ Coverage run completed...` ,
796+ `[command]${ DEFAULT_WORKDIR } /test.sh after-build --exit-code 0` ,
797+ `::error::The process '${ DEFAULT_WORKDIR } /test.sh' failed with exit code 69` ,
798+ `::error::🚨 CC Reporter after-build checkin failed!` ,
799+ `` ,
800+ ] . join ( EOL ) ,
790801 'should correctly throw the error.'
791802 ) ;
792803 unlinkSync ( filePath ) ;
@@ -853,19 +864,20 @@ test('🧪 run() should exit cleanly when the coverage command fails.', async (t
853864 stdHook . unhook ( ) ;
854865 t . equal (
855866 capturedOutput ,
856- // prettier-ignore
857- `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
858- ::debug::✅ CC Reporter downloaded...
859- ::debug::ℹ️ Verifying CC Reporter checksum...
860- ::debug::✅ CC Reported checksum verification completed...
861- ::debug::ℹ️ Verifying CC Reporter GPG signature...
862- ::debug::✅ CC Reported GPG signature verification completed...
863- [command]${ DEFAULT_WORKDIR } /test.sh before-build
864- before-build
865- ::debug::✅ CC Reporter before-build checkin completed...
866- ::error::Unable to locate executable file: ${ COVERAGE_COMMAND } . Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
867- ::error::🚨 Coverage run failed!
868- ` ,
867+ [
868+ `::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...` ,
869+ `::debug::✅ CC Reporter downloaded...` ,
870+ `::debug::ℹ️ Verifying CC Reporter checksum...` ,
871+ `::debug::✅ CC Reported checksum verification completed...` ,
872+ `::debug::ℹ️ Verifying CC Reporter GPG signature...` ,
873+ `::debug::✅ CC Reported GPG signature verification completed...` ,
874+ `[command]${ DEFAULT_WORKDIR } /test.sh before-build` ,
875+ `before-build` ,
876+ `::debug::✅ CC Reporter before-build checkin completed...` ,
877+ `::error::Unable to locate executable file: ${ COVERAGE_COMMAND } . Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.` ,
878+ `::error::🚨 Coverage run failed!` ,
879+ `` ,
880+ ] . join ( EOL ) ,
869881 'should fail correctly on wrong/invalid coverage command.'
870882 ) ;
871883 } finally {
0 commit comments