@stryker-mutator/util
Advanced tools
Comparing version 4.5.1 to 4.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [4.6.0](https://github.com/stryker-mutator/stryker-js/compare/v4.5.1...v4.6.0) (2021-04-16) | ||
### Features | ||
* **rename:** rename to StrykerJS ([#2813](https://github.com/stryker-mutator/stryker-js/issues/2813)) ([dc08592](https://github.com/stryker-mutator/stryker-js/commit/dc08592c09c0fe5fcc21db03dc2da4e03713f46b)), closes [#2754](https://github.com/stryker-mutator/stryker-js/issues/2754) | ||
## [4.5.1](https://github.com/stryker-mutator/stryker/compare/v4.5.0...v4.5.1) (2021-03-11) | ||
@@ -8,0 +19,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
* It will also delete the `module.children` property of the root module. | ||
* @see https://github.com/stryker-mutator/stryker/issues/2461 | ||
* @see https://github.com/stryker-mutator/stryker-js/issues/2461 | ||
*/ | ||
@@ -10,0 +10,0 @@ export declare class DirectoryRequireCache { |
@@ -13,3 +13,3 @@ "use strict"; | ||
* It will also delete the `module.children` property of the root module. | ||
* @see https://github.com/stryker-mutator/stryker/issues/2461 | ||
* @see https://github.com/stryker-mutator/stryker-js/issues/2461 | ||
*/ | ||
@@ -16,0 +16,0 @@ class DirectoryRequireCache { |
/// <reference types="node" /> | ||
export declare function isErrnoException(error: Error): error is NodeJS.ErrnoException; | ||
export declare function isErrnoException(error: unknown): error is NodeJS.ErrnoException; | ||
export declare function errorToString(error: any): string; | ||
//# sourceMappingURL=errors.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
function isErrnoException(error) { | ||
return typeof error.code === 'string'; | ||
return error instanceof Error && typeof error.code === 'string'; | ||
} | ||
@@ -14,6 +14,6 @@ exports.isErrnoException = isErrnoException; | ||
} | ||
else if (isErrnoException(error)) { | ||
return `${error.name}: ${error.code} (${error.syscall}) ${error.stack}`; | ||
} | ||
else if (error instanceof Error) { | ||
if (error instanceof Error) { | ||
if (isErrnoException(error)) { | ||
return `${error.name}: ${error.code} (${error.syscall}) ${error.stack}`; | ||
} | ||
const message = `${error.name}: ${error.message}`; | ||
@@ -27,7 +27,5 @@ if (error.stack) { | ||
} | ||
else { | ||
return error.toString(); | ||
} | ||
return error.toString(); | ||
} | ||
exports.errorToString = errorToString; | ||
//# sourceMappingURL=errors.js.map |
export declare class StrykerError extends Error { | ||
readonly innerError?: Error | undefined; | ||
constructor(message: string, innerError?: Error | undefined); | ||
readonly innerError?: unknown; | ||
constructor(message: string, innerError?: unknown); | ||
} | ||
//# sourceMappingURL=stryker-error.d.ts.map |
{ | ||
"name": "@stryker-mutator/util", | ||
"version": "4.5.1", | ||
"version": "4.6.0", | ||
"description": "Contains utilities for Stryker, the mutation testing framework for JavaScript and friends", | ||
@@ -15,3 +15,4 @@ "main": "dist/src/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/stryker-mutator/stryker.git" | ||
"url": "https://github.com/stryker-mutator/stryker-js.git", | ||
"directory": "packages/util" | ||
}, | ||
@@ -28,5 +29,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/stryker-mutator/stryker/issues" | ||
"url": "https://github.com/stryker-mutator/stryker-js/issues" | ||
}, | ||
"homepage": "https://github.com/stryker-mutator/stryker/tree/master/packages/util#readme", | ||
"homepage": "https://github.com/stryker-mutator/stryker-js/tree/master/packages/util#readme", | ||
"devDependencies": { | ||
@@ -39,3 +40,3 @@ "@types/lodash.flatmap": "~4.5.6", | ||
}, | ||
"gitHead": "d777b6da78657b2be77099b096c5dbfee5a36339" | ||
"gitHead": "78c63606467f80f16ac61e5c0e1447fa56654f05" | ||
} |
@@ -1,3 +0,3 @@ | ||
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fstryker-mutator%2Fstryker%2Fmaster%3Fmodule%3Dutil)](https://dashboard.stryker-mutator.io/reports/github.com/stryker-mutator/stryker/master?module=util) | ||
[![Build Status](https://github.com/stryker-mutator/stryker/workflows/CI/badge.svg)](https://github.com/stryker-mutator/stryker/actions?query=workflow%3ACI+branch%3Amaster) | ||
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fstryker-mutator%2Fstryker-js%2Fmaster%3Fmodule%3Dutil)](https://dashboard.stryker-mutator.io/reports/github.com/stryker-mutator/stryker-js/master?module=util) | ||
[![Build Status](https://github.com/stryker-mutator/stryker-js/workflows/CI/badge.svg)](https://github.com/stryker-mutator/stryker-js/actions?query=workflow%3ACI+branch%3Amaster) | ||
[![NPM](https://img.shields.io/npm/dm/@stryker-mutator/utils.svg)](https://www.npmjs.com/package/@stryker-mutator/utils) | ||
@@ -7,6 +7,6 @@ [![Node version](https://img.shields.io/node/v/@stryker-mutator/utils.svg)](https://img.shields.io/node/v/@stryker-mutator/utils.svg) | ||
![Stryker](https://github.com/stryker-mutator/stryker/raw/master/stryker-80x80.png) | ||
![Stryker](https://github.com/stryker-mutator/stryker-js/raw/master/stryker-80x80.png) | ||
# Stryker Util | ||
# StrykerJS Util | ||
Utility functions for Stryker plugins and/or core packages. | ||
Utility functions for StrykerJS plugins and/or core packages. |
@@ -18,3 +18,3 @@ export type DeepPartial<T> = { | ||
} else { | ||
deepMerge(defaultValue, overrideValue); | ||
deepMerge(defaultValue, overrideValue as DeepPartial<T>); | ||
} | ||
@@ -21,0 +21,0 @@ } |
@@ -11,3 +11,3 @@ import path from 'path'; | ||
* It will also delete the `module.children` property of the root module. | ||
* @see https://github.com/stryker-mutator/stryker/issues/2461 | ||
* @see https://github.com/stryker-mutator/stryker-js/issues/2461 | ||
*/ | ||
@@ -14,0 +14,0 @@ export class DirectoryRequireCache { |
@@ -1,3 +0,3 @@ | ||
export function isErrnoException(error: Error): error is NodeJS.ErrnoException { | ||
return typeof (error as NodeJS.ErrnoException).code === 'string'; | ||
export function isErrnoException(error: unknown): error is NodeJS.ErrnoException { | ||
return error instanceof Error && typeof (error as NodeJS.ErrnoException).code === 'string'; | ||
} | ||
@@ -9,5 +9,7 @@ | ||
return ''; | ||
} else if (isErrnoException(error)) { | ||
return `${error.name}: ${error.code} (${error.syscall}) ${error.stack}`; | ||
} else if (error instanceof Error) { | ||
} | ||
if (error instanceof Error) { | ||
if (isErrnoException(error)) { | ||
return `${error.name}: ${error.code} (${error.syscall}) ${error.stack}`; | ||
} | ||
const message = `${error.name}: ${error.message}`; | ||
@@ -19,5 +21,4 @@ if (error.stack) { | ||
} | ||
} else { | ||
return error.toString(); | ||
} | ||
return error.toString(); | ||
} |
import { errorToString } from './errors'; | ||
export class StrykerError extends Error { | ||
constructor(message: string, public readonly innerError?: Error) { | ||
constructor(message: string, public readonly innerError?: unknown) { | ||
super(`${message}${innerError ? `. Inner error: ${errorToString(innerError)}` : ''}`); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73222
868