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
15 changes: 6 additions & 9 deletions .github/agents/test-developer.agent.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
description: "Write and maintain tests for commands using Mocha patterns."
description: "Write and maintain tests for commands"
name: "Test Developer"
tools: ['execute/testFailure', 'execute/runTests', 'read/terminalLastCommand', 'read/problems', 'read/readFile', 'edit/createFile', 'edit/editFiles', 'search/codebase', 'search/fileSearch', 'search/listDirectory', 'search/searchResults', 'search/textSearch', 'search/usages', 'web', 'todo']
---

# Test Developer

Expert assistant for writing tests in this CLI project using Mocha patterns.
Expert assistant for writing tests in this CLI project using NodeJS test patterns.

## Project Testing Context

- **Test framework**: Mocha
- **Test framework**: NodeJS built-in test module
- **Test location**: `test/commands/{command}.test.ts`
- **Test assets**: `test/assets/` contains source images for testing
- **Cleanup**: Tests create temporary directories (`assets/`, `android/`, `ios/`) that must be cleaned in hooks

## Test Structure Pattern

```typescript
import {expect} from 'chai'
import {afterEach, beforeEach, describe, it} from 'mocha'
import assert from 'node:assert/strict'
import * as fs from 'node:fs'
import * as path from 'node:path'
import {afterEach, beforeEach, describe, it} from 'node:test'

import {runCommand} from '../helpers/run-command.js'

Expand Down Expand Up @@ -76,7 +76,7 @@ describe('commandName', () => {

### Assertion Patterns

- **File existence**: `expect(fs.existsSync(path)).to.be.true`
- **File existence**: `assert.ok(fs.existsSync(path))`
- **File content**: Read file and compare expected content
- **Console output**: Capture `stdout` from `runCommand()` and verify messages
- **Error handling**: Test with invalid inputs to verify error messages
Expand All @@ -95,9 +95,6 @@ When testing image generation commands (icons, splash):
# Run all tests
pnpm test

# Run specific test file
pnpm test test/commands/icons.test.ts

# Run with verbose output
pnpm test --verbose
```
Expand Down
3 changes: 2 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ src/
```bash
pnpm install # Install dependencies
pnpm build # Compile TypeScript to dist/
pnpm test # Run Mocha tests + lint
pnpm test # Run Node.js test runner with coverage + lint
pnpm lint # ESLint only
```

Expand All @@ -64,6 +64,7 @@ pnpm lint # ESLint only
## Testing & Debugging

- Tests live in `test/commands/{command}.test.ts`
- Uses Node.js built-in `node:test` runner with `node:assert/strict`
- Use custom `runCommand()` helper from `test/helpers/run-command.ts`
- Tests create temporary `assets/`, `android/`, `ios/` directories - cleaned up in `after`/`afterEach` hooks
- Test assets stored in `test/assets/`
Expand Down
15 changes: 0 additions & 15 deletions .mocharc.json

This file was deleted.

15 changes: 6 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "node",
"runtimeArgs": [
"--loader",
"ts-node/esm",
"--no-warnings=ExperimentalWarning"
"--import",
"tsx"
],
"program": "${workspaceFolder}/bin/dev.js",
"args": ["dotenv", "dev"]
Expand All @@ -22,9 +21,8 @@
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "node",
"runtimeArgs": [
"--loader",
"ts-node/esm",
"--no-warnings=ExperimentalWarning"
"--import",
"tsx"
],
"program": "${workspaceFolder}/bin/dev.js",
"args": ["icons", "./test/assets/icon.png", "--appName", "TestApp"]
Expand All @@ -36,9 +34,8 @@
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "node",
"runtimeArgs": [
"--loader",
"ts-node/esm",
"--no-warnings=ExperimentalWarning"
"--import",
"tsx"
],
"program": "${workspaceFolder}/bin/dev.js",
"args": ["splash", "./test/assets/splashscreen.png", "--appName", "TestApp"]
Expand Down
8 changes: 5 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a **zero-dependencies CLI tool** (`rn-toolbox`) that automates React Nat
```bash
pnpm install # Install dependencies
pnpm build # Compile TypeScript to dist/
pnpm test # Run Mocha tests + lint
pnpm test # Run Node.js test runner with coverage + lint
pnpm lint # ESLint only
pnpm cleanup # Remove generated android/, ios/, dist/, .env
```
Expand All @@ -32,14 +32,16 @@ Use the development entry point during development:
## Testing Instructions

- Tests are located in `test/commands/{command}.test.ts`
- Run `pnpm test` to execute all tests with Mocha
- Run `pnpm test` to execute all tests with Node.js built-in test runner
- Uses `node:test` runner with `node:assert/strict` for assertions
- TypeScript support via `tsx` loader
- Run `pnpm lint` before committing to ensure ESLint passes
- Tests create temporary `assets/`, `android/`, `ios/` directories - cleaned up in `after`/`afterEach` hooks
- Test assets are stored in `test/assets/`

To run a specific test file:
```bash
pnpm mocha --forbid-only "test/commands/icons.test.ts"
node --import tsx --test test/commands/icons.test.ts
```

## Code Style
Expand Down
2 changes: 1 addition & 1 deletion bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
node --import tsx "%~dp0\dev" %*
2 changes: 1 addition & 1 deletion bin/dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
#!/usr/bin/env -S node --import tsx

import { runCLI } from '../src/cli/runner.js'

Expand Down
Loading
Loading