Skip to content

Commit e1591cc

Browse files
committed
test: 💍 update cases
1 parent 9b98a80 commit e1591cc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const cliPath = getDirname(import.meta.url, './cli-test.ts');
1111
describe('test suites of exec program', () => {
1212
it('should correct invoke cli.ts', async () => {
1313
const { stderr, stdout } = await runTsScript(cliPath);
14-
console.log(stderr, stdout);
1514
expect(stderr).toBe('');
1615
expect(stdout).toMatch(/cli.../);
1716
});

tests/execute.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { execute } from '../src/execute.js';
2+
3+
describe('execute', () => {
4+
it('should execute a command with arguments and options', async () => {
5+
const { stdout } = await execute('echo', ['hello']);
6+
expect(stdout).toBe('hello');
7+
});
8+
9+
it('should throw on invalid command', async () => {
10+
await expect(execute('invalid-command')).rejects.toThrow();
11+
});
12+
13+
it('should handle command with no arguments', async () => {
14+
const result = await execute('node', ['--version']);
15+
expect(result.stdout).toMatch(/v\d+\.\d+\.\d+/);
16+
});
17+
});

0 commit comments

Comments
 (0)