Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Commit ff3fc23

Browse files
fix arguments
1 parent ad2466f commit ff3fc23

File tree

2 files changed

+85
-73
lines changed

2 files changed

+85
-73
lines changed

dist/index.js

+76-70
Original file line numberDiff line numberDiff line change
@@ -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
};
7474
Object.defineProperty(exports, "__esModule", { value: true });
75-
const command_1 = __webpack_require__(176);
75+
const command_1 = __webpack_require__(358);
7676
const os = __webpack_require__(87);
7777
const 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
};
10061012
Object.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.

src/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ const exec = require('@actions/exec')
33

44
const SCOPE_DSN = 'SCOPE_DSN'
55

6-
const DEFAULT_COMMAND =
7-
'npm test -- --testRunner=@undefinedlabs/scope-agent/jestTestRunner --runner=@undefinedlabs/scope-agent/jestRunner --setupFilesAfterEnv=@undefinedlabs/scope-agent/jestSetupTests'
6+
const DEFAULT_ARGUMENTS = [
7+
'--',
8+
'--testRunner=@undefinedlabs/scope-agent/jestTestRunner',
9+
'--runner=@undefinedlabs/scope-agent/jestRunner',
10+
'--setupFilesAfterEnv=@undefinedlabs/scope-agent/jestSetupTests',
11+
]
12+
13+
const DEFAULT_COMMAND = 'npm test'
814

915
async function run() {
1016
try {
@@ -42,7 +48,7 @@ async function run() {
4248
}
4349

4450
function ExecScopeRun(command = DEFAULT_COMMAND, apiEndpoint, apiKey) {
45-
return exec.exec(command, null, {
51+
return exec.exec(command, DEFAULT_ARGUMENTS, {
4652
env: {
4753
...process.env,
4854
SCOPE_API_ENDPOINT: apiEndpoint,

0 commit comments

Comments
 (0)