[Test Utils] [Recorder] Migrate to esm#28667
Merged
HarshaNalluru merged 89 commits intoAzure:mainfrom Apr 1, 2024
Merged
Conversation
Currently we just need suite title and test title to generate recording
file names. `vitest` provides the info via `context` of the callback
function.
This PR adds vitest support to recorder. Call site would look like
```ts
//...
beforeEach(async (context) => {
recorder = new Recorder(context);
```
…ng/azure-sdk-for-js into harshan/migrate-to-esm/test-utils
… harshan/migrate-to-esm/test-utils
3 tasks
mpodwysocki
reviewed
Feb 28, 2024
mpodwysocki
reviewed
Feb 28, 2024
timovv
reviewed
Feb 29, 2024
…ng/azure-sdk-for-js into harshan/migrate-to-esm/test-utils
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
mpodwysocki
reviewed
Mar 29, 2024
Normalizing the code just a little bit.
mpodwysocki
approved these changes
Mar 29, 2024
Contributor
mpodwysocki
left a comment
There was a problem hiding this comment.
Made some minor changes, but looks good. You will need to resolve the conflicts and run rush update with the dependency changes I've made.
… harshan/migrate-to-esm/test-utils
HarshaNalluru
added a commit
that referenced
this pull request
Apr 1, 2024
Listed types in package.json and files included for publishing were not in sync. `"types": "types/tools-test-credential.d.ts"` vs `"types/latest/src"` Needed to unblock #28667
… harshan/migrate-to-esm/test-utils
… harshan/migrate-to-esm/test-utils
… harshan/migrate-to-esm/test-utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Packages impacted by this PR
@azure-tools/test-recorderIssues associated with this PR
#28475
Describe the problem that is addressed by this PR
Migrates
@azure-tools/test-recorderto ESM, supports both vitest and mocha.What's in the PR
This PR also pulls in @jeremymeng's change to update recorder file path calculation that got reverted #28423
One major non-breaking change to
envThis involves bumping recorder to 4.0.0, a new major due to the nature of the change.
process.envis employed in both node and browser vitest with playwright.Depends on #28917
Exposed sanitizer types
Enhanced the
addSanitizersmethod andSanitizerOptionsoptions bag by exposing the following sanitizer types for more flexible usage:FindReplaceSanitizer: A sanitizer that finds and replaces specified strings.RegexSanitizer: A sanitizer that uses regular expressions for pattern matching and replacement.StringSanitizer: A sanitizer that handles string-based sanitization tasks.HeaderSanitizer: A sanitizer specifically designed for handling HTTP headers.ConnectionStringSanitizer: A sanitizer that securely handles connection strings.RemoveHeaderSanitizer: A sanitizer that removes specified headers from HTTP requests or responses.This update aims to provide users with a more comprehensive and customizable sanitization process.
Breaking Changes
The
@azure-tools/test-recorder@4.0.0package now supportsvitestandplaywright(stops support formochaandkarma), employsprocess.envin both Node and browser environments. This aligns with the latest testing frameworks and provides improved testing capabilities.dotenvdependency and thekarma.conffile, env shims for the browser. This streamlines the package dependencies and configuration files, respectively.envstrategy for all SDKs once they migrate to ESM and depend on@azure-tools/test-recorderversion 4, as we employprocess.envthrough vitest to access environment variables in both Node and browser environments.@azure-tools/test-credential@2.0.0is introduced and will now consume@azure-tools/test-recorder@4.0.0with the new env strategy.