-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Test Utils] [Recorder] Migrate to esm (#28667)
### Packages impacted by this PR `@azure-tools/test-recorder` ### Issues associated with this PR #28475 ### Describe the problem that is addressed by this PR Migrates `@azure-tools/test-recorder` to 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 `env` This involves bumping recorder to 4.0.0, a new major due to the nature of the change. `process.env` is employed in both node and browser vitest with playwright. - removes dotenv dependency - env shims for browser - deletes karma.conf ``` Exported "env" in 3.1.0 Exported "env" in 4.0.0 node Process.env Process.env browser Window.__env__ --No shim-- ``` Depends on #28917 ### Exposed sanitizer types - Enhanced the `addSanitizers` method and `SanitizerOptions` options 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.0` package now supports `vitest` and `playwright` (stops support for `mocha` and `karma`), employs `process.env` in both Node and browser environments. This aligns with the latest testing frameworks and provides improved testing capabilities. - The package has been simplified by removing the `dotenv` dependency and the `karma.conf` file, env shims for the browser. This streamlines the package dependencies and configuration files, respectively. - These changes introduce a new `env` strategy for all SDKs once they migrate to ESM and depend on `@azure-tools/test-recorder` version 4, as we employ `process.env` through vitest to access environment variables in both Node and browser environments. --------- Co-authored-by: Jeremy Meng <jeremy.ymeng@gmail.com> Co-authored-by: Matthew Podwysocki <matthewp@microsoft.com>
- Loading branch information
1 parent
1f4aa9a
commit 7f1f103
Showing
40 changed files
with
1,582 additions
and
712 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./build.json", | ||
"include": [ | ||
"../src/**/*.ts", | ||
"../src/**/*.mts", | ||
"../src/**/*.tsx" | ||
], | ||
"exclude": [], | ||
"compilerOptions": { | ||
"outDir": "../.tshy-build/browser" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "../src", | ||
"module": "nodenext", | ||
"moduleResolution": "nodenext" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"extends": "./build.json", | ||
"include": [ | ||
"../src/**/*.ts", | ||
"../src/**/*.cts", | ||
"../src/**/*.tsx" | ||
], | ||
"exclude": [ | ||
"../src/**/*.mts", | ||
"../src/utils/encoding-browser.mts", | ||
"../src/utils/relativePathCalculator-browser.mts" | ||
], | ||
"compilerOptions": { | ||
"outDir": "../.tshy-build/commonjs" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "./build.json", | ||
"include": [ | ||
"../src/**/*.ts", | ||
"../src/**/*.mts", | ||
"../src/**/*.tsx" | ||
], | ||
"exclude": [ | ||
".././src/utils/encoding-browser.mts", | ||
".././src/utils/relativePathCalculator-browser.mts" | ||
], | ||
"compilerOptions": { | ||
"outDir": "../.tshy-build/esm" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "./build.json", | ||
"include": [ | ||
"../src/**/*.ts", | ||
"../src/**/*.mts", | ||
"../src/**/*.tsx" | ||
], | ||
"exclude": [ | ||
".././src/utils/encoding-browser.mts", | ||
".././src/utils/relativePathCalculator-browser.mts" | ||
], | ||
"compilerOptions": { | ||
"outDir": "../.tshy-build/react-native" | ||
} | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
File renamed without changes.
This file contains 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
Oops, something went wrong.