Skip to content

Commit

Permalink
add few commands files todo
Browse files Browse the repository at this point in the history
  • Loading branch information
izelnakri committed Feb 7, 2021
1 parent b3db31f commit 54ba743
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/commands/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: this will setup test index.html and put a default config to package.json
21 changes: 21 additions & 0 deletions lib/commands/new.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import fs from 'fs/promises';
import chalk from 'chalk';

export default async function() {
const targetFilePath = process.argv[3] ? process.argv[2] : // if 3 params get from second the path or make dasherized 'test/test-module-name'
const targetPath = `${process.cwd()}/test/${targetFilePath}`; // get from projectJSON
const moduleName = ''; // if 3 params 3rd if 2 params 2nd.

await fs.writeFile(
targetPath,
`
import { module, test } from 'qunitx';
module('{{moduleName}}', function() {
test('asserts true', function(assert) {
assert.equal(true, true);
});
});`.trim().replace('{{moduleName}}', moduleName));

console.log(chalk.magenta.bold(`${moduleName} qunitx test file created on:`), chalk.yellow(`${targetPath}`));
}

0 comments on commit 54ba743

Please sign in to comment.