Skip to content
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

Make example tests run off of the CLI, tidy testing/ #1730

Merged
merged 5 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 2 additions & 20 deletions cli/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
import { expect } from "chai";
import * as fs from "fs-extra";
import { dump as dumpYaml, load as loadYaml } from "js-yaml";
import * as os from "os";
import * as path from "path";

import { ChildProcess, execFile } from "child_process";
import { execFile } from "child_process";
import { version } from "df/core/version";
import { dataform } from "df/protos/ts";
import { suite, test } from "df/testing";
import { suite, test, getProcessResult, nodePath, npmPath, corePackageTarPath } from "df/testing";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import should be alphabetized. same in other locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not bother if the linter won't do it, and it doesn't look there's a drop-in setting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter was throwing, I somehow merged it before the tests finished lol - will update in subsequent PR

import { TmpDirFixture } from "df/testing/fixtures";

suite("@dataform/cli", ({ afterEach }) => {
const tmpDirFixture = new TmpDirFixture(afterEach);
const platformPath = os.platform() === "darwin" ? "nodejs_darwin_amd64" : "nodejs_linux_amd64";
const nodePath = `external/${platformPath}/bin/node`;
const cliEntryPointPath = "cli/node_modules/@dataform/cli/bundle.js";
const npmPath = `external/${platformPath}/bin/npm`;
const corePackageTarPath = "packages/@dataform/core/package.tar.gz";

test(
"compile throws an error when dataformCoreVersion not in workflow_settings.yaml and no " +
Expand Down Expand Up @@ -309,16 +304,3 @@ select 1 as \${dataform.projectConfig.vars.testVar2}
});
});
});

async function getProcessResult(childProcess: ChildProcess) {
let stderr = "";
childProcess.stderr.pipe(process.stderr);
childProcess.stderr.on("data", chunk => (stderr += String(chunk)));
let stdout = "";
childProcess.stdout.pipe(process.stdout);
childProcess.stdout.on("data", chunk => (stdout += String(chunk)));
const exitCode: number = await new Promise(resolve => {
childProcess.on("close", resolve);
});
return { exitCode, stdout, stderr };
}
1 change: 0 additions & 1 deletion core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ ts_test_suite(
"//common/protos",
"//protos:ts",
"//testing",
"//tests/utils",
"@npm//@types/chai",
"@npm//@types/fs-extra",
"@npm//@types/js-yaml",
Expand Down
Loading
Loading