Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@frontity/error

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontity/error - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

CHANGELOG.md

10

__tests__/index.test.ts

@@ -23,3 +23,3 @@ import { warn, error } from "..";

console.error = jest.fn();
error("This is wrong", false);
expect(() => error("This is wrong", { throw: false })).not.toThrow();
expect(console.error).toHaveBeenCalledTimes(1);

@@ -30,2 +30,10 @@ expect(console.error).toHaveBeenLastCalledWith(

});
test("In production, console.error the short message", () => {
process.env.NODE_ENV = "production";
console.error = jest.fn();
expect(() => error("This is wrong", { throw: false })).not.toThrow();
expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error).toHaveBeenLastCalledWith("This is wrong");
});
});

@@ -32,0 +40,0 @@

const suffix = "\nVisit https://community.frontity.org for help! 🙂\n";
export const error = (message: string, doThrow = true) => {
interface FrontityError {
(
message: string,
options?: {
throw?: boolean;
}
): void;
}
export const error: FrontityError = (message, options = {}) => {
const doThrow = typeof options.throw !== "undefined" ? options.throw : true;
if (process.env.NODE_ENV !== "production") {

@@ -5,0 +15,0 @@ if (doThrow) throw new Error(message + suffix);

11

package.json
{
"name": "@frontity/error",
"version": "0.0.1",
"version": "0.1.0",
"description": "Frontity errors and warnings",

@@ -9,6 +9,6 @@ "keywords": [

"homepage": "https://frontity.org",
"bugs": {
"url": "https://github.com/frontity/frontity/issues"
},
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"repository": {

@@ -21,6 +21,3 @@ "type": "git",

"test:inspect": "node --inspect ../../node_modules/.bin/jest --watch --no-cache --runInBand"
},
"bugs": {
"url": "https://github.com/frontity/frontity/issues"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc