Comparing version 0.28.0 to 0.28.1
@@ -17,2 +17,3 @@ #!/usr/bin/env node | ||
const meow_1 = __importDefault(require("meow")); | ||
const interfaces_1 = require("./lib/interfaces"); | ||
const formatter_1 = __importDefault(require("./lib/formatter")); | ||
@@ -90,2 +91,5 @@ const lib_1 = __importDefault(require("./lib")); | ||
const potentialError = error; | ||
if (potentialError instanceof interfaces_1.TsdError) { | ||
exit(potentialError.message); | ||
} | ||
const errorMessage = (_b = (_a = potentialError === null || potentialError === void 0 ? void 0 : potentialError.stack) !== null && _a !== void 0 ? _a : potentialError === null || potentialError === void 0 ? void 0 : potentialError.message) !== null && _b !== void 0 ? _b : 'tsd unexpectedly crashed.'; | ||
@@ -92,0 +96,0 @@ exit(`Error running tsd:\n${errorMessage}`); |
@@ -22,2 +22,3 @@ "use strict"; | ||
const rules_1 = __importDefault(require("./rules")); | ||
const interfaces_1 = require("./interfaces"); | ||
const findTypingsFile = (pkg, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -32,3 +33,3 @@ const typings = options.typingsFile || | ||
if (!typingsExist) { | ||
throw new Error(`The type definition \`${typings}\` does not exist at \`${typingsPath}\`. Is the path correct? Create one and try again.`); | ||
throw new interfaces_1.TsdError(`The type definition \`${typings}\` does not exist at \`${typingsPath}\`. Is the path correct? Create one and try again.`); | ||
} | ||
@@ -46,3 +47,3 @@ return typings; | ||
if (testFiles.length === 0) { | ||
throw new Error('Could not find any test files with the given pattern(s). Create one and try again.'); | ||
throw new interfaces_1.TsdError('Could not find any test files with the given pattern(s). Create one and try again.'); | ||
} | ||
@@ -64,3 +65,3 @@ return testFiles.map(file => path_1.default.join(cwd, file)); | ||
if (testFiles.length === 0 && !testDirExists) { | ||
throw new Error(`The test file \`${testFile}\` or \`${tsxTestFile}\` does not exist in \`${options.cwd}\`. Create one and try again.`); | ||
throw new interfaces_1.TsdError(`The test file \`${testFile}\` or \`${tsxTestFile}\` does not exist in \`${options.cwd}\`. Create one and try again.`); | ||
} | ||
@@ -80,3 +81,3 @@ if (testFiles.length === 0) { | ||
if (!pkgResult) { | ||
throw new Error(`No \`package.json\` file found in \`${options.cwd}\`. Make sure you are running the command in a Node.js project.`); | ||
throw new interfaces_1.TsdError(`No \`package.json\` file found in \`${options.cwd}\`. Make sure you are running the command in a Node.js project.`); | ||
} | ||
@@ -83,0 +84,0 @@ const pkg = pkgResult.packageJson; |
@@ -66,1 +66,4 @@ import { CompilerOptions } from '@tsd/typescript'; | ||
} | ||
export declare class TsdError extends Error { | ||
constructor(message: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DiagnosticCode = void 0; | ||
exports.TsdError = exports.DiagnosticCode = void 0; | ||
var DiagnosticCode; | ||
@@ -36,1 +36,8 @@ (function (DiagnosticCode) { | ||
})(DiagnosticCode = exports.DiagnosticCode || (exports.DiagnosticCode = {})); | ||
class TsdError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = this.constructor.name; | ||
} | ||
} | ||
exports.TsdError = TsdError; |
{ | ||
"name": "tsd", | ||
"version": "0.28.0", | ||
"version": "0.28.1", | ||
"description": "Check TypeScript type definitions", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
90339
1738