Skip to content

Commit 01f1678

Browse files
[Recorder] Fix outdated docs (#34712)
#34506 - suppresses the snippet checks This pull request updates the `relativePathCalculator.ts` file to update documentation for better clarity and usability.
1 parent ea23f17 commit 01f1678

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

sdk/test-utils/recorder/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ For further understanding, please read the [ASSET_SYNC_WORKFLOW.md](https://gith
142142

143143
Inside a vitest test (either in the `beforeEach` or in the test body itself), you will need to instantiate the `Recorder` as below to leverage its functionalities.
144144

145-
```js
145+
```ts
146146
let recorder: Recorder;
147147

148148
beforeEach(async function (context) {
@@ -152,13 +152,13 @@ beforeEach(async function (context) {
152152

153153
The client being tested needs to add the recording policy that redirects requests to the test-proxy tool first before they go to the service. This is done by simply passing the client options bag through the `recorder.configureClientOptions` helper:
154154

155-
```js
155+
```ts
156156
const client = new MyServiceClient(/** args **/, recorder.configureClientOptions(/** client options **/));
157157
```
158158

159159
Recording starts with the `recorder.start()` method.
160160

161-
```js
161+
```ts
162162
await recorder.start(/** recorderOptions go here **/);
163163
```
164164

@@ -168,7 +168,7 @@ Any requests that are made using the above `client (MyServiceClient)` will be re
168168

169169
Likewise, in `playback` mode, the saved responses are utilized by the test-proxy tool when the requests are redirected to it instead of reaching the service.
170170

171-
```js
171+
```ts
172172
await recorder.stop();
173173
```
174174

@@ -341,7 +341,7 @@ We try our best to make sure the sensitive information is not leaked anywhere wi
341341

342342
`envSetupForPlayback` expects key-value pairs, with keys signifying the names of the environment variables, and the values would be the fake ones that you'd like to map/swap the originals with.
343343

344-
```js
344+
```ts
345345
envSetupForPlayback: {
346346
TABLES_URL: "https://fakeaccount.table.core.windows.net",
347347
}

sdk/test-utils/recorder/src/utils/relativePathCalculator.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,14 @@ function relativePackagePath(): string {
5858
* Returns the potential `recordings` folder(relative path) for the project using `process.cwd()`.
5959
*
6060
* Note for browser tests:
61-
* 1. Supposed to be called from karma.conf.js in the package for which the testing is being done.
61+
* 1. Supposed to be called from the global config vitest.browser.shared.config.ts.
6262
* 2. Set this `RECORDINGS_RELATIVE_PATH` as an env variable
63-
* ```js
64-
* const { relativeRecordingsPathForBrowser } = require("@azure-tools/test-recorder-new");
65-
* process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPathForBrowser();
66-
* ```
67-
* 3. Add "RECORDINGS_RELATIVE_PATH" in the `envPreprocessor` array to let this be loaded in the browser environment.
68-
* ```
69-
* envPreprocessor: ["RECORDINGS_RELATIVE_PATH"],
63+
* ```ts
64+
* const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
65+
* process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
7066
* ```
7167
*
72-
* `RECORDINGS_RELATIVE_PATH` in the browser environment is used in the recorder to tell the proxy-tool about the location to generate the browser recordings at.
68+
* `RECORDINGS_RELATIVE_PATH` in the browser environment is used in the recorder to tell the test-proxy tool about the location to generate the browser recordings at.
7369
*
7470
* @export
7571
* @returns {string} location of the relative `recordings` folder path - `sdk/storage/storage-blob/recordings/` example

0 commit comments

Comments
 (0)