Skip to content

Commit faffd66

Browse files
authored
[Container Registry] Migrate to new recorder (Azure#20301)
### Packages impacted by this PR - `@azure/container-registry` ### Issues associated with this PR - Azure#19859 ### Describe the problem that is addressed by this PR Migrates ACR tests to the new recorder.
1 parent 9da8800 commit faffd66

File tree

67 files changed

+10840
-8355
lines changed

Some content is hidden

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

67 files changed

+10840
-8355
lines changed

sdk/containerregistry/container-registry/karma.conf.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33

44
// https://github.com/karma-runner/karma-chrome-launcher
55
process.env.CHROME_BIN = require("puppeteer").executablePath();
6+
process.env.RECORDINGS_RELATIVE_PATH =
7+
require("@azure-tools/test-recorder").relativeRecordingsPath();
68
require("dotenv").config();
7-
const {
8-
jsonRecordingFilterFunction,
9-
isPlaybackMode,
10-
isSoftRecordMode,
11-
isRecordMode,
12-
} = require("@azure-tools/test-recorder");
139

1410
module.exports = function (config) {
1511
config.set({
@@ -31,15 +27,13 @@ module.exports = function (config) {
3127
"karma-coverage",
3228
"karma-sourcemap-loader",
3329
"karma-junit-reporter",
34-
"karma-json-to-file-reporter",
35-
"karma-json-preprocessor",
3630
],
3731

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

4438
// list of files / patterns to exclude
4539
exclude: [],
@@ -48,7 +42,6 @@ module.exports = function (config) {
4842
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4943
preprocessors: {
5044
"**/*.js": ["sourcemap", "env"],
51-
"recordings/browsers/**/*.json": ["json"],
5245
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
5346
// Preprocess source file to calculate code coverage, however this will make source file unreadable
5447
//"dist-test/index.browser.js": ["coverage"]
@@ -61,12 +54,13 @@ module.exports = function (config) {
6154
"CONTAINERREGISTRY_CLIENT_ID",
6255
"CONTAINERREGISTRY_CLIENT_SECRET",
6356
"CONTAINERREGISTRY_TENANT_ID",
57+
"RECORDINGS_RELATIVE_PATH",
6458
],
6559

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

7165
coverageReporter: {
7266
// specify a common output directory
@@ -84,11 +78,6 @@ module.exports = function (config) {
8478
properties: {}, // key value pair of properties to add to the <properties> section of the report
8579
},
8680

87-
jsonToFileReporter: {
88-
filter: jsonRecordingFilterFunction,
89-
outputPath: ".",
90-
},
91-
9281
// web server port
9382
port: 9876,
9483

@@ -123,9 +112,6 @@ module.exports = function (config) {
123112
browserNoActivityTimeout: 600000,
124113
browserDisconnectTimeout: 10000,
125114
browserDisconnectTolerance: 3,
126-
browserConsoleLogOptions: {
127-
terminal: !isRecordMode(),
128-
},
129115

130116
client: {
131117
mocha: {

sdk/containerregistry/container-registry/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
"extract-api": "tsc -p . && api-extractor run --local",
3737
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
3838
"generate:client": "autorest --typescript ./swagger/README.md",
39-
"integration-test:browser": "karma start --single-run",
40-
"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/test/{,!(browser)/**/}/*.spec.js\"",
39+
"integration-test:browser": "dev-tool run test:browser",
40+
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 --full-trace \"dist-esm/test/**/*.spec.js\"",
4141
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
4242
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
4343
"lint": "eslint package.json api-extractor.json src test --ext .ts",
4444
"pack": "npm pack 2>&1",
4545
"test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
4646
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
4747
"test": "npm run build:test && npm run unit-test && npm run integration-test",
48-
"unit-test:browser": "karma start --single-run",
49-
"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\"",
48+
"unit-test:browser": "dev-tool run test:browser",
49+
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --full-trace \"test/**/*.spec.ts\"",
5050
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
5151
},
5252
"files": [
@@ -87,7 +87,8 @@
8787
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
8888
"@azure/identity": "^2.0.1",
8989
"@azure/test-utils": "^1.0.0",
90-
"@azure-tools/test-recorder": "^1.0.0",
90+
"@azure-tools/test-credential": "^1.0.0",
91+
"@azure-tools/test-recorder": "^2.0.0",
9192
"@microsoft/api-extractor": "^7.18.11",
9293
"@types/chai": "^4.1.6",
9394
"@types/chai-as-promised": "^7.1.0",
@@ -106,8 +107,6 @@
106107
"karma-env-preprocessor": "^0.1.1",
107108
"karma-firefox-launcher": "^1.1.0",
108109
"karma-ie-launcher": "^1.0.0",
109-
"karma-json-preprocessor": "^0.3.3",
110-
"karma-json-to-file-reporter": "^1.0.1",
111110
"karma-junit-reporter": "^2.0.1",
112111
"karma-mocha": "^2.0.1",
113112
"karma-mocha-reporter": "^2.2.5",

sdk/containerregistry/container-registry/recordings/browsers/anonymous_access_tests/recording_should_list_repositories_with_anonymous_access.json

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

0 commit comments

Comments
 (0)