Skip to content

Commit

Permalink
added lint support and more github action tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sadabnepal committed Mar 9, 2024
1 parent e907e9d commit 26a31ba
Show file tree
Hide file tree
Showing 18 changed files with 2,200 additions and 196 deletions.
52 changes: 52 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* eslint-env node */
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
{
'avoidEscape': true,
'allowTemplateLiterals': true
}
],
'indent': [
'error',
4,
{
'SwitchCase': 1
}
],
'@typescript-eslint/no-unused-vars': [
'error',
{
'args': 'all',
'argsIgnorePattern': '^_',
'caughtErrors': 'all',
'caughtErrorsIgnorePattern': '^_',
'destructuredArrayIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'ignoreRestSiblings': true
}
],
'linebreak-style': [
'error'
],
'semi': [
'error',
'always'
]
},
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
}
};
55 changes: 50 additions & 5 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: NodeJS with Webpack
name: graphql test

on:
push:
Expand All @@ -7,12 +7,12 @@ on:
branches: [ "main" ]

jobs:
build:
supertest:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -22,7 +22,52 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Build
- name: tes using supertest
run: |
npm install
npm test
npm test:super
- name: tes using pactum
run: |
npm install
npm test:pactum
axios:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: tes using axios
run: |
npm install
npm test:axios
pactum:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: tes using pactum
run: |
npm install
npm test:pactum
27 changes: 27 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extensions": [
"ts"
],
"timeout": 30000,
"grep": "",
"ignore": [
""
],
"recursive": true,
"package": "./package.json",
"parallel": false,
"reporter": [
"spec",
"mochawesome"
],
"reporter-option": [
"reportDir=report",
"reportFilename=index",
"charts=true",
"code=false"
],
"require": [
"ts-node/register"
],
"retries": 0
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"editor.formatOnSave": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "always",
"source.organizeImports": "always"
}
}
4 changes: 2 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This is boilerplate project to show how we can automate graphql api using supert
Clone Repository

```bash
1. git clone https://github.com/sadabnepal/GraphQLTesting.git
2. Navigate to GraphQLTesting
1. git clone https://github.com/sadabnepal/graphql-ts-mocha-test.git
2. Navigate to graphql-ts-mocha-test
```

Install the dependencies
Expand Down
Loading

0 comments on commit 26a31ba

Please sign in to comment.