Skip to content

Commit

Permalink
chore: adding url parsing for tracetest.ts serverless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Mar 7, 2024
1 parent 928038b commit cc02860
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion serverless/tracetest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { URL } from 'url';
import Tracetest from '@tracetest/client';
import { TestResource } from '@tracetest/client/dist/modules/openapi-client';
import { config } from 'dotenv';

config();

const { TRACETEST_API_TOKEN = '' } = process.env;
const [url = ''] = process.argv.slice(2);
const [raw = ''] = process.argv.slice(2);

let url = '';

try {
url = new URL(raw).origin;
} catch (error) {
console.error(
'The API Gateway URL is required as an argument. i.e: `npm test https://75yj353nn7.execute-api.us-east-1.amazonaws.com`'
);
process.exit(1);
}

const definition: TestResource = {
type: 'Test',
Expand Down

0 comments on commit cc02860

Please sign in to comment.