Skip to content

Commit

Permalink
Merge pull request #72 from stanleyhlng/upgrade
Browse files Browse the repository at this point in the history
Upgrade to pick up YOU54F changes from cypress-multi-reporter
  • Loading branch information
francisu committed Oct 20, 2020
2 parents c0084a3 + eefda37 commit 9d39fae
Show file tree
Hide file tree
Showing 29 changed files with 4,621 additions and 144 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; EditorConfig file: https://EditorConfig.org
; Install the "EditorConfig" plugin into your editor to use

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.json]
indent_size = 2

[*.yml]
indent_size = 2


[*.md]
indent_size = 4
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ coverage/
node_modules/
lcov-*
xunit*
!.eslintrc.js
!.eslintrc.js
37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

module.exports = {
extends: 'eslint:recommended',
env: {
node: true
},
parserOptions: {
ecmaVersion: 2015
},
rules: {
'brace-style': [2, 'stroustrup', {allowSingleLine: true}],
'no-console': 0,
strict: [2],
indent: [2, 4],

semi: ['error'],
'prefer-const': ['error'],
'no-var': ['error'],
'prefer-destructuring': ['error'],
'object-shorthand': ['error'],
quotes: ['error', 'single'],
'quote-props': ['error', 'as-needed'],
'prefer-template': ['error']
},
overrides: [
{
files: 'tests/**',
env: {
mocha: true
},
globals: {
expect: true
}
}
]
};
9 changes: 0 additions & 9 deletions .eslintrc.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ node_modules

.idea
.nyc_output


yarn.lock
package-lock.json
8 changes: 8 additions & 0 deletions .ncurc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

module.exports = {
// Whitelist all for checking besides `peer` which indicates
// somewhat older versions of `eslint` we still support even
// while our devDeps point to a more recent version
"dep": "prod,dev,optional,bundle"
};
32 changes: 32 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
node_modules
scripts

.github
artifacts
tests
.coveralls.yml
.eslint*
.gitignore
.travis.yml
yarn.lock
xunit.xml
commitlint.config.js
.nyc_output/
coverage
mocha-multi-reporters.tar.gz
node_modules
scripts

