Skip to content

Commit

Permalink
Refactored test variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed May 20, 2024
1 parent 38ed051 commit 286b899
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/buildtool.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import * as path from "path";
import * as buildtool from "./buildtool";

describe("command generation", () => {
const command = "addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool"
it("buildtool invocation with unspecified tasks and build options", () => {
const options: buildtool.RunBuildOptions = {
Tasks: "",
BuildOptions: "",
};

const actual = buildtool.generateCommand(options);
expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool")
expect(actual).toBe(command)
});

it("buildtool invocation with tasks specified", () => {
Expand All @@ -20,7 +21,7 @@ describe("command generation", () => {
};

const actual = buildtool.generateCommand(options);
expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test")
expect(actual).toBe(command + " compile test")
});

it("buildtool invocation with only build options", () => {
Expand All @@ -30,7 +31,7 @@ describe("command generation", () => {
};

const actual = buildtool.generateCommand(options);
expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool -continueOnFailure -skip check")
expect(actual).toBe(command + " -continueOnFailure -skip check")
});

it("buildtool invocation with specified tasks and build options", () => {
Expand All @@ -40,6 +41,6 @@ describe("command generation", () => {
};

const actual = buildtool.generateCommand(options);
expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test -continueOnFailure -skip check")
expect(actual).toBe(command + " compile test -continueOnFailure -skip check")
});
});
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ async function run() {
...process.env,
"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins",
}};

await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions);

await matlab.runCommand(
helperScript,
platform,
architecture,
(cmd,args)=>exec.exec(cmd,args,execOptions),
startupOptions
);
}

run().catch((e) => {
Expand Down

0 comments on commit 286b899

Please sign in to comment.