mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix: resolve ESLint errors and update tests for project-name fallback
- Fix 16 ESLint no-unused-vars errors across hook scripts and tests - Add eslint-disable comment for intentional control-regex in ANSI stripper - Update session file test to use getSessionIdShort() instead of hardcoded 'default' (reflects PR #110's project-name fallback behavior) - Add marketing/ to .gitignore (local drafts) - Add skill-create-output.js (terminal output formatter) All 69 tests now pass. CI should be green.
This commit is contained in:
@@ -8,7 +8,7 @@ const assert = require('assert');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const { execSync, spawn } = require('child_process');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
// Test helper
|
||||
function test(name, fn) {
|
||||
@@ -113,14 +113,19 @@ async function runTests() {
|
||||
// Run the script
|
||||
await runScript(path.join(scriptsDir, 'session-end.js'));
|
||||
|
||||
// Check if session file was created (default session ID)
|
||||
// Check if session file was created
|
||||
// Note: Without CLAUDE_SESSION_ID, falls back to project name (not 'default')
|
||||
// Use local time to match the script's getDateString() function
|
||||
const sessionsDir = path.join(os.homedir(), '.claude', 'sessions');
|
||||
const now = new Date();
|
||||
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
const sessionFile = path.join(sessionsDir, `${today}-default-session.tmp`);
|
||||
|
||||
assert.ok(fs.existsSync(sessionFile), 'Session file should exist');
|
||||
// Get the expected session ID (project name fallback)
|
||||
const utils = require('../../scripts/lib/utils');
|
||||
const expectedId = utils.getSessionIdShort();
|
||||
const sessionFile = path.join(sessionsDir, `${today}-${expectedId}-session.tmp`);
|
||||
|
||||
assert.ok(fs.existsSync(sessionFile), `Session file should exist: ${sessionFile}`);
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (await asyncTest('includes session ID in filename', async () => {
|
||||
@@ -296,7 +301,7 @@ async function runTests() {
|
||||
}
|
||||
};
|
||||
|
||||
for (const [eventType, hookArray] of Object.entries(hooks.hooks)) {
|
||||
for (const [, hookArray] of Object.entries(hooks.hooks)) {
|
||||
checkHooks(hookArray);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
@@ -320,7 +325,7 @@ async function runTests() {
|
||||
}
|
||||
};
|
||||
|
||||
for (const [eventType, hookArray] of Object.entries(hooks.hooks)) {
|
||||
for (const [, hookArray] of Object.entries(hooks.hooks)) {
|
||||
checkHooks(hookArray);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
@@ -11,7 +11,6 @@ const os = require('os');
|
||||
|
||||
// Import the modules
|
||||
const pm = require('../../scripts/lib/package-manager');
|
||||
const utils = require('../../scripts/lib/utils');
|
||||
|
||||
// Test helper
|
||||
function test(name, fn) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
const assert = require('assert');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
|
||||
// Import the module
|
||||
const utils = require('../../scripts/lib/utils');
|
||||
|
||||
Reference in New Issue
Block a user