Skip to content

Commit 25bc423

Browse files
@azure/communication-identity Azure Core 2.0 Migration (Azure#20375)
* Removed the dependency on @azure/core-http * Updated to Azure Communication Common v2 * Migrated to the new test recorder * Re-recorded tests * Excluded headers from comparison * Removed redundant sanitizers * Ensured consistent package name * Removed outdated comments * Added a changelog entry Co-authored-by: Jose Manuel Heredia Hidalgo <joheredi@microsoft.com>
1 parent 1f574ef commit 25bc423

File tree

106 files changed

+3638
-4670
lines changed

Some content is hidden

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

106 files changed

+3638
-4670
lines changed

common/config/rush/pnpm-lock.yaml

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

sdk/communication/communication-identity/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Features Added
66

7+
- Migrated from using `@azure/core-http` to `@azure/core-rest-pipeline` for the handling of HTTP requests. See [Azure Core v1 vs v2](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/documentation/core2.md) for more on the difference and benefits of the move.
8+
79
### Breaking Changes
810

911
### Bugs Fixed

sdk/communication/communication-identity/karma.conf.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
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();
107

118
module.exports = function (config) {
129
config.set({
@@ -28,14 +25,10 @@ module.exports = function (config) {
2825
"karma-coverage",
2926
"karma-sourcemap-loader",
3027
"karma-junit-reporter",
31-
"karma-json-to-file-reporter",
32-
"karma-json-preprocessor",
3328
],
3429

3530
// list of files / patterns to load in the browser
36-
files: ["dist-test/index.browser.js"].concat(
37-
isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []
38-
),
31+
files: ["dist-test/index.browser.js"],
3932

4033
// list of files / patterns to exclude
4134
exclude: [],
@@ -44,7 +37,6 @@ module.exports = function (config) {
4437
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4538
preprocessors: {
4639
"**/*.js": ["sourcemap", "env"],
47-
"recordings/browsers/**/*.json": ["json"],
4840
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
4941
// Preprocess source file to calculate code coverage, however this will make source file unreadable
5042
//"dist-test/index.browser.js": ["coverage"]
@@ -61,12 +53,13 @@ module.exports = function (config) {
6153
"AZURE_CLIENT_ID",
6254
"AZURE_CLIENT_SECRET",
6355
"AZURE_TENANT_ID",
56+
"RECORDINGS_RELATIVE_PATH",
6457
],
6558

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

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

92-
jsonToFileReporter: {
93-
filter: jsonRecordingFilterFunction,
94-
outputPath: ".",
95-
},
96-
9785
// web server port
9886
port: 9876,
9987

@@ -130,9 +118,6 @@ module.exports = function (config) {
130118
browserNoActivityTimeout: 600000,
131119
browserDisconnectTimeout: 10000,
132120
browserDisconnectTolerance: 3,
133-
browserConsoleLogOptions: {
134-
terminal: !isRecordMode(),
135-
},
136121

137122
client: {
138123
mocha: {

sdk/communication/communication-identity/package.json

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"extract-api": "tsc -p . && api-extractor run --local",
2323
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
2424
"generate:client": "autorest --typescript ./swagger/README.md && rushx format",
25-
"integration-test:browser": "karma start --single-run",
26-
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace -t 300000 dist-esm/test/public/*.spec.js dist-esm/test/public/node/*.spec.js",
25+
"integration-test:browser": "dev-tool run test:browser",
26+
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 --exclude 'dist-esm/test/**/browser/*.spec.js' 'dist-esm/test/**/*.spec.js'",
2727
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
2828
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
2929
"lint": "eslint package.json api-extractor.json src test --ext .ts",
@@ -32,10 +32,26 @@
3232
"test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
3333
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
3434
"test:watch": "npm run test -- --watch --reporter min",
35-
"unit-test:browser": "karma start --single-run",
36-
"unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"",
35+
"unit-test:browser": "dev-tool run test:browser",
36+
"unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
3737
"unit-test": "npm run unit-test:node && npm run unit-test:browser"
3838
},
39+
"//metadata": {
40+
"constantPaths": [
41+
{
42+
"path": "src/generated/identityRestClientContext.ts",
43+
"prefix": "packageDetails"
44+
},
45+
{
46+
"path": "src/constants.ts",
47+
"prefix": "SDK_VERSION"
48+
},
49+
{
50+
"path": "swagger/README.md",
51+
"prefix": "package-version"
52+
}
53+
]
54+
},
3955
"//sampleConfiguration": {
4056
"productName": "Azure Communication Services - Identity",
4157
"productSlugs": [
@@ -72,9 +88,10 @@
7288
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
7389
"dependencies": {
7490
"@azure/abort-controller": "^1.0.0",
75-
"@azure/communication-common": "^1.1.0",
91+
"@azure/communication-common": "^2.0.0",
7692
"@azure/core-auth": "^1.3.0",
77-
"@azure/core-http": "^2.0.0",
93+
"@azure/core-client": "^1.3.0",
94+
"@azure/core-rest-pipeline": "^1.3.0",
7895
"@azure/core-lro": "^2.2.0",
7996
"@azure/core-paging": "^1.1.1",
8097
"@azure/core-tracing": "1.0.0-preview.13",
@@ -83,11 +100,13 @@
83100
"tslib": "^2.2.0"
84101
},
85102
"devDependencies": {
103+
"@azure/core-util": "^1.0.0-beta.1",
86104
"@azure/dev-tool": "^1.0.0",
87105
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
88106
"@azure/test-utils": "^1.0.0",
89-
"@azure-tools/test-recorder": "^1.0.0",
107+
"@azure-tools/test-recorder": "^2.0.0",
90108
"@azure/identity": "^2.0.1",
109+
"@azure-tools/test-credential": "^1.0.0",
91110
"@microsoft/api-extractor": "^7.18.11",
92111
"@types/chai": "^4.1.6",
93112
"@types/mocha": "^7.0.2",
@@ -104,8 +123,6 @@
104123
"karma-env-preprocessor": "^0.1.1",
105124
"karma-firefox-launcher": "^1.1.0",
106125
"karma-ie-launcher": "^1.0.0",
107-
"karma-json-preprocessor": "^0.3.3",
108-
"karma-json-to-file-reporter": "^1.0.1",
109126
"karma-junit-reporter": "^2.0.1",
110127
"karma-mocha-reporter": "^2.2.5",
111128
"karma-mocha": "^2.0.1",

sdk/communication/communication-identity/recordings/browsers/communicationidentityclient_playbacklive/recording_successfully_creates_a_user.json

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

sdk/communication/communication-identity/recordings/browsers/communicationidentityclient_playbacklive/recording_successfully_creates_a_user_and_gets_a_token_in_a_single_request.json

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

0 commit comments

Comments
 (0)