Skip to content

Commit 3c97db3

Browse files
authored
[rollup] - Fix bug in circular dependency warning suppression (Azure#19012)
## What - Fix incorrect logic when suppressing chai's circular dependency warnings - Move to the common dev-tool configuration where possible ## Why This is a longstanding issue that we have, where an incorrect logic was copy-pasted to other places. I figured while cleaning this up that any package I touch can just convert over to the shared dev-tool configuration. Where I was unable to do that, I just fixed this bug to avoid too many changes in one PR. Fixes Azure#14292 Resolves Azure#17818 Resolves Azure#17816 Resolves Azure#17815 Resolves Azure#17814 Resolves Azure#17813 Resolves Azure#17810
1 parent d810a31 commit 3c97db3

File tree

53 files changed

+66
-1888
lines changed

Some content is hidden

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

53 files changed

+66
-1888
lines changed

common/config/rush/pnpm-lock.yaml

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

common/tools/dev-tool/src/config/rollup.base.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function makeBrowserTestConfig(): RollupOptions {
125125
// Chai's strange internal architecture makes it impossible to statically
126126
// analyze its exports.
127127
chai: ["version", "use", "util", "config", "expect", "should", "assert"],
128-
...openTelemetryCommonJs()
128+
events: ["EventEmitter"]
129129
}
130130
}),
131131
json(),

sdk/anomalydetector/ai-anomaly-detector/package.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
1515
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
1616
"build:samples": "echo Obsolete.",
17-
"build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1",
17+
"build:test": "tsc -p . && rollup -c 2>&1",
1818
"build": "npm run clean && tsc -p . && rollup -c 2>&1 && api-extractor run --local",
1919
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
2020
"clean": "rimraf dist dist-* temp types *.tgz *.log",
2121
"execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/",
2222
"extract-api": "tsc -p . && api-extractor run --local",
2323
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
2424
"integration-test:browser": "karma start --single-run",
25-
"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/**/*.spec.js",
25+
"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\"",
2626
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
2727
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
2828
"lint": "eslint package.json api-extractor.json src test --ext .ts",
@@ -31,7 +31,7 @@
3131
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
3232
"test": "npm run build:test && npm run unit-test && npm run integration-test",
3333
"unit-test:browser": "karma start --single-run",
34-
"unit-test:node": "mocha --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace dist-test/index.node.js",
34+
"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\"",
3535
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
3636
"docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src"
3737
},
@@ -73,11 +73,6 @@
7373
"@azure/identity": "^2.0.1",
7474
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
7575
"@microsoft/api-extractor": "^7.18.11",
76-
"@rollup/plugin-commonjs": "11.0.2",
77-
"@rollup/plugin-json": "^4.0.0",
78-
"@rollup/plugin-multi-entry": "^3.0.0",
79-
"@rollup/plugin-node-resolve": "^8.0.0",
80-
"@rollup/plugin-replace": "^2.2.0",
8176
"@types/chai": "^4.1.6",
8277
"@types/mocha": "^7.0.2",
8378
"@types/node": "^12.0.0",
@@ -104,10 +99,6 @@
10499
"prettier": "^1.16.4",
105100
"rimraf": "^3.0.0",
106101
"rollup": "^1.16.3",
107-
"rollup-plugin-shim": "^1.0.0",
108-
"rollup-plugin-sourcemaps": "^0.4.2",
109-
"rollup-plugin-terser": "^5.1.1",
110-
"rollup-plugin-visualizer": "^4.0.4",
111102
"typescript": "~4.2.0",
112103
"util": "^0.12.1",
113104
"@azure-tools/test-recorder": "^1.0.0",

sdk/anomalydetector/ai-anomaly-detector/rollup.base.config.js

Lines changed: 0 additions & 137 deletions
This file was deleted.
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
import * as base from "./rollup.base.config";
1+
import { makeConfig } from "@azure/dev-tool/shared-config/rollup";
22

3-
const inputs = [];
4-
5-
if (!process.env.ONLY_BROWSER) {
6-
inputs.push(base.nodeConfig());
7-
}
8-
9-
if (!process.env.ONLY_NODE) {
10-
inputs.push(base.browserConfig());
11-
}
12-
13-
export default inputs;
3+
export default makeConfig(require("./package.json"));

sdk/anomalydetector/ai-anomaly-detector/rollup.test.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

sdk/anomalydetector/ai-anomaly-detector/test/utils/recordedClients.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33

44
import { Context } from "mocha";
55

6-
import * as dotenv from "dotenv";
76
import { env, Recorder, record, RecorderEnvironmentSetup } from "@azure-tools/test-recorder";
87

98
import { ClientSecretCredential } from "@azure/identity";
109
import { AnomalyDetectorClient } from "../../src/AnomalyDetectorClient";
1110
import { AzureKeyCredential } from "@azure/core-auth";
1211

13-
dotenv.config();
14-
1512
export interface RecordedRecognizerClient {
1613
client: AnomalyDetectorClient;
1714
recorder: Recorder;

sdk/appconfiguration/app-configuration/rollup.base.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ const ignoreKnownWarnings = (warning) => {
3434
return;
3535
}
3636

37-
if (
38-
warning.code === "CIRCULAR_DEPENDENCY" &&
39-
warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0)
40-
) {
37+
if (warning.code === "CIRCULAR_DEPENDENCY" && warning.importer.includes("node_modules/chai")) {
4138
// Chai contains circular references, but they are not fatal and can be ignored.
4239
return;
4340
}

sdk/appconfiguration/app-configuration/test/public/utils/testHelpers.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ import {
1717
} from "@azure-tools/test-recorder";
1818
import * as assert from "assert";
1919

20-
// allow loading from a .env file as an alternative to defining the variable
21-
// in the environment
22-
import * as dotenv from "dotenv";
23-
2420
import { DefaultAzureCredential, TokenCredential } from "@azure/identity";
25-
dotenv.config();
2621

2722
let connectionStringNotPresentWarning = false;
2823
let tokenCredentialsNotPresentWarning = false;

sdk/communication/communication-chat/rollup.base.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function browserConfig(test = false) {
127127
baseConfig.onwarn = (warning) => {
128128
if (
129129
warning.code === "CIRCULAR_DEPENDENCY" &&
130-
warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0)
130+
warning.importer.includes("node_modules/chai")
131131
) {
132132
// Chai contains circular references, but they are not fatal and can be ignored.
133133
return;

0 commit comments

Comments
 (0)