Skip to content

Commit 30a47ab

Browse files
committed
initial plugin commit
0 parents  commit 30a47ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+11068
-0
lines changed

.eslintcache

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"/home/thiago/Documents/Git/cli-plugin-test/src/commands/test/e2e.ts":"1","/home/thiago/Documents/Git/cli-plugin-test/src/commands/test/unit.ts":"2","/home/thiago/Documents/Git/cli-plugin-test/src/index.ts":"3","/home/thiago/Documents/Git/cli-plugin-test/src/modules/e2e/report/specsState.ts":"4","/home/thiago/Documents/Git/cli-plugin-test/src/modules/e2e/testCommand.ts":"5"},{"size":993,"mtime":1593455982763,"results":"6","hashOfConfig":"7"},{"size":625,"mtime":1593457747113,"results":"8","hashOfConfig":"7"},{"size":18,"mtime":1593455279310,"results":"9","hashOfConfig":"7"},{"size":1087,"mtime":1593532997977,"results":"10","hashOfConfig":"7"},{"size":4431,"mtime":1593532997977,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1ta92dg",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/thiago/Documents/Git/cli-plugin-test/src/commands/test/e2e.ts",[],"/home/thiago/Documents/Git/cli-plugin-test/src/commands/test/unit.ts",[],"/home/thiago/Documents/Git/cli-plugin-test/src/index.ts",[],"/home/thiago/Documents/Git/cli-plugin-test/src/modules/e2e/report/specsState.ts",[],"/home/thiago/Documents/Git/cli-plugin-test/src/modules/e2e/testCommand.ts",[]]

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/__mocks__
2+
**/*.test.ts
3+
/src/__tests__

.eslintrc

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"extends": ["vtex"],
3+
"root": true,
4+
"env": {
5+
"node": true,
6+
"es6": true,
7+
"jest": true
8+
},
9+
"rules": {
10+
"no-console": "off",
11+
"import/order": "off",
12+
"@typescript-eslint/no-explicit-any": "off",
13+
"@typescript-eslint/explicit-member-accessibility": "off",
14+
"default-case": "off",
15+
"global-require": "off",
16+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "_+" }],
17+
"@typescript-eslint/interface-name-prefix": "off",
18+
"@typescript-eslint/ban-ts-ignore": "warn"
19+
},
20+
"overrides": [
21+
{
22+
"files": ["*.ts"],
23+
"rules": {
24+
"no-dupe-class-members": "off"
25+
}
26+
},
27+
{
28+
"files": ["./src/logger.ts"],
29+
"rules": {
30+
"@typescript-eslint/ban-ts-ignore": "off"
31+
}
32+
},
33+
{
34+
"files": ["./src/oclif/CustomCommand.ts"],
35+
"rules": {
36+
"@typescript-eslint/no-var-requires": "warn"
37+
}
38+
},
39+
{
40+
"files": [
41+
"./src/lib/telemetry/TelemetryReporter/report.ts",
42+
"./src/CLIPreTasks/OutdatedChecker/checkForOutdated.ts"
43+
],
44+
"rules": {
45+
"import/first": "off"
46+
}
47+
}
48+
]
49+
}

.eslintrc-react

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "vtex-react/io",
3+
"env": {
4+
"browser": true,
5+
"es6": true,
6+
"jest": true
7+
},
8+
"rules": {
9+
"no-restricted-imports": "warn"
10+
}
11+
}

.github/ISSUE_TEMPLATE

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--- Provide a general summary of the issue in the Title above -->
2+
3+
## Expected Behavior
4+
<!--- If you're describing a bug, tell us what should happen -->
5+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
6+
7+
## Current Behavior
8+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
9+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
10+
11+
## Possible Solution
12+
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
13+
<!--- or ideas how to implement the addition or change -->
14+
15+
## Steps to Reproduce (for bugs)
16+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
17+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
18+
1.
19+
2.
20+
3.
21+
4.
22+
23+
## Context
24+
<!--- How has this issue affected you? What are you trying to accomplish? -->
25+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
26+
27+
## Your Environment
28+
<!--- Include as many relevant details about the environment you experienced the bug in -->
29+
* Version used:
30+
* Environment name and version (e.g. Chrome 39, node.js 5.4):
31+
* Operating System and version (desktop or mobile):
32+
* Link to your project:

.github/PULL_REQUEST_TEMPLATE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#### What is the purpose of this pull request?
2+
<!--- Describe your changes in detail. -->
3+
4+
#### What problem is this solving?
5+
<!--- What is the motivation and context for this change? -->
6+
7+
#### How should this be manually tested?
8+
9+
#### Screenshots or example usage
10+
11+
#### Types of changes
12+
- [ ] Refactor (non-breaking change that only makes the code better)
13+
- [ ] Bug fix (non-breaking change which fixes an issue)
14+
- [ ] New feature (non-breaking change which adds functionality)
15+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
16+
- [ ] Requires change to documentation, which has been updated accordingly.
17+
18+
#### Chores checklist
19+
- [ ] Update `CHANGELOG.md`

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 12
18+
- run: yarn install --ignore-scripts
19+
- run: yarn run ci:prettier-check
20+
- run: yarn run lint:node
21+
22+
test:
23+
needs: [lint]
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
fail-fast: true
27+
matrix:
28+
node-version: [12]
29+
os: [ubuntu-latest, windows-latest, macOS-latest]
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-node@v1
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
- run: yarn install --ignore-scripts
37+
- run: yarn run ci:test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: publish-prerelease:npm
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '**'
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+-beta*'
9+
10+
jobs:
11+
npm-publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 12
18+
registry-url: https://registry.npmjs.org/
19+
- run: yarn install --ignore-scripts
20+
- run: yarn build
21+
- run: npm publish --tag beta
22+
env:
23+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
24+
IS_CI: "true"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: publish-stable:npm
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '**'
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+'
9+
10+
jobs:
11+
npm-publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 12
18+
registry-url: https://registry.npmjs.org/
19+
- run: yarn install --ignore-scripts
20+
- run: yarn build
21+
- run: npm publish
22+
env:
23+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
24+
IS_CI: "true"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"printWidth": 120
6+
}

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@thiagoveras/cli-plugin-test
2+
============================
3+
4+
5+
6+
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
7+
[![Version](https://img.shields.io/npm/v/@thiagoveras/cli-plugin-test.svg)](https://npmjs.org/package/@thiagoveras/cli-plugin-test)
8+
[![Downloads/week](https://img.shields.io/npm/dw/@thiagoveras/cli-plugin-test.svg)](https://npmjs.org/package/@thiagoveras/cli-plugin-test)
9+
[![License](https://img.shields.io/npm/l/@thiagoveras/cli-plugin-test.svg)](https://github.com/VerasThiago/cli-plugin-test/blob/master/package.json)
10+
11+
<!-- toc -->
12+
* [Usage](#usage)
13+
* [Commands](#commands)
14+
<!-- tocstop -->
15+
# Usage
16+
<!-- usage -->
17+
```sh-session
18+
$ npm install -g @thiagoveras/cli-plugin-test
19+
$ oclif-example COMMAND
20+
running command...
21+
$ oclif-example (-v|--version|version)
22+
@thiagoveras/cli-plugin-test/0.0.0 linux-x64 node-v14.0.0
23+
$ oclif-example --help [COMMAND]
24+
USAGE
25+
$ oclif-example COMMAND
26+
...
27+
```
28+
<!-- usagestop -->
29+
# Commands
30+
<!-- commands -->
31+
* [`oclif-example hello [FILE]`](#oclif-example-hello-file)
32+
33+
## `oclif-example hello [FILE]`
34+
35+
describe the command here
36+
37+
```
38+
USAGE
39+
$ oclif-example hello [FILE]
40+
41+
OPTIONS
42+
-f, --force
43+
-h, --help show CLI help
44+
-n, --name=name name to print
45+
46+
EXAMPLE
47+
$ oclif-example hello
48+
hello world from ./src/hello.ts!
49+
```
50+
51+
_See code: [src/commands/hello.ts](https://github.com/VerasThiago/cli-plugin-test/blob/v0.0.0/src/commands/hello.ts)_
52+
<!-- commandsstop -->

bin/run

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
require('@oclif/command').run()
4+
.catch(require('@oclif/errors/handle'))

bin/run.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\run" %*

build/commands/test/e2e.d.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { flags as oclifFlags } from '@oclif/command';
2+
import { CustomCommand } from 'vtex';
3+
export default class E2E extends CustomCommand {
4+
static description: string;
5+
static examples: any[];
6+
static flags: {
7+
report: oclifFlags.IOptionFlag<string>;
8+
workspace: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9+
token: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10+
verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
12+
trace: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
13+
};
14+
static args: any[];
15+
run(): Promise<void>;
16+
}

build/commands/test/e2e.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
const tslib_1 = require("tslib");
4+
const command_1 = require("@oclif/command");
5+
const vtex_1 = require("vtex");
6+
const e2e_1 = tslib_1.__importDefault(require("../../modules/e2e"));
7+
class E2E extends vtex_1.CustomCommand {
8+
async run() {
9+
const { flags } = this.parse(E2E);
10+
e2e_1.default(flags);
11+
}
12+
}
13+
exports.default = E2E;
14+
E2E.description = "Run your VTEX app's integration tests";
15+
E2E.examples = [];
16+
E2E.flags = {
17+
...vtex_1.CustomCommand.globalFlags,
18+
report: command_1.flags.string({
19+
char: 'r',
20+
description: 'Check the results and state of a previously started test given its ID',
21+
}),
22+
workspace: command_1.flags.boolean({ char: 'w', description: "Test workspace's apps", default: false }),
23+
token: command_1.flags.boolean({
24+
char: 't',
25+
description: "[Not recommended] Send your personal authorization token to your test session so it's available while running the tests. It can be dangerous because exposes the token via 'authToken' environment variable",
26+
default: false,
27+
}),
28+
};
29+
E2E.args = [];

build/commands/test/unit.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { CustomCommand } from 'vtex';
2+
export default class UnitTest extends CustomCommand {
3+
static description: string;
4+
static aliases: string[];
5+
static examples: any[];
6+
static flags: {
7+
unsafe: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8+
verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
10+
trace: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11+
};
12+
static args: any[];
13+
run(): Promise<void>;
14+
}

build/commands/test/unit.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
const tslib_1 = require("tslib");
4+
const command_1 = require("@oclif/command");
5+
const vtex_1 = require("vtex");
6+
const testCommand_1 = tslib_1.__importDefault(require("../../modules/e2e/testCommand"));
7+
class UnitTest extends vtex_1.CustomCommand {
8+
async run() {
9+
const { flags: { unsafe }, } = this.parse(UnitTest);
10+
await testCommand_1.default({ unsafe });
11+
}
12+
}
13+
exports.default = UnitTest;
14+
UnitTest.description = 'Run your VTEX app unit tests';
15+
UnitTest.aliases = ['test'];
16+
UnitTest.examples = [];
17+
UnitTest.flags = {
18+
...vtex_1.CustomCommand.globalFlags,
19+
unsafe: command_1.flags.boolean({ char: 'u', description: 'Allow tests with Typescript errors', default: false }),
20+
};
21+
UnitTest.args = [];

build/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare const _default: {};
2+
export default _default;

build/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.default = {};

build/modules/e2e/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare const _default: (options: any) => Promise<void>;
2+
export default _default;

0 commit comments

Comments
 (0)