-
Notifications
You must be signed in to change notification settings - Fork 333
feat: generate one cache file per test #361
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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
e764a44 to
f94262d
Compare
| this.client = createProvider(getConfig().ai); | ||
| this.browserTool = browserTool; | ||
| this.cache = cache; | ||
| this.testCache = new TestCache(test); |
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.
Not ideal to be initialized here. I think there should be a TestCase instance for each test, that can be passed around (instead of TestFunction). The cache could be linked to that.
(I've tried, but the diff of the PR got too big, so decided to leave it out)
| * | ||
| * @private | ||
| */ | ||
| private addToPendingCache(cacheStep: CacheStep) { |
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.
This is the responsibility of the caching system, rather than AIClient's.
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.
Legacy one-file caching system.
| try { | ||
| const cacheEntry: CacheEntry = { | ||
| test: { | ||
| name: this.test.name, |
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.
Extra metadata to help identify the test associated.
| const cacheEntry: CacheEntry = { | ||
| test: { | ||
| name: this.test.name, | ||
| filePath: this.test.filePath, |
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.
This seems to be empty all the time. Can be fixed in a separate PR.
| this.reporter.onRunEnd(); | ||
|
|
||
| if (this.exitOnSuccess && this.reporter.allTestsPassed()) { | ||
| process.exit(0); |
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.
Should not be TestRunner's responsibility to call process, as that short-circuits the logic in src/bin.ts, which prevents finally block to be executed.
| this.log.setGroup("💾"); | ||
|
|
||
| const cachedTest = await this.cache.get(test); | ||
| const testCache = new TestCache(test); |
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.
A future PR can simplify the logic, so that TestCache for a given test is initialized in a single location.
.shortest/cacheTestCacheto manage caching per-test.shortest/cache.jsonshortest cache clear [--force-purge]Why