Skip to content

Commit

Permalink
[synapse-managed-private-endpoints] Migration to new recorder (#24475)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhanh-phan authored Jan 13, 2023
1 parent 4995b85 commit df98484
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 256 deletions.
30 changes: 8 additions & 22 deletions sdk/synapse/synapse-managed-private-endpoints/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
require("dotenv").config();
const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode
} = require("@azure-tools/test-recorder");
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

module.exports = function(config) {
config.set({
Expand All @@ -31,25 +27,22 @@ module.exports = function(config) {
"karma-coverage",
"karma-sourcemap-loader",
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-source-map-support",
"karma-json-preprocessor"
"karma-source-map-support"
],

// 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: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"**/*.js": ["sourcemap", "env"],
"recordings/browsers/**/*.json": ["json"]
"**/*.js": ["sourcemap", "env"]
// 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 @@ -60,13 +53,14 @@ module.exports = function(config) {
"ENDPOINT",
"AZURE_CLIENT_ID",
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID"
"AZURE_TENANT_ID",
"RECORDINGS_RELATIVE_PATH",
],

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

coverageReporter: {
// specify a common output directory
Expand All @@ -89,11 +83,6 @@ 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 @@ -128,9 +117,6 @@ module.exports = function(config) {
browserNoActivityTimeout: 60000000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserConsoleLogOptions: {
terminal: !isRecordMode()
},

client: {
mocha: {
Expand Down
10 changes: 4 additions & 6 deletions sdk/synapse/synapse-managed-private-endpoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"module": "./dist-esm/src/index.js",
"types": "./types/synapse-managed-private-endpoints.d.ts",
"devDependencies": {
"@azure-tools/test-recorder": "^1.0.0",
"@azure-tools/test-credential": "^1.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@azure/test-utils": "^1.0.0",
"@azure/identity": "^2.0.1",
"typescript": "~4.8.0",
"eslint": "^8.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
Expand Down Expand Up @@ -77,8 +77,6 @@
"chai-as-promised": "^7.1.1",
"cross-env": "^7.0.2",
"karma-edge-launcher": "^0.4.2",
"karma-json-preprocessor": "^0.3.3",
"karma-json-to-file-reporter": "^1.0.1",
"karma-source-map-support": "~1.4.0"
},
"bugs": {
Expand Down Expand Up @@ -108,8 +106,8 @@
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
"test": "npm run clean && npm run build:test && npm run unit-test",
"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:browser": "dev-tool run test:browser",
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"extract-api": "api-extractor run --local",
"clean": "rimraf dist dist-* temp types *.tgz *.log",
Expand Down

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

Loading

0 comments on commit df98484

Please sign in to comment.