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

Merged
merged 24 commits into from
Dec 16, 2024
Merged
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"]
}
12 changes: 4 additions & 8 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
- 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: npm run build
- name: Test ai report
run: node dist/core/cli.js ai ctrf-reports/ctrf-report.json --title "AI Summary"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 4 additions & 6 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,13 +17,11 @@ 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
if: github.event_name != 'schedule'
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs
- name: Test custom summary string
run: node dist/index.js custom ctrf-reports/ctrf-report.json "I'm a custom summary string!"
if: github.event_name != 'schedule'
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json "I'm a custom summary string!" --annotate false
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 5 additions & 5 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
- name: Test detailed with title
run: node dist/index.js tests ctrf-reports/ctrf-report.json --title "Detailed With Title"
run: npm run build
- name: Test table
run: node dist/core/cli.js tests ctrf-reports/ctrf-report.json --title "Test table"
- 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 --title "Test list" --annotate false
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
28 changes: 18 additions & 10 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,23 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
- 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
- name: Test failed folded
run: node dist/index.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: npm run build
- name: Failed table
run: node dist/core/cli.js failed ctrf-reports/ctrf-report.json --title "Failed table"
- name: Failed table
run: node dist/core/cli.js failed ctrf-reports/ctrf-report.json --title "Failed table" --use-suite-name
- name: Failed folded
run: node dist/core/cli.js failed-folded ctrf-reports/ctrf-report.json --title "Failed Folded" --annotate false
- name: Fail rate table
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --title "Fail rate table" --annotate false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail rate max results
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --title "Fail rate table max results 2" --results 2 --annotate false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail rate table custom artifact name
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report-no-fails.json --annotate false --title "Flaky rate table custom artifact name" --artifact-name custom-artifact-name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
Expand Down
22 changes: 14 additions & 8 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,19 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
- name: Test flaky with title
run: node dist/index.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
- name: Test flaky rate with title
run: node dist/index.js flaky-rate ctrf-reports/ctrf-report.json --title "Flaky Rate With Title"
run: npm run build
- name: Flaky table
run: node dist/core/cli.js flaky ctrf-reports/ctrf-report.json --title "Flaky table"
- name: Flaky rate table
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report.json --title "Flaky rate table" --annotate false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Flaky rate table max results 2
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report.json --title "Flaky rate table max results 2" --results 2 --annotate false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Flaky rate table custom artifact name
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report-no-fails.json --annotate false --title "Flaky rate table custom artifact name" --artifact-name custom-artifact-name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
Expand Down
19 changes: 8 additions & 11 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,20 +17,17 @@ jobs:
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
- name: Test historical
run: node dist/index.js historical ctrf-reports/ctrf-report.json --annotate false
if: github.event_name != 'schedule'
run: npm run build
- name: Previous results table
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false --title "Previous results table"
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"
if: github.event_name != 'schedule'
- name: Previous results table max rows 2
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false --rows 2 --title "Previous results table max rows 2"
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
if: github.event_name != 'schedule'
- name: Previous results custom artifact name
run: node dist/core/cli.js historical ctrf-reports/ctrf-report-no-fails.json --annotate false --rows 2 --title "Previous results table custom artifact name" --artifact-name custom-artifact-name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
Expand Down
47 changes: 23 additions & 24 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
- name: Test summary
run: node dist/index.js summary ctrf-reports/ctrf-report.json
- name: Test historical
run: node dist/index.js historical ctrf-reports/ctrf-report.json --annotate false
run: npm run build
- name: Summary table
run: node dist/core/cli.js summary ctrf-reports/ctrf-report.json --title "Summary table"
- name: Historical table
run: node dist/core/cli.js historical ctrf-reports/ctrf-report.json --annotate false --title "Previous results table"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test suite folded
run: node dist/index.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
- name: Test failed rate
run: node dist/index.js failed-rate ctrf-reports/ctrf-report.json --annotate false --title "Failed rate"
- name: Suite folded table
run: node dist/core/cli.js suite-folded ctrf-reports/ctrf-report.json --annotate false --title "Suite folded table"
- name: Failed table
run: node dist/core/cli.js failed ctrf-reports/ctrf-report.json --annotate false --title "Failed table"
- name: Failed rate table
run: node dist/core/cli.js failed-rate ctrf-reports/ctrf-report.json --annotate false --title "Fail rate table"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test failed folded
run: node dist/index.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
- name: Test flaky rate
run: node dist/index.js flaky-rate ctrf-reports/ctrf-report.json --annotate false --title "Flaky rate"
- name: Failed folded table
run: node dist/core/cli.js failed-folded ctrf-reports/ctrf-report.json --annotate false --title "Fail folded table"
- name: Flaky table
run: node dist/core/cli.js flaky ctrf-reports/ctrf-report.json --annotate false --title "flaky table"
- name: Flaky rate table
run: node dist/core/cli.js flaky-rate ctrf-reports/ctrf-report.json --annotate false --title "Flaky rate table"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test ai
run: node dist/index.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
- name: Test custom summary
run: node dist/index.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs --annotate false
- name: AI table
run: node dist/core/cli.js ai ctrf-reports/ctrf-report.json --annotate false --title "AI table"
- name: Skipped table
run: node dist/core/cli.js skipped ctrf-reports/ctrf-report.json --annotate false --title "Skipped table"
- name: Custom
run: node dist/core/cli.js custom ctrf-reports/ctrf-report.json templates/custom-summary.hbs --annotate false --title "Custom"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
Expand Down
Loading
Loading