Skip to content

Commit

Permalink
feat: add option to ignore cache
Browse files Browse the repository at this point in the history
- Introduced a new environment variable to bypass cache.
- Updated README to include usage instructions.
  • Loading branch information
LironMShemen committed Oct 21, 2024
1 parent 8f46a30 commit 04d3442
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ reset: () => void;
perform: (steps: string | string[]) => Promise<any | any[]>;
```

### **Additional Note**

In addition to the operations history, Copilot maintains a cache. If you need to ignore the current cache for any reason (e.g., when adding an action to the API driver), you can set the environment variable process.env.COPILOT_OVERRIDE_CACHE to "true" before running your tests. This will ensure that the current cache is not taken into consideration.
```bash
process.env.COPILOT_OVERRIDE_CACHE = "1"
```

## Integration with Testing Frameworks

Detox Copilot requires two main components to work:
Expand Down
2 changes: 1 addition & 1 deletion src/actions/StepPerformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class StepPerformer {
): Promise<string> {
const cacheKey = this.generateCacheKey(step, previous, viewHierarchy);

if (this.cache.has(cacheKey)) {
if (process.env.COPILOT_OVERRIDE_CACHE != "true" && this.cache.has(cacheKey)) {
return this.cache.get(cacheKey);
} else {
const prompt = this.promptCreator.createPrompt(step, viewHierarchy, isSnapshotImageAttached, previous);
Expand Down

0 comments on commit 04d3442

Please sign in to comment.