Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/init hashes#19

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromfeature/init-hashes
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from1 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
PrevPrevious commit
load init commits
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 1, 2020
commit33d1f9ea8576a70495b29395745807737e79a612
22 changes: 15 additions & 7 deletionssrc/utils/parse.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,10 +100,20 @@ export function parse(params: ParseParams): any {
const parsed: Partial<T.Tutorial> = {
version: params.config.version,
summary: mdContent.summary,
config: params.config.config,
config: params.config.config || {},
levels: [],
};

// add init commits
if (params.commits.INIT && params.commits.INIT.length) {
console.log(JSON.stringify(parsed.config?.testRunner));
// @ts-ignore
parsed.config.testRunner.setup = {
...(parsed.config?.testRunner?.setup || {}),
commits: params.commits.INIT,
};
}

// merge content and tutorial
if (params.config.levels && params.config.levels.length) {
parsed.levels = params.config.levels
Expand All@@ -119,12 +129,10 @@ export function parse(params: ParseParams): any {
// add level setup commits
const levelSetupKey = level.id;
if (params.commits[levelSetupKey]) {
if (!level.setup) {
level.setup = {
commits: [],
};
}
level.setup.commits = params.commits[levelSetupKey];
level.setup = {
...(level.setup || {}),
commits: params.commits[levelSetupKey],
};
}

// add level step commits
Expand Down
75 changes: 72 additions & 3 deletionstests/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -524,7 +524,6 @@ The third step
text: md,
config,
commits: {
INIT: [""],
L1S1Q: ["abcdef1", "123456789"],
L1S1A: ["1fedcba", "987654321"],
L1S2Q: ["2abcdef"],
Expand DownExpand Up@@ -685,7 +684,6 @@ Description.
},
directory: "coderoad",
setup: {
commits: ["abcdef1"],
commands: [],
},
},
Expand DownExpand Up@@ -722,7 +720,6 @@ Description.
},
directory: "coderoad",
setup: {
commits: ["abcdef1"],
commands: [],
},
},
Expand All@@ -743,4 +740,76 @@ Description.
};
expect(result.config).toEqual(expected.config);
});

it("should parse the tutorial config with INIT commits", () => {
const md = `# Title

Description.
`;

const config = {
config: {
testRunner: {
command: "./node_modules/.bin/mocha",
args: {
filter: "--grep",
tap: "--reporter=mocha-tap-reporter",
},
directory: "coderoad",
},
appVersions: {
vscode: ">=0.7.0",
},
repo: {
uri: "https://path.to/repo",
branch: "aBranch",
},
dependencies: [
{
name: "node",
version: ">=10",
},
],
},
};
const result = parse({
text: md,
config,
commits: {
INIT: ["abcdef1", "123456789"],
},
});
const expected = {
summary: {
description: "Description.\n\nSecond description line",
},
config: {
testRunner: {
command: "./node_modules/.bin/mocha",
args: {
filter: "--grep",
tap: "--reporter=mocha-tap-reporter",
},
directory: "coderoad",
setup: {
commits: ["abcdef1", "123456789"],
},
},
repo: {
uri: "https://path.to/repo",
branch: "aBranch",
},
dependencies: [
{
name: "node",
version: ">=10",
},
],
appVersions: {
vscode: ">=0.7.0",
},
},
};
expect(result.config).toEqual(expected.config);
});
});

[8]ページ先頭

©2009-2025 Movatter.jp