Socket
Socket
Sign inDemoInstall

test-exclude

Package Overview
Dependencies
11
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.3 to 6.0.0-alpha.0

default-exclude.js

25

CHANGELOG.md

@@ -6,2 +6,27 @@ # Change Log

# [6.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/test-exclude@5.2.3...test-exclude@6.0.0-alpha.0) (2019-06-19)
### Bug Fixes
* **win32:** Detect files on different drive as outside project ([#422](https://github.com/istanbuljs/istanbuljs/issues/422)) ([5b4ee88](https://github.com/istanbuljs/istanbuljs/commit/5b4ee88)), closes [#418](https://github.com/istanbuljs/istanbuljs/issues/418)
* Ignore tests matching *.cjs, *.mjs and *.ts by default ([#381](https://github.com/istanbuljs/istanbuljs/issues/381)) ([0f077c2](https://github.com/istanbuljs/istanbuljs/commit/0f077c2))
### Features
* ignore files under test**s** directories by default ([#419](https://github.com/istanbuljs/istanbuljs/issues/419)) ([8ad5fd2](https://github.com/istanbuljs/istanbuljs/commit/8ad5fd2))
* Remove configuration loading functionality ([#398](https://github.com/istanbuljs/istanbuljs/issues/398)) ([f5c93c3](https://github.com/istanbuljs/istanbuljs/commit/f5c93c3)), closes [#392](https://github.com/istanbuljs/istanbuljs/issues/392)
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
### BREAKING CHANGES
* Node.js 8 is now required
* Remove configuration loading functionality
## [5.2.3](https://github.com/istanbuljs/istanbuljs/compare/test-exclude@5.2.2...test-exclude@5.2.3) (2019-04-24)

@@ -8,0 +33,0 @@

42

index.js

@@ -0,6 +1,8 @@

'use strict';
const path = require('path');
const glob = require('glob');
const minimatch = require('minimatch');
const readPkgUp = require('read-pkg-up');
const requireMainFilename = require('require-main-filename');
const defaultExclude = require('./default-exclude');
const isOutsideDir = require('./is-outside-dir');

@@ -15,5 +17,2 @@ class TestExclude {

relativePath: true,
configKey: null, // the key to load config from in package.json.
configPath: null, // optionally override requireMainFilename.
configFound: false,
excludeNodeModules: true,

@@ -42,8 +41,4 @@ extension: false

if (!this.include && !this.exclude && this.configKey) {
Object.assign(this, this.pkgConf(this.configKey, this.configPath));
}
if (!this.exclude || !Array.isArray(this.exclude)) {
this.exclude = exportFunc.defaultExclude;
this.exclude = defaultExclude;
}

@@ -104,3 +99,3 @@

// Don't instrument files that are outside of the current working directory.
if (/^\.\./.test(path.relative(this.cwd, filename))) {
if (isOutsideDir(this.cwd, filename)) {
return false;

@@ -120,15 +115,2 @@ }

pkgConf(key, path) {
const cwd = path || requireMainFilename(require);
const obj = readPkgUp.sync({ cwd });
if (obj.pkg && obj.pkg[key] && typeof obj.pkg[key] === 'object') {
this.configFound = true;
return obj.pkg[key];
}
return {};
}
globSync(cwd = this.cwd) {

@@ -178,14 +160,4 @@ const globPatterns = getExtensionPattern(this.extension || []);

const devConfigs = ['ava', 'babel', 'jest', 'nyc', 'rollup', 'webpack'];
exportFunc.defaultExclude = defaultExclude;
exportFunc.defaultExclude = [
'coverage/**',
'packages/*/test/**',
'test/**',
'test{,-*}.js',
'**/*{.,-}test.js',
'**/__tests__/**',
`**/{${devConfigs.join()}}.config.js`
];
module.exports = exportFunc;
{
"name": "test-exclude",
"version": "5.2.3",
"description": "test for inclusion or exclusion of paths using pkg-conf and globs",
"version": "6.0.0-alpha.0",
"description": "test for inclusion or exclusion of paths using globs",
"main": "index.js",
"files": [
"index.js"
"*.js",
"!nyc.config.js"
],
"scripts": {
"test": "mocha"
"test": "nyc mocha"
},

@@ -30,11 +31,14 @@ "repository": {

"dependencies": {
"glob": "^7.1.3",
"minimatch": "^3.0.4",
"read-pkg-up": "^4.0.0",
"require-main-filename": "^2.0.0"
"glob": "^7.1.4",
"minimatch": "^3.0.4"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.1.4",
"nyc": "^14.1.1"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"gitHead": "90e60cc47833bb780680f916488ca24f0be36ca2"
"gitHead": "2e885073a9398806c9b8763dd39418398182ca34"
}

@@ -19,24 +19,2 @@ # test-exclude

_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

@@ -43,0 +21,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc