Skip to content
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
12 changes: 10 additions & 2 deletions src/commands/flow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import * as vscode from "vscode";
import { LOG_EVENTS, REF_TYPES, REV_KINDS, SIDE_B_KINDS, TITLE_PREFIX, UI_TEXT } from "../constants";
import {
LOG_EVENTS,
OUTPUT_CHANNEL_NAME,
REF_TYPES,
REV_KINDS,
SIDE_B_KINDS,
TITLE_PREFIX,
UI_TEXT,
} from "../constants";
import type { GitRepo } from "../git/GitRepo";
import type { GitRunner } from "../git/GitRunner";
import type { GitApi } from "../vscodeGitApi";
Expand Down Expand Up @@ -29,7 +37,7 @@ export const reportGitError = ({ output, op, e }: { output: vscode.OutputChannel
if (e.stderr !== undefined && e.stderr !== "") {
output.appendLine(e.stderr);
}
void vscode.window.showErrorMessage(`${TITLE_PREFIX} ${op} failed (see Output → Diffr).`);
void vscode.window.showErrorMessage(`${TITLE_PREFIX} ${op} failed (see Output → ${OUTPUT_CHANNEL_NAME}).`);
};

export const resolveSideB = async ({
Expand Down
6 changes: 2 additions & 4 deletions src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pino, { type Logger as PinoLogger, type Level, multistream } from "pino";
import { LOG_LEVELS } from "./constants";

const ENV_LOG_LEVEL_VAR = "DIFFR_LOG_LEVEL";
import { ENV_VARS, LOG_LEVELS } from "./constants";

export interface Logger {
trace: (fields: object, msg?: string) => void;
Expand All @@ -18,7 +16,7 @@ export interface LogStreamEntry {

const streams: LogStreamEntry[] = [{ stream: process.stdout }];

const envLevel = process.env[ENV_LOG_LEVEL_VAR];
const envLevel = process.env[ENV_VARS.logLevel];

const buildPino = (): PinoLogger =>
pino(
Expand Down
5 changes: 3 additions & 2 deletions src/test/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as path from "node:path";
import { spawnSync } from "node:child_process";
import { existsSync } from "node:fs";
import { runTests } from "@vscode/test-electron";
import { ENV_VARS, EXTENSION_ID } from "../constants";

const repoRoot = path.resolve(__dirname, "..", "..");
const extensionDevelopmentPath = repoRoot;
Expand Down Expand Up @@ -30,7 +31,7 @@ const main = async (): Promise<void> => {
}
const coverageDir = process.env["NODE_V8_COVERAGE"];
const extensionTestsEnv: Record<string, string> = {
DIFFR_E2E: "1",
[ENV_VARS.e2e]: "1",
};
if (coverageDir !== undefined && coverageDir !== "") {
extensionTestsEnv["NODE_V8_COVERAGE"] = coverageDir;
Expand All @@ -39,7 +40,7 @@ const main = async (): Promise<void> => {
extensionDevelopmentPath,
extensionTestsPath,
extensionTestsEnv,
launchArgs: [workspacePath, "--disable-telemetry", "--enable-proposed-api", "nimblesite.diffr"],
launchArgs: [workspacePath, "--disable-telemetry", "--enable-proposed-api", EXTENSION_ID],
});
};

Expand Down
3 changes: 1 addition & 2 deletions src/test/suite/activation.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { strict as assert } from "node:assert";
import * as vscode from "vscode";
import { COMMAND_IDS, OUTPUT_CHANNEL_NAME } from "../../constants";
import { COMMAND_IDS, EXTENSION_ID, OUTPUT_CHANNEL_NAME } from "../../constants";
import { tick } from "./helpers";

const EXTENSION_ID = "nimblesite.diffr";
const TICK_MS = 20;

const ALL_COMMAND_IDS: readonly string[] = Object.values(COMMAND_IDS);
Expand Down
4 changes: 1 addition & 3 deletions src/test/suite/commands.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strict as assert } from "node:assert";
import * as vscode from "vscode";
import { COMMAND_IDS } from "../../constants";
import { COMMAND_IDS, EXTENSION_ID } from "../../constants";
import {
accept,
allDiffTabs,
Expand All @@ -16,8 +16,6 @@ import {
workspaceRoot,
} from "./helpers";

const EXTENSION_ID = "nimblesite.diffr";

const ensureActivated = async (): Promise<void> => {
const ext = vscode.extensions.getExtension(EXTENSION_ID);
if (ext !== undefined && !ext.isActive) {
Expand Down
3 changes: 1 addition & 2 deletions src/test/suite/contentProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { strict as assert } from "node:assert";
import * as vscode from "vscode";
import { EXTENSION_ID } from "../../constants";
import { readSeedShas, waitForRepoReady } from "./helpers";

const EXTENSION_ID = "nimblesite.diffr";

const readDiffr = async (uriString: string): Promise<string> => {
const doc = await vscode.workspace.openTextDocument(vscode.Uri.parse(uriString));
return doc.getText();
Expand Down
Loading