Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,190 @@
# Change Log
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.
<a name="4.1.1"></a>
## [4.1.1](https://github.com/istanbuljs/istanbuljs/compare/test-exclude@4.1.0...test-exclude@4.1.1) (2017-05-27)
### Bug Fixes
* add more general support for negated exclude rules ([#58](https://github.com/istanbuljs/istanbuljs/issues/58)) ([08445db](https://github.com/istanbuljs/istanbuljs/commit/08445db))
<a name="4.1.0"></a>
# [4.1.0](https://github.com/istanbuljs/test-exclude/compare/test-exclude@4.0.3...test-exclude@4.1.0) (2017-04-29)
### Features
* add possibility to filter coverage maps when running reports post-hoc ([#24](https://github.com/istanbuljs/istanbuljs/issues/24)) ([e1c99d6](https://github.com/istanbuljs/test-exclude/commit/e1c99d6))
<a name="4.0.3"></a>
## [4.0.3](https://github.com/istanbuljs/test-exclude/compare/test-exclude@4.0.2...test-exclude@4.0.3) (2017-03-21)
<a name="4.0.2"></a>
## [4.0.2](https://github.com/istanbuljs/test-exclude/compare/test-exclude@4.0.0...test-exclude@4.0.2) (2017-03-21)
<a name="4.0.0"></a>
# [4.0.0](https://github.com/istanbuljs/test-exclude/compare/v3.3.0...v4.0.0) (2017-01-19)
### Features
* add coverage to default excludes ([#23](https://github.com/istanbuljs/test-exclude/issues/23)) ([59e8bbf](https://github.com/istanbuljs/test-exclude/commit/59e8bbf))
### BREAKING CHANGES
* additional coverage folder is now excluded
<a name="3.3.0"></a>
# [3.3.0](https://github.com/istanbuljs/test-exclude/compare/v3.2.2...v3.3.0) (2016-11-22)
### Features
* allow include/exclude rules to be a string rather than array ([#22](https://github.com/istanbuljs/test-exclude/issues/22)) ([f8f99c6](https://github.com/istanbuljs/test-exclude/commit/f8f99c6))
<a name="3.2.2"></a>
## [3.2.2](https://github.com/istanbuljs/test-exclude/compare/v3.2.1...v3.2.2) (2016-11-14)
### Bug Fixes
* we no longer need to add node_modules/** rule ([d0cfbc3](https://github.com/istanbuljs/test-exclude/commit/d0cfbc3))
<a name="3.2.1"></a>
## [3.2.1](https://github.com/istanbuljs/test-exclude/compare/v3.2.0...v3.2.1) (2016-11-14)
### Bug Fixes
* fix bug matching files in root, introduced by dotfiles setting ([27b249c](https://github.com/istanbuljs/test-exclude/commit/27b249c))
<a name="3.2.0"></a>
# [3.2.0](https://github.com/istanbuljs/test-exclude/compare/v3.1.0...v3.2.0) (2016-11-14)
### Features
* adds *.test.*.js exclude rule ([#20](https://github.com/istanbuljs/test-exclude/issues/20)) ([34f5cba](https://github.com/istanbuljs/test-exclude/commit/34f5cba))
<a name="3.1.0"></a>
# [3.1.0](https://github.com/istanbuljs/test-exclude/compare/v3.0.0...v3.1.0) (2016-11-14)
### Features
* we now support dot folders ([f2c1598](https://github.com/istanbuljs/test-exclude/commit/f2c1598))
<a name="3.0.0"></a>
# [3.0.0](https://github.com/istanbuljs/test-exclude/compare/v2.1.3...v3.0.0) (2016-11-13)
### Features
* always exclude node_modules ([#18](https://github.com/istanbuljs/test-exclude/issues/18)) ([b86d144](https://github.com/istanbuljs/test-exclude/commit/b86d144))
### BREAKING CHANGES
* `**/node_modules/**` is again added by default, but can be counteracted with `!**/node_modules/**`.
<a name="2.1.3"></a>
## [2.1.3](https://github.com/istanbuljs/test-exclude/compare/v2.1.2...v2.1.3) (2016-09-30)
### Bug Fixes
* switch lodash.assign to object-assign ([#16](https://github.com/istanbuljs/test-exclude/issues/16)) ([45a5488](https://github.com/istanbuljs/test-exclude/commit/45a5488))
<a name="2.1.2"></a>
## [2.1.2](https://github.com/istanbuljs/test-exclude/compare/v2.1.1...v2.1.2) (2016-08-31)
### Bug Fixes
* **exclude-config:** Use the defaultExcludes for anything passed in that is not an array ([#15](https://github.com/istanbuljs/test-exclude/issues/15)) ([227042f](https://github.com/istanbuljs/test-exclude/commit/227042f))
<a name="2.1.1"></a>
# [2.1.1](https://github.com/istanbuljs/test-exclude/compare/v2.1.0...v2.1.1) (2016-08-12)
### Bug Fixes
* it should be possible to cover the node_modules folder ([#13](https://github.com/istanbuljs/test-exclude/issues/13)) ([09f2788](https://github.com/istanbuljs/test-exclude/commit/09f2788))
<a name="2.1.0"></a>
# [2.1.0](https://github.com/istanbuljs/test-exclude/compare/v2.0.0...v2.1.0) (2016-08-12)
### Features
* export defaultExclude, so that it can be used in yargs' default settings ([#12](https://github.com/istanbuljs/test-exclude/issues/12)) ([5b3743b](https://github.com/istanbuljs/test-exclude/commit/5b3743b))
<a name="2.0.0"></a>
# [2.0.0](https://github.com/istanbuljs/test-exclude/compare/v1.1.0...v2.0.0) (2016-08-12)
### Bug Fixes
* use Array#reduce and remove unneeded branch in prepGlobPatterns ([#5](https://github.com/istanbuljs/test-exclude/issues/5)) ([c0f0f59](https://github.com/istanbuljs/test-exclude/commit/c0f0f59))
### Features
* don't exclude anything when empty array passed ([#11](https://github.com/istanbuljs/test-exclude/issues/11)) ([200ec07](https://github.com/istanbuljs/test-exclude/commit/200ec07))
### BREAKING CHANGES
* we now allow an empty array to be passed in, making it possible to disable the default exclude rules -- we will need to be mindful when pulling this logic into nyc.
<a name="1.1.0"></a>
# [1.1.0](https://github.com/bcoe/test-exclude/compare/v1.0.0...v1.1.0) (2016-06-08)
### Features
* set configFound if we find a configuration key in package.json ([#2](https://github.com/bcoe/test-exclude/issues/2)) ([64da7b9](https://github.com/bcoe/test-exclude/commit/64da7b9))
<a name="1.0.0"></a>
# 1.0.0 (2016-06-06)
### Features
* initial commit, pulled over some of the functionality from nyc ([3f1fce3](https://github.com/bcoe/test-exclude/commit/3f1fce3))
* you can now load include/exclude logic from a package.json stanza ([#1](https://github.com/bcoe/test-exclude/issues/1)) ([29b543d](https://github.com/bcoe/test-exclude/commit/29b543d))

View File

@@ -0,0 +1,14 @@
Copyright (c) 2016, Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,56 @@
# test-exclude
The file include/exclude logic used by [nyc](https://github.com/istanbuljs/nyc).
[![Build Status](https://travis-ci.org/istanbuljs/test-exclude.svg)](https://travis-ci.org/istanbuljs/test-exclude)
[![Coverage Status](https://coveralls.io/repos/github/istanbuljs/test-exclude/badge.svg?branch=master)](https://coveralls.io/github/istanbuljs/test-exclude?branch=master)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/test-exclude.svg)](https://greenkeeper.io/)
## Usage
```js
const exclude = require('test-exclude')
if (exclude().shouldInstrument('./foo.js')) {
// let's instrument this file for test coverage!
}
```
_you can load configuration from a key in package.json:_
_package.json_
```json
{
"name": "awesome-module",
"test": {
"include": ["**/index.js"]
}
}
```
_app.js_
```js
const exclude = require('test-exclude')
if (exclude({configKey: 'test'}).shouldInstrument('./index.js')) {
// let's instrument this file for test coverage!
}
```
## Including node_modules folder
by default the `node_modules` folder is added to all groups of
exclude rules. In the rare case that you wish to instrument files
stored in `node_modules`, a negative glob can be used:
```js
const exclude = require('test-exclude')
const e = exclude({
exclude: ['!**/node_modules/**']
})
```
## License
ISC

View File

@@ -0,0 +1,135 @@
const assign = require('object-assign')
const arrify = require('arrify')
const micromatch = require('micromatch')
const path = require('path')
const readPkgUp = require('read-pkg-up')
const requireMainFilename = require('require-main-filename')
function TestExclude (opts) {
assign(this, {
cwd: process.cwd(),
include: false,
relativePath: true,
configKey: null, // the key to load config from in package.json.
configPath: null, // optionally override requireMainFilename.
configFound: false
}, opts)
if (typeof this.include === 'string') this.include = [this.include]
if (typeof this.exclude === 'string') this.exclude = [this.exclude]
if (!this.include && !this.exclude && this.configKey) {
assign(this, this.pkgConf(this.configKey, this.configPath))
}
if (!this.exclude || !Array.isArray(this.exclude)) {
this.exclude = exportFunc.defaultExclude
}
if (this.include && this.include.length > 0) {
this.include = prepGlobPatterns(arrify(this.include))
} else {
this.include = false
}
if (this.exclude.indexOf('**/node_modules/**') === -1) {
this.exclude.push('**/node_modules/**')
}
this.exclude = prepGlobPatterns(
[].concat(arrify(this.exclude))
)
this.handleNegation()
}
// handle the special case of negative globs
// (!**foo/bar); we create a new this.excludeNegated set
// of rules, which is applied after excludes and we
// move excluded include rules into this.excludes.
TestExclude.prototype.handleNegation = function () {
if (Array.isArray(this.include)) {
const includeNegated = this.include.filter(function (e) {
return e.charAt(0) === '!'
}).map(function (e) {
return e.slice(1)
})
this.exclude.push.apply(this.exclude, prepGlobPatterns(includeNegated))
this.include = this.include.filter(function (e) {
return e.charAt(0) !== '!'
})
}
this.excludeNegated = this.exclude.filter(function (e) {
return e.charAt(0) === '!'
}).map(function (e) {
return e.slice(1)
})
this.exclude = this.exclude.filter(function (e) {
return e.charAt(0) !== '!'
})
this.excludeNegated = prepGlobPatterns(this.excludeNegated)
}
TestExclude.prototype.shouldInstrument = function (filename, relFile) {
var pathToCheck = filename
if (this.relativePath) {
relFile = relFile || path.relative(this.cwd, filename)
// Don't instrument files that are outside of the current working directory.
if (/^\.\./.test(path.relative(this.cwd, filename))) return false
pathToCheck = relFile.replace(/^\.[\\/]/, '') // remove leading './' or '.\'.
}
return (
!this.include ||
micromatch.any(pathToCheck, this.include, {dotfiles: true})) &&
(!micromatch.any(pathToCheck, this.exclude, {dotfiles: true}) ||
micromatch.any(pathToCheck, this.excludeNegated, {dotfiles: true}))
}
TestExclude.prototype.pkgConf = function (key, path) {
const obj = readPkgUp.sync({
cwd: path || requireMainFilename(require)
})
if (obj.pkg && obj.pkg[key] && typeof obj.pkg[key] === 'object') {
this.configFound = true
return obj.pkg[key]
} else {
return {}
}
}
function prepGlobPatterns (patterns) {
return patterns.reduce(function (result, pattern) {
// Allow gitignore style of directory exclusion
if (!/\/\*\*$/.test(pattern)) {
result = result.concat(pattern.replace(/\/$/, '') + '/**')
}
// Any rules of the form **/foo.js, should also match foo.js.
if (/^\*\*\//.test(pattern)) {
result = result.concat(pattern.replace(/^\*\*\//, ''))
}
return result.concat(pattern)
}, [])
}
var exportFunc = function (opts) {
return new TestExclude(opts)
}
exportFunc.defaultExclude = [
'coverage/**',
'test/**',
'test{,-*}.js',
'**/*.test.js',
'**/__tests__/**',
'**/node_modules/**'
]
module.exports = exportFunc

View File

@@ -0,0 +1,78 @@
{
"_args": [
[
"test-exclude@4.1.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "test-exclude@4.1.1",
"_id": "test-exclude@4.1.1",
"_inBundle": false,
"_integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==",
"_location": "/react-scripts/test-exclude",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "test-exclude@4.1.1",
"name": "test-exclude",
"escapedName": "test-exclude",
"rawSpec": "4.1.1",
"saveSpec": null,
"fetchSpec": "4.1.1"
},
"_requiredBy": [
"/react-scripts/babel-plugin-istanbul"
],
"_resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz",
"_spec": "4.1.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Ben Coe",
"email": "ben@npmjs.com"
},
"bugs": {
"url": "https://github.com/istanbuljs/istanbuljs/issues"
},
"dependencies": {
"arrify": "^1.0.1",
"micromatch": "^2.3.11",
"object-assign": "^4.1.0",
"read-pkg-up": "^1.0.1",
"require-main-filename": "^1.0.1"
},
"description": "test for inclusion or exclusion of paths using pkg-conf and globs",
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.1.2",
"standard": "^9.0.0"
},
"files": [
"index.js"
],
"greenkeeper": {
"ignore": [
"read-pkg-up"
]
},
"homepage": "https://github.com/istanbuljs/istanbuljs#readme",
"keywords": [
"exclude",
"include",
"glob",
"package",
"config"
],
"license": "ISC",
"main": "index.js",
"name": "test-exclude",
"repository": {
"type": "git",
"url": "git+https://github.com/istanbuljs/istanbuljs.git"
},
"scripts": {
"pretest": "standard",
"test": "mocha"
},
"version": "4.1.1"
}