.github
artifacts
tests
.coveralls.yml
.eslint*
.gitignore
.travis.yml
yarn.lock
xunit.xml
commitlint.config.js
.nyc_output/
coverage
mocha-multi-reporters.tar.gz
53 changes: 38 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
after_success:
- cat artifacts/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
language: node_js
node_js:
- 'iojs'
- 'node'
- 'lts/*'
- '8'
- '7'
- '6'
- '5'
- '4'
sudo: false
- node
- lts/*
- 14
- 12
- 10
os:
- linux
matrix:
fast_finish: true
cache: yarn
env:
global:
- secure: GafZaP9uxJGukTI9UiKlMG5KbrJsin3xn3cRLXVjLLG4ctdPkXY+1w6RPJcRUm0ogCJS95p4HosltayyOQkb1Icve2nuaP4dqi79HKu+OgXqJ2VdNNT1XhK++QThmPrjq11sWank2m7LkbYm+rMj7PzxKUePAmloQUZLypSOQJk7jkQ5KAf0+nQv6K6Oj3xWJyDPFQkokQPc7EreaEV0iKi6RKoOhCed+Ju8KpbzBkj6ksRGwOaEVIkxFn7vNpQPO3X7JXQ/ZNQIB7Pbvolqi6JPuS3s/nnsFTA1Qiv4oQSV90yswH8ZlEZMN2hk8q/S7HzTMPXpZ/GGRNzBThbU+AUyCCiwQ8WzMwS5G0Ks+ICvhYdBc/stVvBpmYq7tQkib2Nj59hjG06AD9D+ZjU3QsmulBQ8jlZaD0zA334y+isQ35LLl6wkfIIzVQIU/dWj8V8x1clKjmhywDPMrTCgimQ9GT+Lk9BHAH0PbmOFQQc+h3ANfrZrypxHX8hhZxC7WxOto4ZGsFcf9nSikVSz9hgVxPlA3+Mkg220zBZEUe/MiBx9Q4ZdL465/NsTmqw6eRkcu28W0BAEVFh3+2GHDAHj4onW2f9PjX/Bdh3s6kXy8NzEFbbPr9wt5HK70x6U9H2rUbPpA2PIyp5UitnihGXXKC4ES1js/IHW0TjV9O4=
install: yarn install --ignore-engines
script: ./scripts/build.sh
after_success:
- cat artifacts/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
before_deploy:
- npm prune --production
- tar -czvf mocha-multi-reporters.tar.gz package.json index.js lib/* config.json LICENSE README.md CHANGELOG.md
- npm run deploy:prepare
deploy:
provider: npm
email: stanleyhlng77-dev@yahoo.com.hk
api_key:
secure: os3PhiyAVCtZw0rrFIl06LZVVCaifosZrMnjJxRcnjEjdqpybsQUdjWxj3JMIIC0sjrQmk4NvMCbgw23zP4BemsGcPelzeFH/fx6nu9nSBYNx9Bq2cNBP4+wvFgdTLyphzk5z24UZ3MlJWpb7xXR6mn76k5knvH5WS67hdZ8EWMaQOPWiQq57sSI/hautBeQpwdU0+vzXdf6gWDK7bCuGAYMvjLRa6JIU242GuzS1vPrdjatfXEJmot6PtBLt042T2v56ijw1eAHc3Z9AxN0t8FySZd7up/YsQcQvOXrWShmp2yt1nO19WGozEO1t0XDub19Rx7jNwOv7LLKPJbD9gkjZ/LlTxZuWjj8KJxWt45Hn+GWEueyqsDdRSH2ZuPDFpRza4V2E5SjuP8FO0+uQlb2qnSFH/psWwK/dikjvbqaAE6vZbel0xKzxg54n1NIni/olpWh/iiUB3I9o0w/UM/yXN8rh4CaYwyW8dOAql3dBhW42r+guFjXb6YfPq+zEbYhNjBLFk9hEV92qpCJ4xH+noNmszrO5Ybgp+AQDtxqIfsKX+841T1Ca401xPpYuPHGRe9Bmz96P/HmFOE8iXzQPwZMridZkTocwfoZjUxsFkxz3JJJ+vNwh7M7OmYqoTLSCUyX8RPqItPUmmBGnw0gYtGBQtgt3kHGlbOTR3c=
- provider: releases
api_key:
secure: @@@@@@@stanley api key
file: mocha-multi-reporters.tar.gz
skip_cleanup: true
on:
tags: true
repo: stanleyhlng/mocha-multi-reporters
branch: automatedRelease
node: "10"
- provider: script
skip_cleanup: true
script: ./scripts/publish.sh
on:
tags: true
branch: automatedRelease
node: "12"
97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.4.0](https://github.com/you54f/cypress-multi-reporters/compare/v1.3.0...v1.4.0) (2020-05-12)



## [1.3.0](https://github.com/you54f/cypress-multi-reporters/compare/v1.2.4...v1.3.0) (2020-05-11)



### [1.2.4](https://github.com/you54f/cypress-multi-reporters/compare/v1.2.3...v1.2.4) (2020-02-12)



### [1.2.3](https://github.com/you54f/cypress-multi-reporters/compare/v1.2.1...v1.2.3) (2019-10-17)



### [1.2.2](https://github.com/you54f/cypress-multi-reporters/compare/v1.2.1...v1.2.2) (2019-10-17)



### [1.2.1](https://github.com/you54f/cypress-multi-reporters/compare/v1.2.0...v1.2.1) (2019-08-07)



## [1.2.0](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.23...v1.2.0) (2019-07-08)


### Features

* **options:** add options in rc file ([#14](https://github.com/you54f/cypress-multi-reporters/issues/14)) ([5f633ec](https://github.com/you54f/cypress-multi-reporters/commit/5f633ec))



### [1.1.23](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.22...v1.1.23) (2019-07-08)



### [1.1.22](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.12...v1.1.22) (2019-06-07)


### Bug Fixes

* check reporter fix, by @cacaocake ([1dc3c9](https://github.com/you54f/cypress-multi-reporters/commit/1dc3c9))


### [1.1.21](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.20...v1.1.21) (2019-06-03)



### [1.1.20](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.19...v1.1.20) (2019-06-03)



### [1.1.19](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.18...v1.1.19) (2019-06-03)



### [1.1.18](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.17...v1.1.18) (2019-06-03)



### [1.1.17](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.16...v1.1.17) (2019-06-03)



### [1.1.16](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.15...v1.1.16) (2019-06-03)



### [1.1.15](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.14...v1.1.15) (2019-06-03)


### Bug Fixes

* update all the deps ([f8cd4f8](https://github.com/you54f/cypress-multi-reporters/commit/f8cd4f8))



### [1.1.14](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.13...v1.1.14) (2019-06-03)



### [1.1.13](https://github.com/you54f/cypress-multi-reporters/compare/v1.1.12...v1.1.13) (2019-06-03)


### Bug Fixes

* make compatible with mocha 6+ and earlier versions ([b8db10c](https://github.com/you54f/cypress-multi-reporters/commit/b8db10c))


### Build System

* automated pipeline ([88b06c7](https://github.com/you54f/cypress-multi-reporters/commit/88b06c7))
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Yousaf Nabi
Copyright (c) 2015 Stanley Ng

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
70 changes: 59 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
mocha-multi-reporters
===
## mocha-multi-reporters

Generate multiple mocha reports in a single mocha execution.

[![npm version](https://img.shields.io/npm/v/mocha-multi-reporters.svg?style=flat-square)](https://www.npmjs.com/package/mocha-multi-reporters)
[![StyleCI](https://styleci.io/repos/48823069/shield)](https://styleci.io/repos/48823069)
[![Build Status](https://travis-ci.org/stanleyhlng/mocha-multi-reporters.svg)](https://travis-ci.org/stanleyhlng/mocha-multi-reporters)
[![Coverage Status](https://coveralls.io/repos/stanleyhlng/mocha-multi-reporters/badge.svg?branch=master&service=github)](https://coveralls.io/github/stanleyhlng/mocha-multi-reporters?branch=master)
[![Dependency Status](https://img.shields.io/david/stanleyhlng/mocha-multi-reporters.svg?style=flat-square)](https://david-dm.org/stanleyhlng/mocha-multi-reporters)
[![devDependency Status](https://img.shields.io/david/dev/stanleyhlng/mocha-multi-reporters.svg?style=flat-square)](https://david-dm.org/stanleyhlng/mocha-multi-reporters#info=devDependencies)
![npm version](https://img.shields.io/npm/v/mocha-multi-reporters.svg)
![npm](https://img.shields.io/npm/dm/mocha-multi-reporters.svg)
[![Build Status](https://travis-ci.org/you54f/mocha-multi-reporters.svg)](https://travis-ci.org/you54f/mocha-multi-reporters)
[![Coverage Status](https://coveralls.io/repos/YOU54F/mocha-multi-reporters/badge.svg?branch=master&service=github)](https://coveralls.io/github/YOU54F/mocha-multi-reporters?branch=master)
[![Dependency Status](https://img.shields.io/david/you54f/mocha-multi-reporters.svg?style=flat-square)](https://david-dm.org/you54f/mocha-multi-reporters)
[![devDependency Status](https://img.shields.io/david/dev/you54f/mocha-multi-reporters.svg?style=flat-square)](https://david-dm.org/you54f/mocha-multi-reporters#info=devDependencies)


## Install

Expand Down Expand Up @@ -45,7 +45,27 @@ $ ./node_modules/.bin/mocha --reporter mocha-multi-reporters
</testsuite>
```

### Advanced
### Configuring reporters

Set the reporters configuration using `--reporter-options configFile=config.json`.
- Include reporters in `reporterEnabled` as a comma-delimited list
```js
{
"reporterEnabled": "spec, @my-org/custom"
}
```
- Specify each reporter's configuration using its camel-cased name, followed by `reporterOptions`, as key.
> For scoped reporters such as example @myorg/custom, remove all special characters.
```js
{
"reporterEnabled": "spec, @my-org/custom",
"myOrgCustomReporterOptions": {
// [...]
}
}
```

#### Examples:

* Generate `spec` and `json` reports.

Expand Down Expand Up @@ -215,12 +235,39 @@ $ cat xunit-custom.xml
</testsuites>
```

* When calling Mocha programmatically
### `cmrOutput` option

This option lets you dynamically replace the output files of reporter options.

In your Mocha `--reporterOptions`, specify `cmrOutput` with a plug-sign-separated
list of the reporter name, the property on that reporter's options to have replaced, and the dynamic ID you would like substituted. If you need multiple reporters
to have dynamic output, add additional plus-sign-separated lists separated by colons.

```sh
mocha --reporter mocha-multi-reporters --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@mochajs/json-file-reporter+output+specialID tests
```

```js
// mocha-multi-reporters.json
{
"mochajsJsonFileReporterReporterOptions": {
"output": "tests/results/file-{id}.json"
},
"reporterEnabled": "spec, @mochajs/json-file-reporter"
}
```

This will produce an `output` for `@mochajs/json-file-reporter`
`reporterOptions` with the value:

> tests/results/file-specialID.json
### Programmatic

Note that when Mocha is called programmatically, it is passed an options object when created. This object is usually derived from a config file that your mocha test runner reads prior to instantiation. This is the object that must contain a key `reporter` with a value of `mocha-multi-reporters` for this plugin to be used. You can also pass the key `reporterOptions` with a value of any of the above listed config files (including the `reporterEnabled` subkey and any other plugin configuration information.) This removes the requirement to have an intermediate configuration file specifically for the multireporter configuration.

```js
var mocha = new Mocha({
const mocha = new Mocha({
reporter: "mocha-multi-reporters",
timeout: config.testTimeout || 60000,
slow: config.slow || 10000,
Expand All @@ -241,6 +288,7 @@ Note that it will first check if reporterOptions contains a `configFile` key, an

The MIT License (MIT)

Copyright(c) 2019 Yousaf Nabi
Copyright(c) 2017 Stanley Ng

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: ['@commitlint/config-conventional']
};

0 comments on commit 9d39fae

Please sign in to comment.