Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored Codebase to Enhance Contribution Readiness #59

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lib/
dist/
node_modules/
coverage/
templates/
17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

64 changes: 64 additions & 0 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
env:
node: true
es6: true
jest: true

globals:
Atomics: readonly
SharedArrayBuffer: readonly

ignorePatterns:
- '!.*'
- '**/node_modules/.*'
- '**/dist/.*'
- '**/coverage/.*'
- '*.json'

parser: '@typescript-eslint/parser'

parserOptions:
ecmaVersion: 2023
sourceType: module
project:
- './.github/linters/tsconfig.json'
- './tsconfig.json'

plugins:
- jest
- '@typescript-eslint'

extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended-type-checked
- plugin:jest/recommended

rules:
{
'camelcase': 'off',
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
'no-console': 'off',
'semi': 'off',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/explicit-member-accessibility':
['error', { 'accessibility': 'no-public' }],
'@typescript-eslint/explicit-function-return-type':
['error', { 'allowExpressions': true }],
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-function-type': 'warn',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/space-before-function-paren': 'off'
}
18 changes: 18 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Unordered list style
MD004:
style: dash

# Ordered list item prefix
MD029:
style: one

# Spaces after list markers
MD030:
ul_single: 1
ol_single: 1
ul_multi: 1
ol_multi: 1

# Code block style
MD046:
style: fenced
10 changes: 10 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
document-end: disable
document-start:
level: warning
present: false
line-length:
level: warning
max: 80
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
9 changes: 9 additions & 0 deletions .github/linters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["../../__tests__/**/*", "../../src/**/*"],
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
}
10 changes: 3 additions & 7 deletions .github/workflows/ai.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ai
name: ai-example

on:
push:
Expand All @@ -17,13 +17,9 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test ai with title
run: node dist/index.js ai ctrf-reports/ctrf-report.json --title "AI Summary With Title"
- name: Test ai without title
run: node dist/index.js ai ctrf-reports/ctrf-report.json
- name: Test ai with suite name
run: node dist/index.js ai ctrf-reports/ctrf-report.json --use-suite-name
run: node dist/core/cli.js ai ctrf-reports/ctrf-report.json --title "AI Summary With Title"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/custom.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: custom
name: custom-example

on:
push:
Expand All @@ -17,12 +17,12 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test custom summary hbs file
run: node dist/index.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs
if: github.event_name != 'schedule'
- name: Test custom summary string
run: node dist/index.js custom ctrf-reports/ctrf-report.json "I'm a custom summary string!"
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json "I'm a custom summary string!"
if: github.event_name != 'schedule'
- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/detailed.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: detailed
name: detailed-example

on:
push:
Expand All @@ -17,11 +17,11 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test detailed with title
run: node dist/index.js tests ctrf-reports/ctrf-report.json --title "Detailed With Title"
run: node dist/core/cli.js tests ctrf-reports/ctrf-report.json --title "Detailed With Title"
- name: Test list
run: node dist/index.js test-list ctrf-reports/ctrf-report.json --annotate false --title "List With Title"
run: node dist/core/cli.js test-list ctrf-reports/ctrf-report.json --annotate false --title "List With Title"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/failed.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: failed
name: failed-example

on:
push:
Expand All @@ -17,15 +17,17 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test failed with title
run: node dist/index.js failed ctrf-reports/ctrf-report.json --title "Failed With Title"
- name: Test failed no title
run: node dist/index.js failed ctrf-reports/ctrf-report.json
run: node dist/core/cli.js failed ctrf-reports/ctrf-report.json --title "Failed With Title"
- name: Test failed folded
run: node dist/index.js failed-folded ctrf-reports/ctrf-report.json --title "Failed Folded"
run: node dist/core/cli.js failed-folded ctrf-reports/ctrf-report.json --title "Failed Folded"
- name: Test failed rate
run: node dist/index.js failed-rate ctrf-reports/ctrf-report.json --title "Failed Rate"
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --title "Failed Rate"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test failed rate
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --title "Failed Rate" --results 2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/flaky.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: flaky
name: flaky-exmaple

on:
push:
Expand All @@ -17,13 +17,13 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test flaky with title
run: node dist/index.js flaky ctrf-reports/ctrf-report.json --title "Flaky With Title"
run: node dist/core/cli.js flaky ctrf-reports/ctrf-report.json --title "Flaky With Title"
- name: Test flaky with out title
run: node dist/index.js flaky ctrf-reports/ctrf-report.json
run: node dist/core/cli.js flaky ctrf-reports/ctrf-report.json
- name: Test flaky rate with title
run: node dist/index.js flaky-rate ctrf-reports/ctrf-report.json --title "Flaky Rate With Title"
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report.json --title "Flaky Rate With Title"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/historical.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: historical
name: historical-example

on:
push:
Expand All @@ -17,19 +17,19 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test historical
run: node dist/index.js historical ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false
if: github.event_name != 'schedule'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test historical row arg set to 2
run: node dist/index.js historical ctrf-reports/ctrf-report.json --annotate false --rows 2 --title "Historical With Max Rows 2"
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false --rows 2 --title "Historical With Max Rows 2"
if: github.event_name != 'schedule'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test historical with custom artifact name
run: node dist/index.js historical ctrf-reports/ctrf-report-no-fails.json --annotate false --rows 2 --title "Historical With Custom Artifact Name" --artifact-name custom-artifact-name
run: node dist/core/cli.js historical ctrf-reports/ctrf-report-no-fails.json --annotate false --rows 2 --title "Historical With Custom Artifact Name" --artifact-name custom-artifact-name
if: github.event_name != 'schedule'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,41 @@ on:
jobs:
testing:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' && github.ref == 'refs/heads/main' || github.event_name != 'schedule'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
run: npm run build
- name: Test summary
run: node dist/index.js summary ctrf-reports/ctrf-report.json
run: node dist/core/cli.js summary ctrf-reports/ctrf-report.json
- name: Test historical
run: node dist/index.js historical ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test suite folded
run: node dist/index.js suite-folded ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js suite-folded ctrf-reports/ctrf-report.json --annotate false
- name: Test failed
run: node dist/index.js failed ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js failed ctrf-reports/ctrf-report.json --annotate false
- name: Test failed rate
run: node dist/index.js failed-rate ctrf-reports/ctrf-report.json --annotate false --title "Failed rate"
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --annotate false --title "Failed rate"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test failed folded
run: node dist/index.js failed-folded ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js failed-folded ctrf-reports/ctrf-report.json --annotate false
- name: Test flaky
run: node dist/index.js flaky ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js flaky ctrf-reports/ctrf-report.json --annotate false
- name: Test flaky rate
run: node dist/index.js flaky-rate ctrf-reports/ctrf-report.json --annotate false --title "Flaky rate"
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report.json --annotate false --title "Flaky rate"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test ai
run: node dist/index.js ai ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js ai ctrf-reports/ctrf-report.json --annotate false
- name: Test skipped
run: node dist/index.js skipped ctrf-reports/ctrf-report.json --annotate false
run: node dist/core/cli.js skipped ctrf-reports/ctrf-report.json --annotate false
- name: Test custom summary
run: node dist/index.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs --annotate false
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs --annotate false
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
54 changes: 0 additions & 54 deletions .github/workflows/pull-request.yaml

This file was deleted.

Loading
Loading