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/validate#34

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 11 commits intomasterfromfeature/validate
Jun 13, 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
cleanup output text ui
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 13, 2020
commit2fc111324fcdd12037012723f95733cd9aa357e0
3 changes: 1 addition & 2 deletionssrc/utils/exec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,15 +43,14 @@ export function createCommandRunner(cwd: string) {
let errors = [];
for (const command of commands) {
try {
console.log(`> ${command}`);
console.log(`--> ${command}`);
let cwdDir = cwd;
if (dir) {
cwdDir = path.join(cwd, dir);
}
const { stdout, stderr } = await createExec(cwdDir)(command);

console.warn(stderr);
console.log(stdout);
} catch (e) {
console.error(`Command failed: "${command}"`);
console.warn(e.message);
Expand Down
33 changes: 19 additions & 14 deletionssrc/validate.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,14 +58,15 @@ async function validate(args: string[]) {
const runTest = createTestRunner(tmpDir, skeleton.config.testRunner);

// setup
console.info("* Setup");
if (commits.INIT) {
// load commits
console.info("Loading setup commits...");
console.info("-- Loading commits...");
await cherryPick(commits.INIT);

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

await runCommands(
skeleton.config?.testRunner?.setup?.commands,
Expand All@@ -76,30 +77,32 @@ async function validate(args: string[]) {
}

for (const level of skeleton.levels) {
console.info(`* ${level.id}`);
if (level?.setup) {
// load commits
if (commits[`${level.id}`]) {
console.log(`Loading ${level.id} commits...`);
console.log(`-- Loading commits...`);
await cherryPick(commits[level.id]);
}
// run commands
if (level.setup?.commands) {
console.log(`Running ${level.id} commands...`);
console.log(`-- Running commands...`);
await runCommands(level.setup.commands);
}
}
// steps
if (level.steps) {
for (const step of level.steps) {
console.info(`** ${step.id}`);
// load commits
const stepSetupCommits = commits[`${step.id}Q`];
if (stepSetupCommits) {
console.info(`Loading ${step.id} setup commits...`);
console.info(`--- Loading setup commits...`);
await cherryPick(stepSetupCommits);
}
// run commands
if (step.setup.commands) {
console.info(`Running ${step.id} setup commands...`);
console.info(`--- Running setup commands...`);
await runCommands(step.setup.commands);
}

Expand All@@ -109,47 +112,49 @@ async function validate(args: string[]) {
// ignore running tests on steps with no solution
if (hasSolution) {
// run test
console.info("Running setup test");
console.info("---Running setup test...");
// expect fail
const { stdout, stderr } = await runTest();
if (stdout) {
console.error(
`Expected ${step.id} setup tests to fail, but passed`
`---Expected ${step.id} setup tests to fail, but passed`
);
// log tests
console.log(stdout);
}
}

if (stepSolutionCommits) {
console.info(`Loading ${step.id} solution commits...`);
console.info(`--- Loading solution commits...`);
await cherryPick(stepSolutionCommits);
}

// run commands
if (step?.solution?.commands) {
console.info(`Running ${step.id} solution commands...`);
console.info(`--- Running solution commands...`);
await runCommands(step.solution.commands);
}

if (hasSolution) {
// run test
console.info("Running solution test");
console.info("---Running solution test...");
// expect pass
const { stdout, stderr } = await runTest();
if (stderr) {
console.error(
`Expected ${step.id} solution tests to pass, but failed`
`---Expected ${step.id} solution tests to pass, but failed`
);
// log tests
console.log(stderr);
}
}
}
}
}

// log level/step
// on error, show level/step & error message
console.info(`\n✔ Success!`);
} catch (e) {
console.error("\n✘ Fail!");
console.error(e.message);
} finally {
// cleanup
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp