Skip to content

Commit

Permalink
fix: Karma respect cmd line parameters (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundthmcalculus authored Mar 11, 2024
1 parent a89988c commit 01e74b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions web/.config/karma.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = async (config) => {

client: {
clearContext: true, // will show the results in node once all the testcases are loaded
args: config.trinsic_environment ? ["--trinsic_environment="+config.trinsic_environment] : [],
},

reporters: ["kjhtml", "progress", "coverage"],
Expand Down
4 changes: 2 additions & 2 deletions web/test/WalletService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ describe("WalletService Unit Tests", () => {
ecosystemId = createResponse.ecosystem!.id!;
root.authToken = trinsic.provider().options.authToken;

var response = await trinsic
let response = await trinsic
.wallet()
.createWallet({ ecosystemId: ecosystemId });
.createWallet({ecosystemId: ecosystemId});
allison.authToken = response.authToken;

response = await trinsic
Expand Down
9 changes: 8 additions & 1 deletion web/test/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ export function getTestServerOptions(): TrinsicOptions {
let testEnv: string | undefined;
try {
// @ts-ignore
testEnv = __karma__.config.trinsic_environment.toLowerCase();
const argArr: string[] = __karma__?.config.args;
argArr?.forEach((arg: string) => {
let [key, value] = arg.split("=");
key = key.replace("--", "");
if (key === "trinsic_environment") testEnv = value;
});
// @ts-ignore
testEnv = __karma__.config.args.trinsic_environment.toLowerCase();
} catch (e) {
// @ts-ignore
if (typeof process !== "undefined" && process.env.trinsic_environment) {
Expand Down

0 comments on commit 01e74b2

Please sign in to comment.