Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
50
node_modules/ava/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
50
node_modules/ava/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
export interface Options {
|
||||
/**
|
||||
Prettify the file paths in the stack:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly pretty?: boolean;
|
||||
|
||||
/**
|
||||
Remove the given base path from stack trace file paths, effectively turning absolute paths into relative ones.
|
||||
|
||||
Example with `'/Users/sindresorhus/dev/clean-stack/'` as `basePath`:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `unicorn.js:2:15`
|
||||
*/
|
||||
readonly basePath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
Clean up error stack traces. Removes the mostly unhelpful internal Node.js entries.
|
||||
|
||||
@param stack - The `stack` property of an `Error`.
|
||||
@returns The cleaned stack or `undefined` if the given `stack` is `undefined`.
|
||||
|
||||
@example
|
||||
```
|
||||
import cleanStack from 'clean-stack';
|
||||
|
||||
const error = new Error('Missing unicorn');
|
||||
|
||||
console.log(error.stack);
|
||||
|
||||
// Error: Missing unicorn
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
// at Module._compile (module.js:409:26)
|
||||
// at Object.Module._extensions..js (module.js:416:10)
|
||||
// at Module.load (module.js:343:32)
|
||||
// at Function.Module._load (module.js:300:12)
|
||||
// at Function.Module.runMain (module.js:441:10)
|
||||
// at startup (node.js:139:18)
|
||||
|
||||
console.log(cleanStack(error.stack));
|
||||
|
||||
// Error: Missing unicorn
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
```
|
||||
*/
|
||||
export default function cleanStack<T extends string | undefined>(stack: T, options?: Options): T;
|
||||
48
node_modules/ava/node_modules/clean-stack/index.js
generated
vendored
Normal file
48
node_modules/ava/node_modules/clean-stack/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import os from 'os';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
|
||||
const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
|
||||
const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
|
||||
const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir().replace(/\\/g, '/');
|
||||
|
||||
export default function cleanStack(stack, {pretty = false, basePath} = {}) {
|
||||
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, '/'))}`, 'g');
|
||||
|
||||
if (typeof stack !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return stack.replace(/\\/g, '/')
|
||||
.split('\n')
|
||||
.filter(line => {
|
||||
const pathMatches = line.match(extractPathRegex);
|
||||
if (pathMatches === null || !pathMatches[1]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const match = pathMatches[1];
|
||||
|
||||
// Electron
|
||||
if (
|
||||
match.includes('.app/Contents/Resources/electron.asar') ||
|
||||
match.includes('.app/Contents/Resources/default_app.asar')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !pathRegex.test(match);
|
||||
})
|
||||
.filter(line => line.trim() !== '')
|
||||
.map(line => {
|
||||
if (basePathRegex) {
|
||||
line = line.replace(basePathRegex, '$1');
|
||||
}
|
||||
|
||||
if (pretty) {
|
||||
line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
9
node_modules/ava/node_modules/clean-stack/license
generated
vendored
Normal file
9
node_modules/ava/node_modules/clean-stack/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
44
node_modules/ava/node_modules/clean-stack/package.json
generated
vendored
Normal file
44
node_modules/ava/node_modules/clean-stack/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "clean-stack",
|
||||
"version": "4.1.0",
|
||||
"description": "Clean up error stack traces",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/clean-stack",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"clean",
|
||||
"stack",
|
||||
"trace",
|
||||
"traces",
|
||||
"error",
|
||||
"electron"
|
||||
],
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
},
|
||||
"browser": {
|
||||
"os": false
|
||||
}
|
||||
}
|
||||
79
node_modules/ava/node_modules/clean-stack/readme.md
generated
vendored
Normal file
79
node_modules/ava/node_modules/clean-stack/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# clean-stack
|
||||
|
||||
> Clean up error stack traces
|
||||
|
||||
Removes the mostly unhelpful internal Node.js entries.
|
||||
|
||||
Also works in Electron.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install clean-stack
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import cleanStack from 'clean-stack';
|
||||
|
||||
const error = new Error('Missing unicorn');
|
||||
|
||||
console.log(error.stack);
|
||||
/*
|
||||
Error: Missing unicorn
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
at Module._compile (module.js:409:26)
|
||||
at Object.Module._extensions..js (module.js:416:10)
|
||||
at Module.load (module.js:343:32)
|
||||
at Function.Module._load (module.js:300:12)
|
||||
at Function.Module.runMain (module.js:441:10)
|
||||
at startup (node.js:139:18)
|
||||
*/
|
||||
|
||||
console.log(cleanStack(error.stack));
|
||||
/*
|
||||
Error: Missing unicorn
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cleanStack(stack, options?)
|
||||
|
||||
Returns the cleaned stack or `undefined` if the given `stack` is `undefined`.
|
||||
|
||||
#### stack
|
||||
|
||||
Type: `string | undefined`
|
||||
|
||||
The `stack` property of an [`Error`](https://github.com/microsoft/TypeScript/blob/eac073894b172ec719ca7f28b0b94fc6e6e7d4cf/lib/lib.es5.d.ts#L972-L976).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### pretty
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Prettify the file paths in the stack:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
|
||||
|
||||
##### basePath
|
||||
|
||||
Type: `string?`
|
||||
|
||||
Remove the given base path from stack trace file paths, effectively turning absolute paths into relative ones.
|
||||
|
||||
Example with `'/Users/sindresorhus/dev/clean-stack/'` as `basePath`:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `unicorn.js:2:15`
|
||||
|
||||
## Related
|
||||
|
||||
- [extract-stack](https://github.com/sindresorhus/extract-stack) - Extract the actual stack of an error
|
||||
- [stack-utils](https://github.com/tapjs/stack-utils) - Captures and cleans stack traces
|
||||
Loading…
Add table
Add a link
Reference in a new issue