Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Artifacts] Update Synapse Artifacts to new recorder #20124

Merged
merged 4 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/synapse/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pr:
extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
TestProxy: true
ServiceDirectory: synapse
Artifacts:
- name: azure-synapse-access-control
Expand Down
50 changes: 19 additions & 31 deletions sdk/synapse/synapse-artifacts/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
// https://github.com/karma-runner/karma-chrome-launcher
process.env.CHROME_BIN = require("puppeteer").executablePath();
joheredi marked this conversation as resolved.
Show resolved Hide resolved
require("dotenv").config();
const {
jsonRecordingFilterFunction,
isPlaybackMode,
isSoftRecordMode,
isRecordMode
} = require("@azure-tools/test-recorder");

module.exports = function(config) {
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");

process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();

module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
Expand All @@ -33,14 +30,14 @@ module.exports = function(config) {
"karma-junit-reporter",
"karma-json-to-file-reporter",
"karma-source-map-support",
"karma-json-preprocessor"
"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"] : []),
{ pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
],

// list of files / patterns to exclude
exclude: [],
Expand All @@ -49,7 +46,6 @@ 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 @@ -60,13 +56,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 @@ -75,8 +72,8 @@ module.exports = function(config) {
{ type: "json", subdir: ".", file: "coverage.json" },
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
{ type: "html", subdir: "html" },
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
]
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
],
},

junitReporter: {
Expand All @@ -86,14 +83,8 @@ module.exports = function(config) {
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},

jsonToFileReporter: {
filter: jsonRecordingFilterFunction,
outputPath: "."
properties: {}, // key value pair of properties to add to the <properties> section of the report
},

// web server port
port: 9876,

Expand All @@ -113,8 +104,8 @@ module.exports = function(config) {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox", "--disable-web-security"]
}
flags: ["--no-sandbox", "--disable-web-security"],
},
},

// Continuous Integration mode
Expand All @@ -128,16 +119,13 @@ module.exports = function(config) {
browserNoActivityTimeout: 60000000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserConsoleLogOptions: {
terminal: !isRecordMode()
},

client: {
mocha: {
// change Karma's debug.html to the mocha web reporter
reporter: "html",
timeout: 0
}
}
timeout: 0,
},
},
});
};
9 changes: 5 additions & 4 deletions sdk/synapse/synapse-artifacts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^1.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@microsoft/api-extractor": "^7.18.11",
"@types/chai": "^4.1.6",
"@types/mocha": "^7.0.2",
Expand Down Expand Up @@ -73,7 +73,8 @@
"sinon": "^9.0.2",
"source-map-support": "^0.5.9",
"ts-node": "^10.0.0",
"typescript": "~4.2.0"
"typescript": "~4.2.0",
"@azure-tools/test-credential": "^1.0.0"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
Expand All @@ -100,8 +101,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.

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

Loading