Skip to content

Commit 5de8993

Browse files
authored
Revert "[Search Documents] Migrating search-documents to the new recorder" (Azure#20149)
* Revert "[Search Documents] Migrating search-documents to the new recorder (Azure#20125)" This reverts commit e7c20ea. * Rush update
1 parent 36d8b11 commit 5de8993

File tree

70 files changed

+1952
-33200
lines changed

Some content is hidden

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

70 files changed

+1952
-33200
lines changed

common/config/rush/pnpm-lock.yaml

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

sdk/search/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ pr:
2323
extends:
2424
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
2525
parameters:
26-
ServiceDirectory: search
27-
TestProxy: true
26+
ServiceDirectory: search
2827
Artifacts:
2928
- name: azure-search-documents
3029
safeName: azuresearchdocuments

sdk/search/search-documents/karma.conf.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// https://github.com/karma-runner/karma-chrome-launcher
22
process.env.CHROME_BIN = require("puppeteer").executablePath();
33
require("dotenv").config();
4-
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
5-
6-
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
7-
4+
const {
5+
jsonRecordingFilterFunction,
6+
isPlaybackMode,
7+
isSoftRecordMode,
8+
isRecordMode,
9+
} = require("@azure-tools/test-recorder");
810
module.exports = function (config) {
911
config.set({
1012
// base path that will be used to resolve all patterns (eg. files, exclude)
@@ -25,13 +27,15 @@ module.exports = function (config) {
2527
"karma-coverage",
2628
"karma-sourcemap-loader",
2729
"karma-junit-reporter",
30+
"karma-json-to-file-reporter",
31+
"karma-json-preprocessor",
2832
],
2933

3034
// list of files / patterns to load in the browser
3135
files: [
3236
"dist-test/index.browser.js",
3337
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
34-
],
38+
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),
3539

3640
// list of files / patterns to exclude
3741
exclude: [],
@@ -40,6 +44,7 @@ module.exports = function (config) {
4044
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4145
preprocessors: {
4246
"**/*.js": ["sourcemap", "env"],
47+
"recordings/browsers/**/*.json": ["json"],
4348
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
4449
// Preprocess source file to calculate code coverage, however this will make source file unreadable
4550
"dist-test/index.js": ["coverage"],
@@ -48,18 +53,12 @@ module.exports = function (config) {
4853
// inject following environment values into browser testing with window.__env__
4954
// environment values MUST be exported or set with same console running "karma start"
5055
// https://www.npmjs.com/package/karma-env-preprocessor
51-
envPreprocessor: [
52-
"TEST_MODE",
53-
"ENDPOINT",
54-
"SEARCH_API_ADMIN_KEY",
55-
"SEARCH_API_ADMIN_KEY_ALT",
56-
"RECORDINGS_RELATIVE_PATH",
57-
],
56+
envPreprocessor: ["TEST_MODE", "ENDPOINT", "SEARCH_API_ADMIN_KEY", "SEARCH_API_ADMIN_KEY_ALT"],
5857

5958
// test results reporter to use
6059
// possible values: 'dots', 'progress'
6160
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
62-
reporters: ["mocha", "coverage", "junit"],
61+
reporters: ["mocha", "coverage", "junit", "json-to-file"],
6362

6463
coverageReporter: {
6564
// specify a common output directory
@@ -82,6 +81,11 @@ module.exports = function (config) {
8281
properties: {}, // key value pair of properties to add to the <properties> section of the report
8382
},
8483

84+
jsonToFileReporter: {
85+
filter: jsonRecordingFilterFunction,
86+
outputPath: ".",
87+
},
88+
8589
// web server port
8690
port: 9876,
8791

@@ -112,6 +116,10 @@ module.exports = function (config) {
112116
browserDisconnectTimeout: 10000,
113117
browserDisconnectTolerance: 3,
114118

119+
browserConsoleLogOptions: {
120+
terminal: !isRecordMode(),
121+
},
122+
115123
client: {
116124
mocha: {
117125
// change Karma's debug.html to the mocha web reporter

sdk/search/search-documents/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"clean": "rimraf dist dist-* temp types *.tgz *.log",
1919
"extract-api": "tsc -p . && api-extractor run --local",
2020
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
21-
"integration-test:browser": "dev-tool run test:browser",
22-
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
21+
"integration-test:browser": "karma start --single-run",
22+
"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/**/*.spec.js --harmony",
2323
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
2424
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
2525
"lint": "eslint package.json api-extractor.json src test --ext .ts",
2626
"pack": "npm pack 2>&1",
2727
"test:browser": "npm run build:test && npm run unit-test:browser",
2828
"test:node": "npm run build:test && npm run unit-test:node",
2929
"test": "npm run build:test && npm run unit-test",
30-
"unit-test:browser": "dev-tool run test:browser",
31-
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 \"test/**/*.spec.ts\" \"test/**/**/*.spec.ts\"",
30+
"unit-test:browser": "karma start --single-run",
31+
"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\"",
3232
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
3333
},
3434
"files": [
@@ -87,7 +87,7 @@
8787
"@azure/test-utils": "^1.0.0",
8888
"@azure/dev-tool": "^1.0.0",
8989
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
90-
"@azure-tools/test-recorder": "^2.0.0",
90+
"@azure-tools/test-recorder": "^1.0.0",
9191
"@microsoft/api-extractor": "^7.18.11",
9292
"@types/chai": "^4.1.6",
9393
"@types/mocha": "^7.0.2",

0 commit comments

Comments
 (0)