|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import { |
10 | | - env, |
11 | | - record, |
12 | | - RecorderEnvironmentSetup, |
13 | | - Recorder |
| 10 | + Recorder, |
| 11 | + RecorderStartOptions, |
| 12 | + env |
14 | 13 | } from "@azure-tools/test-recorder"; |
15 | | -import * as assert from "assert"; |
| 14 | +import { assert } from "chai"; |
| 15 | +import { Context } from "mocha"; |
16 | 16 |
|
17 | | -const recorderEnvSetup: RecorderEnvironmentSetup = { |
18 | | - replaceableVariables: { |
19 | | - AZURE_CLIENT_ID: "azure_client_id", |
20 | | - AZURE_CLIENT_SECRET: "azure_client_secret", |
21 | | - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", |
22 | | - SUBSCRIPTION_ID: "azure_subscription_id" |
23 | | - }, |
24 | | - customizationsOnRecordings: [ |
25 | | - (recording: any): any => |
26 | | - recording.replace( |
27 | | - /"access_token":"[^"]*"/g, |
28 | | - `"access_token":"access_token"` |
29 | | - ) |
30 | | - ], |
31 | | - queryParametersToSkip: [] |
| 17 | +const replaceableVariables: Record<string, string> = { |
| 18 | + AZURE_CLIENT_ID: "azure_client_id", |
| 19 | + AZURE_CLIENT_SECRET: "azure_client_secret", |
| 20 | + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", |
| 21 | + SUBSCRIPTION_ID: "azure_subscription_id" |
| 22 | +}; |
| 23 | + |
| 24 | +const recorderOptions: RecorderStartOptions = { |
| 25 | + envSetupForPlayback: replaceableVariables |
32 | 26 | }; |
33 | 27 |
|
34 | 28 | describe("My test", () => { |
35 | 29 | let recorder: Recorder; |
36 | 30 |
|
37 | | - beforeEach(async function() { |
38 | | - recorder = record(this, recorderEnvSetup); |
| 31 | + beforeEach(async function(this: Context) { |
| 32 | + recorder = new Recorder(this.currentTest); |
| 33 | + await recorder.start(recorderOptions); |
39 | 34 | }); |
40 | 35 |
|
41 | 36 | afterEach(async function() { |
|
0 commit comments