Skip to content

Commit 1ca1fa8

Browse files
[Search Documents] Migrating search-documents to the new recorder (Azure#20193)
* Revert "Revert "[Search Documents] Migrating search-documents to the new recorder" (Azure#20149)" This reverts commit 5de8993. * to avoid min-max issues - retaining how the setup was imported * recordings * fix test * formatting
1 parent e3a8828 commit 1ca1fa8

File tree

69 files changed

+33087
-1920
lines changed

Some content is hidden

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

69 files changed

+33087
-1920
lines changed

sdk/search/ci.yml

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

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

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

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

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

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

6364
coverageReporter: {
6465
// specify a common output directory
@@ -81,11 +82,6 @@ module.exports = function (config) {
8182
properties: {}, // key value pair of properties to add to the <properties> section of the report
8283
},
8384

84-
jsonToFileReporter: {
85-
filter: jsonRecordingFilterFunction,
86-
outputPath: ".",
87-
},
88-
8985
// web server port
9086
port: 9876,
9187

@@ -116,10 +112,6 @@ module.exports = function (config) {
116112
browserDisconnectTimeout: 10000,
117113
browserDisconnectTolerance: 3,
118114

119-
browserConsoleLogOptions: {
120-
terminal: !isRecordMode(),
121-
},
122-
123115
client: {
124116
mocha: {
125117
// 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": "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",
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'",
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": "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\"",
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\"",
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": "^1.0.0",
90+
"@azure-tools/test-recorder": "^2.0.0",
9191
"@microsoft/api-extractor": "^7.18.11",
9292
"@types/chai": "^4.1.6",
9393
"@types/mocha": "^7.0.2",

sdk/search/search-documents/recordings/node/searchclient_tests/recording_autocomplete_returns_the_correct_autocomplete_result.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)