# @tool-123/gt-cli

> jest test generate tpl

Latest version **0.0.3** (published 2021-11-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install @tool-123/gt-cli
pnpm add @tool-123/gt-cli
yarn add @tool-123/gt-cli
bun add @tool-123/gt-cli
```

Provides the command `gt`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-11-07 |
| First published | 2021-11-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 24.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | daxiang |
| Maintainers | bookmarkbao |
| Keywords | test template generator |

## Links

- npm: https://www.npmjs.com/package/@tool-123/gt-cli
- Repository: https://github.com/bookmarkbao/tool-123
- Homepage: https://github.com/bookmarkbao/tool-123#readme
- Issues: https://github.com/bookmarkbao/tool-123/issues
- npm.io page: https://npm.io/package/@tool-123/gt-cli

## Dependencies (9)

- [del](https://npm.io/package/del.md) ^2.2.0
- [gulp](https://npm.io/package/gulp.md) ^4.0.2
- [swig](https://npm.io/package/swig.md) ^1.4.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.13
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.0
- [gulp-babel](https://npm.io/package/gulp-babel.md) ^8.0.0
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.9.6
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.9.6
- [command-line-args](https://npm.io/package/command-line-args.md) ^2.1.3

## Recent versions

- 0.0.3 (latest) — 2021-11-07
- 0.0.2 — 2021-11-07

## README

# test template generator 

CLI util for easy generate test files

## Installation

```js
npm install -g @tool-123/jest-template-generator
```

## Usage

```bash
gt --help
```

### Create new spec.js file

```bash
gt test
```

Will generate all template file:

**login-form.spec.js**

**login-form-tpl2.spec.js**

**login-form-tpl3.spec.js**

```javascript
import Vue from 'vue';
import LoginformComponent from './index.vue';

// Here are some Jasmine 2.0 tests, though you can
// use any test runner / assertion library combo you prefer
describe('LoginformComponent', () => {
  // Inspect the raw component options
  it('has a created hook', () => {
    // expect(typeof LoginformComponent.created).toBe('function');
  })
  // Evaluate the results of functions in
  // the raw component options
  it('sets the correct default data', () => {
    // expect(typeof LoginformComponent.data).toBe('function')
    // const defaultData = LoginformComponent.data();
    // expect(defaultData.message).toBe('hello!');
  })
  // Inspect the component instance on mount
  it('correctly sets the message when created', () => {
    // const vm = new Vue(LoginformComponent).$mount();
    // expect(vm.message).toBe('bye!');
  })
  // Mount an instance and inspect the render output
  it('renders the correct message', () => {
    // const Ctor = Vue.extend(LoginformComponent);
    // const vm = new Ctor().$mount();
    // expect(vm.$el.textContent).toBe('bye!');
  })
})
```

### Create new test single file

```bash
gt -s home
```

will generate one test file:

**home.spec.js**

```javascript
import Vue from 'vue';
import FooterComponent from './index.vue';

// Here are some Jasmine 2.0 tests, though you can
// use any test runner / assertion library combo you prefer
describe('FooterComponent', () => {
  // Inspect the raw component options
  it('has a created hook', () => {
    // expect(typeof FooterComponent.created).toBe('function');
  });
  // Evaluate the results of functions in
  // the raw component options
  it('sets the correct default data', () => {
    // expect(typeof FooterComponent.data).toBe('function')
    // const defaultData = FooterComponent.data();
    // expect(defaultData.message).toBe('hello!');
  });
  // Inspect the component instance on mount
  it('correctly sets the message when created', () => {
    // const vm = new Vue(FooterComponent).$mount();
    // expect(vm.message).toBe('bye!');
  });
  // Mount an instance and inspect the render output
  it('renders the correct message', () => {
    // const Ctor = Vue.extend(FooterComponent);
    // const vm = new Ctor().$mount();
    // expect(vm.$el.textContent).toBe('bye!');
  });
});
```

### Create new test single file inside new folder

```bash
gt -s home --folder
```

### If you want use postfix in file name, use -- postfix

```bash
gt dialog --postfix page
```

Will generate files with postfix:

- dialog.page.spec.js

### Change the default file types for spec

```bash
sudo gt --spec ts
```

### Contribute

If you want to fix/improve the templates you're welcome to create a PR.

---
_Source: https://npm.io/package/@tool-123/gt-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
