Skip to content

Commit 2fd836f

Browse files
authored
[Text Analytics] Migrate to new recorder (Azure#20455)
### Packages impacted by this PR - `@azure/ai-text-analytics` ### Issues associated with this PR - Azure#19859 ### Describe the problem that is addressed by this PR Migrates Text Analytics to new recorder.
1 parent baa898e commit 2fd836f

File tree

742 files changed

+133022
-50739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+133022
-50739
lines changed

sdk/textanalytics/ai-text-analytics/karma.conf.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
// https://github.com/karma-runner/karma-chrome-launcher
55
process.env.CHROME_BIN = require("puppeteer").executablePath();
66
require("dotenv").config();
7-
const {
8-
jsonRecordingFilterFunction,
9-
isPlaybackMode,
10-
isSoftRecordMode,
11-
isRecordMode,
12-
} = require("@azure-tools/test-recorder");
7+
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
8+
9+
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
1310

1411
module.exports = function (config) {
1512
config.set({
@@ -31,16 +28,14 @@ module.exports = function (config) {
3128
"karma-coverage",
3229
"karma-sourcemap-loader",
3330
"karma-junit-reporter",
34-
"karma-json-to-file-reporter",
3531
"karma-source-map-support",
36-
"karma-json-preprocessor",
3732
],
3833

3934
// list of files / patterns to load in the browser
4035
files: [
4136
"dist-test/index.browser.js",
4237
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
43-
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),
38+
],
4439

4540
// list of files / patterns to exclude
4641
exclude: [],
@@ -49,7 +44,6 @@ module.exports = function (config) {
4944
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
5045
preprocessors: {
5146
"**/*.js": ["sourcemap", "env"],
52-
"recordings/browsers/**/*.json": ["json"],
5347
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
5448
// Preprocess source file to calculate code coverage, however this will make source file unreadable
5549
// "dist-test/index.js": ["coverage"]
@@ -69,12 +63,13 @@ module.exports = function (config) {
6963
"TEXT_ANALYTICS_SINGLE_CATEGORY_CLASSIFY_DEPLOYMENT_NAME",
7064
"TEXT_ANALYTICS_MULTI_CATEGORY_CLASSIFY_PROJECT_NAME",
7165
"TEXT_ANALYTICS_MULTI_CATEGORY_CLASSIFY_DEPLOYMENT_NAME",
66+
"RECORDINGS_RELATIVE_PATH",
7267
],
7368

7469
// test results reporter to use
7570
// possible values: 'dots', 'progress'
7671
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
77-
reporters: ["mocha", "coverage", "junit", "json-to-file"],
72+
reporters: ["mocha", "coverage", "junit"],
7873

7974
coverageReporter: {
8075
// specify a common output directory
@@ -97,11 +92,6 @@ module.exports = function (config) {
9792
properties: {}, // key value pair of properties to add to the <properties> section of the report
9893
},
9994

100-
jsonToFileReporter: {
101-
filter: jsonRecordingFilterFunction,
102-
outputPath: ".",
103-
},
104-
10595
// web server port
10696
port: 9876,
10797

@@ -136,9 +126,6 @@ module.exports = function (config) {
136126
browserNoActivityTimeout: 60000000,
137127
browserDisconnectTimeout: 10000,
138128
browserDisconnectTolerance: 3,
139-
browserConsoleLogOptions: {
140-
terminal: !isRecordMode(),
141-
},
142129

143130
client: {
144131
mocha: {

sdk/textanalytics/ai-text-analytics/package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
"Azure Cognitive Services instance": "https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account"
5555
}
5656
},
57-
"browser": {
58-
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
59-
},
6057
"scripts": {
6158
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
6259
"build:browser": "tsc -p . && dev-tool run bundle",
@@ -70,17 +67,17 @@
7067
"execute:samples": "dev-tool samples run samples-dev",
7168
"extract-api": "tsc -p . && api-extractor run --local",
7269
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
73-
"integration-test:browser": "karma start --single-run",
74-
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"",
70+
"integration-test:browser": "dev-tool run test:browser",
71+
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
7572
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
7673
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
7774
"lint": "eslint package.json api-extractor.json src test --ext .ts",
7875
"pack": "npm pack 2>&1",
7976
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
8077
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
8178
"test": "npm run clean && npm run build:test && npm run unit-test",
82-
"unit-test:browser": "karma start --single-run",
83-
"unit-test:node": "mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}*.spec.ts\"",
79+
"unit-test:browser": "dev-tool run test:browser",
80+
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 \"test/**/*.spec.ts\"",
8481
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
8582
},
8683
"sideEffects": false,
@@ -100,7 +97,8 @@
10097
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
10198
"@azure/identity": "^2.0.1",
10299
"@azure/test-utils": "^1.0.0",
103-
"@azure-tools/test-recorder": "^1.0.0",
100+
"@azure-tools/test-recorder": "^2.0.0",
101+
"@azure-tools/test-credential": "^1.0.0",
104102
"@microsoft/api-extractor": "^7.18.11",
105103
"@types/chai": "^4.1.6",
106104
"@types/chai-as-promised": "^7.1.0",
@@ -119,8 +117,6 @@
119117
"karma-env-preprocessor": "^0.1.1",
120118
"karma-firefox-launcher": "^1.1.0",
121119
"karma-ie-launcher": "^1.0.0",
122-
"karma-json-preprocessor": "^0.3.3",
123-
"karma-json-to-file-reporter": "^1.0.1",
124120
"karma-junit-reporter": "^2.0.1",
125121
"karma-mocha": "^2.0.1",
126122
"karma-mocha-reporter": "^2.2.5",

sdk/textanalytics/ai-text-analytics/recordings/browsers/aad_textanalyticsclient_fast_tests_analyzesentiment/recording_client_accepts_string_and_language.json

Lines changed: 172 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)