refactor: replace try/finally with beforeEach/afterEach + add CONTRIBUTING.md
Test suite modernization: - Converted all try/finally cleanup patterns to beforeEach/afterEach hooks across 11 test files (core, copilot-install, config, workstream, milestone-summary, forensics, state, antigravity, profile-pipeline, workspace) - Consolidated 40 inline mkdtempSync calls to use centralized helpers - Added createTempDir() helper for bare temp directories - Added optional prefix parameter to createTempProject/createTempGitProject - Fixed config test HOME sandboxing (was reading global defaults.json) New CONTRIBUTING.md: - Test standards: hooks over try/finally, centralized helpers, HOME sandboxing - Node 22/24 compatibility requirements with Node 26 forward-compat - Code style, PR guidelines, security practices - File structure overview All 1382 tests pass, 0 failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ const assert = require('node:assert');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const { createTempDir, cleanup } = require('./helpers.cjs');
|
||||
|
||||
const {
|
||||
getDirName,
|
||||
@@ -287,7 +288,7 @@ describe('copyCommandsAsAntigravitySkills', () => {
|
||||
let skillsDir;
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-ag-test-'));
|
||||
tmpDir = createTempDir('gsd-ag-test-');
|
||||
srcDir = path.join(tmpDir, 'commands', 'gsd');
|
||||
skillsDir = path.join(tmpDir, 'skills');
|
||||
fs.mkdirSync(srcDir, { recursive: true });
|
||||
@@ -381,7 +382,7 @@ describe('writeManifest (Antigravity)', () => {
|
||||
let tmpDir;
|
||||
|
||||
beforeEach(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-manifest-ag-'));
|
||||
tmpDir = createTempDir('gsd-manifest-ag-');
|
||||
// Create minimal structure
|
||||
const skillsDir = path.join(tmpDir, 'skills', 'gsd-help');
|
||||
fs.mkdirSync(skillsDir, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user