Skip to content

Commit

Permalink
Revert "[Search Documents] Migrating search-documents to the new reco…
Browse files Browse the repository at this point in the history
…rder (#20125)"

This reverts commit e7c20ea.
  • Loading branch information
sarangan12 committed Jan 31, 2022
1 parent 2546953 commit 9a77997
Show file tree
Hide file tree
Showing 69 changed files with 1,920 additions and 33,170 deletions.
3 changes: 1 addition & 2 deletions sdk/search/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ pr:
extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: search
TestProxy: true
ServiceDirectory: search
Artifacts:
- name: azure-search-documents
safeName: azuresearchdocuments
Expand Down
34 changes: 21 additions & 13 deletions sdk/search/search-documents/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config();
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode,
} = require("@azure-tools/test-recorder");
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
Expand All @@ -25,13 +27,15 @@ module.exports = function (config) {
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-json-preprocessor",
],

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

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

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

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

jsonToFileReporter: {
filter: jsonRecordingFilterFunction,
outputPath: ".",
},

// web server port
port: 9876,

Expand Down Expand Up @@ -112,6 +116,10 @@ module.exports = function (config) {
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,

browserConsoleLogOptions: {
terminal: !isRecordMode(),
},

client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
Expand Down
10 changes: 5 additions & 5 deletions sdk/search/search-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"clean": "rimraf dist dist-* temp types *.tgz *.log",
"extract-api": "tsc -p . && api-extractor run --local",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "dev-tool run test:browser",
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
"integration-test:browser": "karma start --single-run",
"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",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
"pack": "npm pack 2>&1",
"test:browser": "npm run build:test && npm run unit-test:browser",
"test:node": "npm run build:test && npm run unit-test:node",
"test": "npm run build:test && npm run unit-test",
"unit-test:browser": "dev-tool run test:browser",
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 \"test/**/*.spec.ts\" \"test/**/**/*.spec.ts\"",
"unit-test:browser": "karma start --single-run",
"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\"",
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
},
"files": [
Expand Down Expand Up @@ -87,7 +87,7 @@
"@azure/test-utils": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@azure-tools/test-recorder": "^1.0.0",
"@microsoft/api-extractor": "^7.18.11",
"@types/chai": "^4.1.6",
"@types/mocha": "^7.0.2",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9a77997

Please sign in to comment.