Skip to content

Commit

Permalink
Feature/sms core v2 and test recoder migration (#21328)
Browse files Browse the repository at this point in the history
* sms core v2 migration changes

* fixed build issue

* unit test fixes

* record test mode fix

* recording updated

* migrated to new test recorder version

* Make the tests pass (#2)

format and test fixes

* recording update & code owner update

* analyzer fix

* update code owner for sms

Co-authored-by: Petr Švihlík <[email protected]>
  • Loading branch information
arifibrahim4 and petrsvihlik authored Apr 26, 2022
1 parent 25bc12c commit 1428390
Show file tree
Hide file tree
Showing 111 changed files with 3,774 additions and 2,442 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
/sdk/communication/communication-network-traversal/ @AriZavala2

# PRLabel: %Communication - SMS
/sdk/communication/communication-sms/ @arifibrahim4 @RoyHerrod
/sdk/communication/communication-sms/ @DimaKolomiiets

# PRLabel: %Communication - Short Codes
/sdk/communication/communication-short-codes/ @danielav7 @AlonsoMondal
/sdk/communication/communication-short-codes/ @danielav7

# PRLabel: %Communication - Common
/sdk/communication/communication-common/ @petrsvihlik @AikoBB @maximrytych-ms @martinbarnas-ms
Expand Down
6 changes: 4 additions & 2 deletions common/config/rush/pnpm-lock.yaml

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

4 changes: 3 additions & 1 deletion sdk/communication/communication-sms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.2.0-beta.1 (Unreleased)

### Features Added

- 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.

### Breaking Changes

### Bugs Fixed
Expand Down
27 changes: 6 additions & 21 deletions sdk/communication/communication-sms/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// 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 @@ -28,14 +25,10 @@ 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"].concat(
isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []
),
files: ["dist-test/index.browser.js"],

// list of files / patterns to exclude
exclude: [],
Expand All @@ -44,7 +37,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.browser.js": ["coverage"]
Expand All @@ -61,12 +53,13 @@ module.exports = function (config) {
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID",
"COMMUNICATION_SKIP_INT_SMS_TEST",
"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 +82,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 @@ -130,9 +118,6 @@ module.exports = function (config) {
browserNoActivityTimeout: 600000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserConsoleLogOptions: {
terminal: !isRecordMode(),
},

client: {
mocha: {
Expand Down
27 changes: 16 additions & 11 deletions sdk/communication/communication-sms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/communication-sms",
"version": "1.1.0-beta.1",
"version": "1.2.0-beta.1",
"description": "SDK for Azure Communication SMS service which facilitates the sending of SMS messages.",
"sdk-type": "client",
"main": "dist/index.js",
Expand All @@ -23,17 +23,17 @@
"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}\"",
"generate:client": "autorest --typescript ./swagger/README.md && rushx format",
"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 --full-trace -t 300000 \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/node/*.spec.js\" \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/internal/node/*.spec.js\"",
"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": "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 && npm run integration-test:browser",
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
"test": "npm run build:test && npm run unit-test && npm run integration-test",
"unit-test:browser": "karma start --single-run",
"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\"",
"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"
},
"files": [
Expand Down Expand Up @@ -64,21 +64,25 @@
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/communication-common": "^1.1.0",
"@azure/communication-common": "^2.0.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-http": "^2.0.0",
"@azure/core-client": "^1.3.2",
"@azure/core-rest-pipeline": "^1.3.2",
"@azure/core-tracing": "1.0.0-preview.13",
"@azure/logger": "^1.0.0",
"events": "^3.0.0",
"tslib": "^2.2.0"
"tslib": "^2.2.0",
"uuid": "^8.3.0"
},
"devDependencies": {
"@azure/core-util": "^1.0.0-beta.1",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure/test-utils": "^1.0.0",
"@azure-tools/test-recorder": "^1.0.0",
"@microsoft/api-extractor": "7.18.11",
"@azure-tools/test-credential": "^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",
"@types/node": "^12.0.0",
Expand All @@ -105,14 +109,15 @@
"prettier": "^2.5.1",
"rimraf": "^3.0.0",
"sinon": "^9.0.2",
"@types/uuid": "^8.0.0",
"typescript": "~4.2.0",
"util": "^0.12.1"
},
"//metadata": {
"constantPaths": [
{
"path": "src/generated/src/smsApiClientContext.ts",
"prefix": "packageVersion"
"prefix": "packageDetails"
},
{
"path": "src/constants.ts",
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

0 comments on commit 1428390

Please sign in to comment.