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

detox-copilot

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detox-copilot - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

2

dist/utils/PromptCreator.d.ts

@@ -12,3 +12,3 @@ import { PreviousStep, TestingFrameworkAPICatalog } from "../types";

private createInstructions;
private createVisualAssertionsInstructionIfPossible;
private createStepByStepInstructions;
}

@@ -25,3 +25,2 @@ "use strict";

"Please generate the minimal executable code to perform the desired intent based on the given information and context.",
"If generating the relevant code is not possible due to ambiguity, invalid intent, or inability to find the desired element, return code that throws an informative error explaining the problem in one sentence.",
""

@@ -36,3 +35,3 @@ ];

"",
`Generate the minimal executable code to perform the following intent: "${intent}"`,
`Generate the minimal executable code to perform the following intent: \"${intent}\"`,
"",

@@ -52,3 +51,3 @@ "### View hierarchy",

`#### Step ${index + 1}`,
`- Intent: "${previousStep.step}"`,
`- Intent: \"${previousStep.step}\"`,
`- Generated code:`,

@@ -100,33 +99,39 @@ "```",

"",
[
`Generate the minimal executable code to perform the following intent: "${intent}"`,
"Use the provided API and follow the guidelines.",
"If you cannot generate the relevant code due to ambiguity, invalid intent, or inability to find the desired element, return code that throws an informative error explaining the problem in one sentence.",
"Wrap the generated code with backticks, without any additional formatting."
]
.concat(this.createVisualAssertionsInstructionIfPossible(isSnapshotImageAttached))
.map((instruction, index) => `${index + 1}. ${instruction}`)
.join('\n'),
`Your task is to generate the minimal executable code to perform the following intent: \"${intent}\"`,
"",
"### Examples of throwing an informative error:",
"```typescript",
'throw new Error("Unable to find the \'Submit\' button in the current view hierarchy.");',
"```",
"Please follow these steps carefully:",
"",
...this.createStepByStepInstructions(isSnapshotImageAttached).map((instruction, index) => `${index + 1}. ${instruction}`),
"",
"### Examples",
"",
"#### Example of throwing an informative error:",
"```typescript",
'throw new Error("The provided intent does not contain enough information to generate the code; \'button\' is too ambiguous for matching a specific element.");',
'throw new Error("Unable to find the \'Submit\' button element in the current context.");',
"```",
"",
""
].concat(isSnapshotImageAttached
? [
"#### Example of returning a commented visual test if the visual assertion passes:",
"```typescript",
"// Visual assertion passed based on the snapshot image.",
"```",
""
]
: []).concat([
"Please provide your response below:"
];
]);
}
createVisualAssertionsInstructionIfPossible(isSnapshotImageAttached) {
if (!isSnapshotImageAttached) {
return [];
createStepByStepInstructions(isSnapshotImageAttached) {
const steps = [];
if (isSnapshotImageAttached) {
steps.push("Analyze the provided intent, the view hierarchy, and the snapshot image to understand the required action.", "Determine if the intent can be fully validated visually using the snapshot image.", "If the intent can be visually asserted and passes the visual check, return code that only comments on the visual test.", "If the visual assertion fails, return code that throws an informative error explaining the failure.");
}
return [
"In case the expected behavior can be tested visually based on the provided snapshot image, there's no need to generate test code for the assertion. Instead, return code that throws an error if the visual check fails, or an empty code block if the visual check passes."
];
else {
steps.push("Analyze the provided intent and the view hierarchy to understand the required action.");
}
steps.push("If visual validation is not possible or insufficient, generate the minimal executable code required to perform the intent using the available API.", "If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence.", "Wrap the generated code with backticks, without any additional formatting.", "Do not provide any additional code beyond the minimal executable code required to perform the intent.");
return steps;
}
}
exports.PromptCreator = PromptCreator;
{
"name": "detox-copilot",
"version": "0.0.17",
"version": "0.0.18",
"description": "A flexible plugin that drives your tests with human-written commands, enhanced by the power of large language models (LLMs)",

@@ -5,0 +5,0 @@ "keywords": [

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