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

@poppinss/prompts

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poppinss/prompts - npm Package Compare versions

Comparing version 3.1.0-1 to 3.1.0-2

4

build/src/base.d.ts

@@ -0,1 +1,3 @@

/// <reference types="node" resolution-mode="require"/>
import { AssertionError } from 'node:assert';
import { PromptChoice, ListPromptOptions, TextPromptOptions, TogglePromptOptions, ChoicePromptOptions, BooleanPromptOptions, MultiplePromptOptions, AutoCompletePromptOptions } from './types.js';

@@ -8,3 +10,3 @@ import { MockedPrompt } from './mocked_prompt.js';

prompt: MockedPrompt;
triggerError: Error;
triggerError: AssertionError;
}>;

@@ -11,0 +13,0 @@ verify: () => void;

@@ -0,1 +1,2 @@

import { AssertionError } from 'node:assert';
import { ObjectBuilder } from '@poppinss/utils';

@@ -176,3 +177,5 @@ import { colors } from './colors.js';

trap(message) {
const triggerError = new Error(`Expected prompt "${message}" to get triggered`);
const triggerError = new AssertionError({
message: `Expected prompt "${message}" to get triggered`,
});
const mockedPrompt = new MockedPrompt();

@@ -179,0 +182,0 @@ this.traps.prompts.set(message, { prompt: mockedPrompt, triggerError });

@@ -0,1 +1,3 @@

import { inspect } from 'node:util';
import { AssertionError } from 'node:assert';
export class MockedPrompt {

@@ -75,2 +77,3 @@ #answer;

result !== assertion.expectedErrorMessage) {
assertion.error.actual = result;
throw assertion.error;

@@ -141,7 +144,30 @@ }

assertFails(value, message) {
const error = new Error(message
? typeof message === 'string'
? `Expected assertion to fail with message "${message}"`
: `Expected assertion messages to match "${message}"`
: 'Expected assertion to fail');
if (!message) {
this.#assertions.push({
value,
expectsError: true,
expectedErrorMessage: message,
error: new AssertionError({
message: 'Expected prompt validation to fail',
stackStartFn: this.assertFails,
}),
});
return this;
}
if (typeof message === 'string') {
const error = new AssertionError({
message: `Expected prompt validation message to equal ${inspect(message)}`,
expected: message,
operator: 'strictEqual',
stackStartFn: this.assertFails,
});
Object.defineProperty(error, 'showDiff', { value: true });
this.#assertions.push({
value,
expectsError: true,
expectedErrorMessage: message,
error,
});
return this;
}
this.#assertions.push({

@@ -151,3 +177,6 @@ value,

expectedErrorMessage: message,
error: error,
error: new AssertionError({
message: `Expected prompt validation message to match ${inspect(message)}`,
expected: message,
}),
});

@@ -157,3 +186,5 @@ return this;

assertPasses(value) {
const error = new Error('Expected assertion to pass, instead it failed');
const error = new AssertionError({
message: 'Expected assertion to pass, instead it failed',
});
this.#assertions.push({

@@ -160,0 +191,0 @@ value,

{
"name": "@poppinss/prompts",
"version": "3.1.0-1",
"version": "3.1.0-2",
"description": "Wrapper over enquirer with better support for testing",

@@ -5,0 +5,0 @@ "main": "build/index.js",

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