Thanks to visit codestin.com
Credit goes to github.com

Skip to content

breaking - changes to testRunner.setup #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
breaking - changes to testRunner.setup
Signed-off-by: shmck <[email protected]>
  • Loading branch information
ShMcK committed Aug 2, 2020
commit 7da0e08f2bfbb2e6f9b17e46bdbc1374b1050607
10 changes: 5 additions & 5 deletions src/schema/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export default {
description: "An optional folder for the test runner",
examples: ["coderoad"],
},
setup: {
$ref: "#/definitions/setup_action_without_commits",
description:
"Setup actions or commands used for setting up the test runner on tutorial launch",
},
},
required: ["command", "args"],
},
setup: {
$ref: "#/definitions/setup_action_without_commits",
description:
"Setup actions or commands used for setting up the test runner on tutorial launch",
},
repo: {
type: "object",
description: "The repo holding the git commits for the tutorial",
Expand Down
10 changes: 5 additions & 5 deletions src/schema/tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export default {
description: "An optional folder for the test runner",
examples: ["coderoad"],
},
setup: {
$ref: "#/definitions/setup_action",
description:
"Setup commits or commands used for setting up the test runner on tutorial launch",
},
},
required: ["command", "args"],
},
setup: {
$ref: "#/definitions/setup_action",
description:
"Setup commits or commands used for setting up the test runner on tutorial launch",
},
repo: {
type: "object",
description: "The repo holding the git commits for the tutorial",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export function parse(params: ParseParams): any {
// add init commits
if (params.commits.INIT && params.commits.INIT.length) {
// @ts-ignore
parsed.config.testRunner.setup = {
...(parsed.config?.testRunner?.setup || {}),
parsed.config.setup = {
...(parsed.config?.setup || {}),
commits: params.commits.INIT,
};
}
Expand Down
8 changes: 2 additions & 6 deletions src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,10 @@ async function validate(args: string[]) {
await cherryPick(commits.INIT);

// run commands
if (skeleton.config?.testRunner?.setup?.commands) {
if (skeleton.config?.setup?.commands) {
console.info("-- Running commands...");

await runCommands(
skeleton.config?.testRunner?.setup?.commands,
// add optional setup directory
skeleton.config?.testRunner?.directory
);
await runCommands(skeleton.config?.setup?.commands);
}
}

Expand Down
18 changes: 9 additions & 9 deletions tests/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ Description.
tap: "--reporter=mocha-tap-reporter",
},
directory: "coderoad",
setup: {
commands: [],
},
},
setup: {
commands: [],
},
appVersions: {
vscode: ">=0.7.0",
Expand Down Expand Up @@ -1026,9 +1026,9 @@ Description.
tap: "--reporter=mocha-tap-reporter",
},
directory: "coderoad",
setup: {
commands: [],
},
},
setup: {
commands: [],
},
repo: {
uri: "https://path.to/repo",
Expand Down Expand Up @@ -1101,9 +1101,9 @@ Description.
tap: "--reporter=mocha-tap-reporter",
},
directory: "coderoad",
setup: {
commits: ["abcdef1", "123456789"],
},
},
setup: {
commits: ["abcdef1", "123456789"],
},
repo: {
uri: "https://path.to/repo",
Expand Down
7 changes: 4 additions & 3 deletions tests/skeleton.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ const validJson = {
config: {
testRunner: {
directory: "coderoad",
setup: {
commands: [],
},

args: {
filter: "--grep",
tap: "--reporter=mocha-tap-reporter",
},
command: "./node_modules/.bin/mocha",
},
setup: {
commands: [],
},
repo: {
uri: "http://github.com/somePath/toRepo.git",
branch: "codeBranch",
Expand Down
8 changes: 4 additions & 4 deletions tests/tutorial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const validJson: Partial<T.Tutorial> = {
tap: "tap",
},
directory: "coderoad",
setup: {
commits: ["abcdef1"],
commands: ["npm install"],
},
},
setup: {
commits: ["abcdef1"],
commands: ["npm install"],
},
repo: {
uri: "https://github.com/some-repo.git",
Expand Down
2 changes: 1 addition & 1 deletion typings/tutorial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type TutorialConfig = {
repo: TutorialRepo;
dependencies?: TutorialDependency[];
reset?: ConfigReset;
setup?: StepActions;
};

/** Logical groupings of tasks */
Expand Down Expand Up @@ -69,7 +70,6 @@ export interface TestRunnerConfig {
command: string;
args: TestRunnerArgs;
directory?: string;
setup?: StepActions;
}

export interface TutorialRepo {
Expand Down