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

[Jest]: Added initial code for jest-mochawesome-reporter #207

Merged
merged 8 commits into from
Jan 24, 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
2 changes: 2 additions & 0 deletions jest-mochawesome-reporter/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/dist
35 changes: 35 additions & 0 deletions jest-mochawesome-reporter/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const resolve = {
extensions: ['.js', '.ts'],
};

module.exports = {
extends: [
'@mate-academy/eslint-config-internal',
],
env: {
node: true,
mocha: true,
},
rules: {
// note you must disable the base rule as it can report incorrect errors
'no-redeclare': 'off',
// note you must disable the base rule as it can report incorrect errors
'no-shadow': 'off',
camelcase: 'off',
'class-methods-use-this': 'off',
'no-console': 'off',
'no-restricted-syntax': 'off',
'no-underscore-dangle': 'off',
},
ignorePatterns: [
'**/node_modules/*',
'**/dist/*',
],
settings: {
'import/resolver': {
node: {
extensions: resolve.extensions,
},
},
},
};
15 changes: 15 additions & 0 deletions jest-mochawesome-reporter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# IDE
.idea
.vscode

# Node
node_modules

# MacOS
.DS_Store

# Generated files
dist

# Environment
.env
1 change: 1 addition & 0 deletions jest-mochawesome-reporter/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
42 changes: 42 additions & 0 deletions jest-mochawesome-reporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# `@mate-academy/jest-mochawesome-reporter` npm package

## Description

This package is a reporter for Jest that generates a report in mochawesome compatible JSON format. You can use it with [mochawesome](https://www.npmjs.com/package/mochawesome) to show a fancy report in HTML format.

## Install
- `npm i -D @mate-academy/jest-mochawesome-reporter`

## Usage
- add `@mate-academy/jest-mochawesome-reporter` to `jest.config.js`:

```js
module.exports = {
...
reporters: [
'default', // to see console output
'@mate-academy/jest-mochawesome-reporter'
],
...
};
```
- configuration is optional, default values:

```js
module.exports = {
...
reporters: [
'default',
[
'@mate-academy/jest-mochawesome-reporter',
{
outputDir: '<globalConfig.rootDir>', // rootDir from jest.config.js
outputName: 'jest-mochawesome',
createDirIfMissing: false,
},
],
],
...
};
```

Loading
Loading