This commit is contained in:
81
tests/e2e/smoke.test.ts
Normal file
81
tests/e2e/smoke.test.ts
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import { execa } from 'execa';
|
||||||
|
|
||||||
|
describe('E2E Smoke Tests', () => {
|
||||||
|
const projectRoot = path.join(__dirname, '..', '..');
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
if (!fs.existsSync(path.join(projectRoot, 'node_modules'))) {
|
||||||
|
await execa('npm', ['install'], { cwd: projectRoot });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Project Structure', () => {
|
||||||
|
it('should have package.json', () => {
|
||||||
|
expect(fs.existsSync(path.join(projectRoot, 'package.json'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have tsconfig.json', () => {
|
||||||
|
expect(fs.existsSync(path.join(projectRoot, 'tsconfig.json'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have src directory', () => {
|
||||||
|
expect(fs.existsSync(path.join(projectRoot, 'src'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have tests directory', () => {
|
||||||
|
expect(fs.existsSync(path.join(projectRoot, 'tests'))).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Build', () => {
|
||||||
|
it('should compile TypeScript without errors', async () => {
|
||||||
|
const result = await execa('npm', ['run', 'build'], { cwd: projectRoot });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate dist directory', () => {
|
||||||
|
expect(fs.existsSync(path.join(projectRoot, 'dist'))).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('CLI Smoke Test', () => {
|
||||||
|
it('should run --version', async () => {
|
||||||
|
const result = await execa('npx', ['ts-node', 'src/index.ts', '--version'], {
|
||||||
|
cwd: projectRoot,
|
||||||
|
});
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run --help', async () => {
|
||||||
|
const result = await execa('npx', ['ts-node', 'src/index.ts', '--help'], {
|
||||||
|
cwd: projectRoot,
|
||||||
|
});
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.stdout).toContain('Usage');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run info command', async () => {
|
||||||
|
const result = await execa('npx', ['ts-node', 'src/index.ts', 'info'], {
|
||||||
|
cwd: projectRoot,
|
||||||
|
});
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.stdout).toContain('Terminal Layout Sync CLI');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Type Checking', () => {
|
||||||
|
it('should pass type checking', async () => {
|
||||||
|
const result = await execa('npm', ['run', 'typecheck'], { cwd: projectRoot });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Linting', () => {
|
||||||
|
it('should pass linting', async () => {
|
||||||
|
const result = await execa('npm', ['run', 'lint'], { cwd: projectRoot });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user