-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[recorder] Support Vitest/Mocha both #28708
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.
THANK YOU for starting this! I have a few comments but honestly they are not blocking. Will finish my review after my next meeting
@@ -54,19 +92,23 @@ export class Recorder { | |||
private variables: Record<string, string>; | |||
private matcherSet = false; | |||
|
|||
constructor(private testContext?: Test | undefined) { | |||
constructor(private testContext?: TestInfo) { | |||
if (!this.testContext) { |
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.
👍 much prefer this style of coding. Does that also allow us to remove the if (this.testContext)
call in line 109 since we validated it exists already?
Also, previous code only threw if this.testContext is falsy and we're in recording / playback mode. So should this check also skip throwing if we're in live mode?
|
||
export function sessionFilePath(testContext: Mocha.Test): string { | ||
export interface TestContext { |
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 this live under testInfo ?
@@ -169,8 +170,8 @@ describe("TestProxyClient functions", () => { | |||
await client.start({ envSetupForPlayback: {} }); | |||
throw new Error("should not have reached here, start() call should have failed"); | |||
} catch (error: any) { | |||
expect((error as RecorderError).name).to.equal("RecorderError"); | |||
expect((error as RecorderError).message).to.equal( | |||
assert.equal((error as RecorderError).name, "RecorderError"); |
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.
total nitpicking, and feel free to ignore since it's also existing code, but I don't believe this error as RecorderError
gives us anything here (it's an any
today, and as
conversions aren't checked). Would be nice to do a minor cosmetic cleanup while we're here
"compilerOptions": { | ||
"outDir": "./dist-test/browser", | ||
"rootDir": ".", | ||
"skipLibCheck": true |
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.
Talk to me friendo, why do we need to skip lib check?
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.
Until we fix the whole browser testing stuff, it's just this way for now.
Closing in favor of #28667 |
Packages impacted by this PR
Issues associated with this PR
Describe the problem that is addressed by this PR
Migrates the @azure-tools/test-recorder to tshy and ESM to support both vitest and Mocha
What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists