-
Couldn't load subscription status.
- Fork 6
fix: locate test file path #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Not sure about the async-await changes to the log function, I think we don't need them after your fix now.
| error instanceof Error ? error.message : String(error); | ||
|
|
||
| logger.labeled("ERROR").error(`Execution failed: ${errorMessage}`); | ||
| await logger.labeled("ERROR").error(`Execution failed: ${errorMessage}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need this to be async-await now?
| // A wrapper function to make sure that failing test is not saved to cache. | ||
| // const wrapTest = (fn: () => Promise<void>) => | ||
| // async function () { | ||
| // try { | ||
| // await fn(); | ||
| // } catch (err) { | ||
| // testFailed = true; | ||
| // throw err; | ||
| // } | ||
| // }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
| private cacheOptions?: CacheOptions; | ||
| private snapshotComparator: SnapshotComparator; | ||
| private codeEvaluator: CodeEvaluator; | ||
| private resolvedCacheFilePath?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a great idea
# Conflicts: # package-lock.json
The line this.cacheFilePath = this.determineCurrentCacheFilePath(); was added back to loadCacheFromFile() to handle cases like Detox. Additionally, getCacheFilePath() was updated so that if getCurrentTestFileFromStackTrace() returns undefined, it first checks whether a path already exists before falling back to the default path.
After running in appium-test, still working.
packages/core/src/Pilot.ts
Outdated
| */ | ||
| async perform(...steps: string[]): Promise<any> { | ||
| this.loadCache(); | ||
| await this.loadCache(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check why do we need that
| const cacheFilePath = (newCacheHandler as any).cacheFilePath; | ||
| const cacheFilePath = await (newCacheHandler as any).cacheFilePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if needed
| this.cacheFilePath = this.determineCurrentCacheFilePath(); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need the await on this function
| progress: async () => { | ||
| await this.logWithLabel("info", label, "Starting"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably missed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Identify the path of the currently running test across all test runners, so the cache can be saved there.