1 | import * as program from 'commander';
|
2 | import * as path from 'path';
|
3 | import * as shell from 'shelljs';
|
4 | import { exit, isNutmegComponent, notifyOfUpdate, nutmegDir } from './utils';
|
5 |
|
6 | notifyOfUpdate();
|
7 |
|
8 | program.command('test <path>', 'test a Web Component')
|
9 | .parse(process.argv);
|
10 |
|
11 | const workingDir = path.resolve(process.cwd(), program.args[0]);
|
12 | const karmaConfigFile = path.resolve(nutmegDir, 'karma.component.config.js');
|
13 | const karmaCmd = `karma start ${karmaConfigFile}`;
|
14 |
|
15 | exit("Directory doesn't have a package.json with @nutmeg/seed as a dependancy.", !isNutmegComponent(workingDir));
|
16 |
|
17 | const result = shell.exec(`npx ${karmaCmd}`);
|
18 | process.exit(result.code);
|