@@ -34,8 +34,8 @@ module.exports =
3434/******/ // the startup function
3535/******/ function startup ( ) {
3636/******/ // Load entry module and return exports
37- /******/ return __webpack_require__ ( 226 ) ;
38- /******/ }
37+ /******/ return __webpack_require__ ( 660 ) ;
38+ /******/ } ;
3939/******/
4040/******/ // run startup
4141/******/ return startup ( ) ;
@@ -57,7 +57,7 @@ module.exports = require("child_process");
5757
5858/***/ } ) ,
5959
60- /***/ 151 :
60+ /***/ 226 :
6161/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
6262
6363"use strict" ;
@@ -72,7 +72,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7272 } ) ;
7373} ;
7474Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
75- const command_1 = __webpack_require__ ( 176 ) ;
75+ const command_1 = __webpack_require__ ( 358 ) ;
7676const os = __webpack_require__ ( 87 ) ;
7777const path = __webpack_require__ ( 622 ) ;
7878/**
@@ -259,7 +259,7 @@ exports.getState = getState;
259259
260260/***/ } ) ,
261261
262- /***/ 176 :
262+ /***/ 358 :
263263/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
264264
265265"use strict" ;
@@ -332,69 +332,7 @@ function escape(s) {
332332
333333/***/ } ) ,
334334
335- /***/ 226 :
336- /***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
337-
338- const core = __webpack_require__ ( 151 )
339- const exec = __webpack_require__ ( 857 )
340-
341- const SCOPE_DSN = 'SCOPE_DSN'
342-
343- const DEFAULT_COMMAND =
344- 'npm test -- --testRunner=@undefinedlabs/scope-agent/jestTestRunner --runner=@undefinedlabs/scope-agent/jestRunner --setupFilesAfterEnv=@undefinedlabs/scope-agent/jestSetupTests'
345-
346- async function run ( ) {
347- try {
348- const command = core . getInput ( 'command' ) || DEFAULT_COMMAND
349- const dsn = core . getInput ( 'dsn' ) || process . env [ SCOPE_DSN ]
350-
351- if ( ! dsn ) {
352- throw Error ( 'Cannot find the Scope DSN' )
353- }
354-
355- let apiEndpoint , apiKey
356- try {
357- const { username, origin } = new URL ( dsn )
358- apiEndpoint = origin
359- apiKey = username
360- } catch ( e ) { }
361-
362- if ( ! apiEndpoint || ! apiKey ) {
363- throw Error ( 'SCOPE_DSN does not have the correct format' )
364- }
365-
366- console . log ( `Command: ${ command } ` )
367- if ( dsn ) {
368- console . log ( `DSN has been set.` )
369- }
370-
371- await exec . exec ( 'npm install --save-dev @undefinedlabs/scope-agent' , null , {
372- ignoreReturnCode : true ,
373- } )
374-
375- return ExecScopeRun ( command , apiEndpoint , apiKey )
376- } catch ( error ) {
377- core . setFailed ( error . message )
378- }
379- }
380-
381- function ExecScopeRun ( command = DEFAULT_COMMAND , apiEndpoint , apiKey ) {
382- return exec . exec ( command , null , {
383- env : {
384- ...process . env ,
385- SCOPE_API_ENDPOINT : apiEndpoint ,
386- SCOPE_APIKEY : apiKey ,
387- SCOPE_AUTO_INSTRUMENT : true ,
388- } ,
389- } )
390- }
391-
392- run ( )
393-
394-
395- /***/ } ) ,
396-
397- /***/ 448 :
335+ /***/ 541 :
398336/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
399337
400338"use strict" ;
@@ -989,7 +927,75 @@ module.exports = require("path");
989927
990928/***/ } ) ,
991929
992- /***/ 857 :
930+ /***/ 660 :
931+ /***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
932+
933+ const core = __webpack_require__ ( 226 )
934+ const exec = __webpack_require__ ( 730 )
935+
936+ const SCOPE_DSN = 'SCOPE_DSN'
937+
938+ const DEFAULT_ARGUMENTS = [
939+ '--' ,
940+ '--testRunner=@undefinedlabs/scope-agent/jestTestRunner' ,
941+ '--runner=@undefinedlabs/scope-agent/jestRunner' ,
942+ '--setupFilesAfterEnv=@undefinedlabs/scope-agent/jestSetupTests' ,
943+ ]
944+
945+ const DEFAULT_COMMAND = 'npm test'
946+
947+ async function run ( ) {
948+ try {
949+ const command = core . getInput ( 'command' ) || DEFAULT_COMMAND
950+ const dsn = core . getInput ( 'dsn' ) || process . env [ SCOPE_DSN ]
951+
952+ if ( ! dsn ) {
953+ throw Error ( 'Cannot find the Scope DSN' )
954+ }
955+
956+ let apiEndpoint , apiKey
957+ try {
958+ const { username, origin } = new URL ( dsn )
959+ apiEndpoint = origin
960+ apiKey = username
961+ } catch ( e ) { }
962+
963+ if ( ! apiEndpoint || ! apiKey ) {
964+ throw Error ( 'SCOPE_DSN does not have the correct format' )
965+ }
966+
967+ console . log ( `Command: ${ command } ` )
968+ if ( dsn ) {
969+ console . log ( `DSN has been set.` )
970+ }
971+
972+ await exec . exec ( 'npm install --save-dev @undefinedlabs/scope-agent' , null , {
973+ ignoreReturnCode : true ,
974+ } )
975+
976+ return ExecScopeRun ( command , apiEndpoint , apiKey )
977+ } catch ( error ) {
978+ core . setFailed ( error . message )
979+ }
980+ }
981+
982+ function ExecScopeRun ( command = DEFAULT_COMMAND , apiEndpoint , apiKey ) {
983+ return exec . exec ( command , DEFAULT_ARGUMENTS , {
984+ env : {
985+ ...process . env ,
986+ SCOPE_API_ENDPOINT : apiEndpoint ,
987+ SCOPE_APIKEY : apiKey ,
988+ SCOPE_AUTO_INSTRUMENT : true ,
989+ } ,
990+ } )
991+ }
992+
993+ run ( )
994+
995+
996+ /***/ } ) ,
997+
998+ /***/ 730 :
993999/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
9941000
9951001"use strict" ;
@@ -1004,7 +1010,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10041010 } ) ;
10051011} ;
10061012Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1007- const tr = __webpack_require__ ( 448 ) ;
1013+ const tr = __webpack_require__ ( 541 ) ;
10081014/**
10091015 * Exec a command.
10101016 * Output will be streamed to the live console.
0 commit comments