Skip to content

Commit

Permalink
WHEW i think everything should be passing now, removing debug console…
Browse files Browse the repository at this point in the history
… log junk
  • Loading branch information
Observable User committed Nov 2, 2024
1 parent 87f707d commit 159d708
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ class Deployer {
if (!isGit) throw new CliError("Not at root of a git repository.");

const {ownerName, repoName} = await getGitHubRemote();
const a = await promisify(exec)("git rev-parse --abbrev-ref HEAD");
console.log("validateGitHubLink", {stdout: a.stdout, stderr: a.stderr});
const branch = a.stdout.trim();
const branch = (await promisify(exec)("git rev-parse --abbrev-ref HEAD")).stdout.trim();
let localRepo = await this.apiClient.getGitHubRepository({ownerName, repoName});

// If a source repository has already been configured, check that it’s
Expand Down
12 changes: 7 additions & 5 deletions test/deploy-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ describe("deploy", () => {
await deploy(TEST_OPTIONS, effects);
assert.fail("expected error");
} catch (error) {
CliError.assert(error, {message: `Configured repository does not match local repository; check build settings on ${link(`https://observablehq.com/projects/@${DEPLOY_CONFIG.workspaceLogin}/${DEPLOY_CONFIG.projectSlug}/settings`)}`});
CliError.assert(error, {
message: `Configured repository does not match local repository; check build settings on ${link(
`https://observablehq.com/projects/@${DEPLOY_CONFIG.workspaceLogin}/${DEPLOY_CONFIG.projectSlug}/settings`
)}`
});
}

effects.close();
Expand Down Expand Up @@ -290,10 +294,9 @@ describe("deploy", () => {
);

await (await open("readme.md", "a")).close();
const {stdout, stderr} = await promisify(exec)(
await promisify(exec)(
"git add . && git commit -m 'initial' && git remote add origin [email protected]:observablehq/test.git"
);
console.log("starts cloud build test", {stdout, stderr});

await deploy(TEST_OPTIONS, effects);

Expand Down Expand Up @@ -325,10 +328,9 @@ describe("deploy", () => {
);

await (await open("readme.md", "a")).close();
const {stdout, stderr} = await promisify(exec)(
await promisify(exec)(
"git add . && git commit -m 'initial' && git remote add origin [email protected]:observablehq/test.git"
);
console.log("starts cloud build test", {stdout, stderr});

await deploy(TEST_OPTIONS, effects);

Expand Down
12 changes: 3 additions & 9 deletions test/mocks/directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {mkdtemp, rm} from "fs/promises";
import {tmpdir} from "os";
import {join} from "path/posix";
import {promisify} from "util";
// import {rimraf} from "rimraf";

export function mockIsolatedDirectory({git}: {git: boolean}) {
let dir: string;
Expand All @@ -13,19 +12,14 @@ export function mockIsolatedDirectory({git}: {git: boolean}) {
dir = await mkdtemp(join(tmpdir(), "framework-test-"));
process.chdir(dir);
if (git) {
console.log("logging stdout, stderr");
const a = await promisify(exec)(
'git config --global user.email "[email protected]" && git config --global user.name "Observable User" && git config --global init.defaultBranch main'
await promisify(exec)(
'git config --global user.email "[email protected]" && git config --global user.name "Observable User" && git config --global init.defaultBranch main && git init'
);
console.log(a.stdout, a.stderr);
const b = await promisify(exec)("git init");
console.log(b.stdout, b.stderr);
}
});

afterEach(async () => {
process.chdir(cwd);
// await rimraf(dir);
await rm(dir, {recursive: true}); //, force: true
await rm(dir, {recursive: true});
});
}

0 comments on commit 159d708

Please sign in to comment.