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
39 changes: 32 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,48 @@ jobs:
exit 1
fi

- name: Run optional Node checks
- name: Run package verification
run: |
set -euo pipefail

if [ ! -f package.json ]; then
echo "No package.json found; skipping Node checks."
echo "TODO: add install, lint, test, typecheck, or build commands when this template becomes an app or package."
exit 0
fi

if [ -f package-lock.json ]; then
if [ -f pnpm-lock.yaml ]; then
corepack enable
pnpm install --frozen-lockfile
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
pnpm run release:check
else
pnpm run check --if-present
pnpm test --if-present
pnpm run build --if-present
pnpm run smoke --if-present
pnpm run package:smoke --if-present
fi
elif [ -f package-lock.json ]; then
npm ci
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
npm run release:check
else
npm run check --if-present
npm test --if-present
npm run build --if-present
npm run smoke --if-present
npm run package:smoke --if-present
fi
else
npm install
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
npm run release:check
else
npm run check --if-present
npm test --if-present
npm run build --if-present
npm run smoke --if-present
npm run package:smoke --if-present
fi
fi

npm run lint --if-present
npm test --if-present
npm run typecheck --if-present
npm run build --if-present
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"README.md",
"LICENSE",
"SECURITY.md",
"CONTRIBUTING.md"
"CONTRIBUTING.md",
"CHANGELOG.md"
],
"scripts": {
"test": "node --test test/*.test.js",
Expand Down
9 changes: 4 additions & 5 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';

test('atomcommit plan test - CLI should handle --help', () => {
const { execSync } = require('child_process');
try {
const out = execSync('node src/index.js --help', { encoding: 'utf8', stdio: 'pipe' });
assert.ok(out.includes('atomcommit') || out.includes('plan') || out.includes('commit'),
const out = execFileSync(process.execPath, ['src/index.js', '--help'], { encoding: 'utf8', stdio: 'pipe' });
assert.ok(out.includes('atomcommit') || out.includes('plan') || out.includes('commit'),
'help should mention atomcommit or plan');
} catch (e) {
// CLI may exit with code for --help
assert.ok(true, 'CLI handles --help');
}
});

test('parseNameStatus handles invalid input', () => {
test('parseNameStatus handles invalid input', async () => {
const { parseNameStatus } = await import('../src/index.js');
const result = parseNameStatus('');
assert.deepEqual(result, [], 'empty input returns empty array');
});

test('parseNumstat handles binary markers', () => {
test('parseNumstat handles binary markers', async () => {
const { parseNumstat } = await import('../src/index.js');
const result = parseNumstat('-\t-\tbinary.png\n');
assert.ok(result.get('binary.png').binary, 'should detect binary files');
Expand Down