Fix linting errors

This commit is contained in:
Sander Declerck 2025-07-30 16:19:14 +02:00
parent 05ebb3f19e
commit 9ad90d8073
No known key found for this signature in database
2 changed files with 4 additions and 0 deletions

View file

@ -1,77 +0,0 @@
import { describe, it, before, beforeEach, afterEach } from "node:test";
import { execSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { DockerTestContainer } from "./DockerTestContainer.js";
import assert from "node:assert";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.resolve(__dirname, "../..");
describe("E2E: safe-chain setup command", () => {
const imageName = "safe-chain-e2e-test";
const containerName = "safe-chain-e2e-test-container";
let container;
before(async () => {
// Build the Docker image for the test environment
try {
execSync(`docker build -t ${imageName} -f test/e2e/Dockerfile .`, {
cwd: projectRoot,
stdio: "ignore",
});
} catch (error) {
throw new Error(`Failed to setup test environment: ${error.message}`);
}
});
beforeEach(async () => {
// Run a new Docker container for each test
container = new DockerTestContainer(imageName, containerName);
await container.start();
});
afterEach(async () => {
// Stop and clean up the container after each test
if (container) {
await container.stop();
container = null;
}
});
for (let shell of ["bash", "zsh"]) {
it(`safe-chain setup wraps npm command after installation for ${shell}`, async () => {
// setting up the container
const installationShell = await container.openShell(shell);
await installationShell.runCommand("safe-chain setup");
const projectShell = await container.openShell(shell);
await projectShell.runCommand("cd /testapp");
const result = await projectShell.runCommand("npm i axios");
assert.ok(
result.output.includes("Scanning for malicious packages..."),
"Expected npm command to be wrapped by safe-chain"
);
});
it(`safe-chain teardown unwraps npm command after uninstallation for ${shell}`, async () => {
// setting up the container
const installationShell = await container.openShell(shell);
await installationShell.runCommand("safe-chain setup");
await installationShell.runCommand("safe-chain teardown");
const projectShell = await container.openShell(shell);
await projectShell.runCommand("cd /testapp");
await projectShell.runCommand("npm i axios");
const result = await projectShell.runCommand("npm i axios");
assert.ok(
!result.output.includes("Scanning for malicious packages..."),
"Expected npm command to not be wrapped by safe-chain after teardown"
);
});
}
});