Skip to content
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
4 changes: 2 additions & 2 deletions sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:samples": "echo Obsolete.",
"build:test:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:test:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c rollup.test.config.js 2>&1",
"build:test:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:test": "tsc -p . && rollup -c 2>&1 && npm run generate-certs",
"build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1 && npm run generate-certs",
"build:types": "downlevel-dts types/latest types/3.1",
"build": "npm run clean && tsc -p . && rollup -c 2>&1 && api-extractor run --local && npm run build:types",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
Expand Down
62 changes: 62 additions & 0 deletions sdk/eventhub/event-hubs/rollup.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import cjs from "@rollup/plugin-commonjs";
import inject from "@rollup/plugin-inject";
import json from "@rollup/plugin-json";
import multiEntry from "@rollup/plugin-multi-entry";
import nodeResolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import shim from "rollup-plugin-shim";
import sourcemaps from "rollup-plugin-sourcemaps";
import { makeConfig, makeBrowserTestConfig } from "@azure/dev-tool/shared-config/rollup";

const inputs = makeConfig(require("./package.json"));

if (!process.env.ONLY_NODE) {
// event-hubs has many dependencies that we do not
// want to bring into the shared rollup config, so
// replace the original test config with a patched one
inputs[1] = makeBrowserTestConfigPatch();
}

function makeBrowserTestConfigPatch() {
const config = { ...makeBrowserTestConfig(require("./package.json")) };
config.plugins = [
multiEntry({ exports: false }),
sourcemaps(),
replace({
delimiters: ["", ""],
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
}),
// fs, net, and tls are used by rhea and need to be shimmed
// dotenv doesn't work in the browser, so replace it with a no-op function
shim({
dotenv: `export function config() { }`
}),
nodeResolve({
mainFields: ["module", "browser"],
preferBuiltins: false
}),
cjs({
namedExports: {
chai: ["should", "assert"]
}
}),
// rhea and rhea-promise use the Buffer global which requires
// injection to shim properly
inject({
modules: {
Buffer: ["buffer", "Buffer"],
process: "process"
},
exclude: ["./**/package.json"]
}),
json()
];

return config;
}

export default inputs;
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import * as chai from "chai";
import chai, { assert } from "chai";
import { dataSectionTypeCode, defaultDataTransformer } from "../../src/dataTransformer";
import { Buffer } from "buffer";
import isBuffer from "is-buffer";
Expand Down
3 changes: 1 addition & 2 deletions sdk/eventhub/event-hubs/test/internal/misc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import {
} from "../../src/diagnostics/instrumentEventData";
import { SubscriptionHandlerForTests } from "../public/utils/subscriptionHandlerForTests";
import { TraceFlags } from "@azure/core-tracing";
import assert from "assert";
import chai from "chai";
import chai, { assert } from "chai";
import chaiAsPromised from "chai-as-promised";
import { createMockServer } from "../public/utils/mockService";
import debugModule from "debug";
Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:test:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
"build:test:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c rollup.test.config.js 2>&1",
"build:test:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
"build:test": "npm run build:test:node && npm run build:test:browser",
"build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1",
"build:types": "downlevel-dts types/latest types/3.1",
"build": "npm run clean && tsc -p . && rollup -c 2>&1 && npm run extract-api && npm run build:types",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
Expand Down
70 changes: 70 additions & 0 deletions sdk/servicebus/service-bus/rollup.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import cjs from "@rollup/plugin-commonjs";
import inject from "@rollup/plugin-inject";
import json from "@rollup/plugin-json";
import multiEntry from "@rollup/plugin-multi-entry";
import nodeResolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import shim from "rollup-plugin-shim";
import sourcemaps from "rollup-plugin-sourcemaps";
import { makeConfig, makeBrowserTestConfig } from "@azure/dev-tool/shared-config/rollup";

const inputs = makeConfig(require("./package.json"));

if (!process.env.ONLY_NODE) {
// service-bus has many dependencies that we do not
// want to bring into the shared rollup config, so
// replace the original test config with a patched one
inputs[1] = makeBrowserTestConfigPatch();
}

function makeBrowserTestConfigPatch() {
const config = { ...makeBrowserTestConfig(require("./package.json")) };
config.plugins = [
multiEntry({ exports: false }),
sourcemaps(),
replace({
delimiters: ["", ""],
// replace dynamic checks with if (false) since this is for
// browser only. Rollup's dead code elimination will remove
// any code guarded by if (isNode) { ... }
"if (isNode)": "if (false)",
"if (!isNode)": "if (true)"
}),
// fs, net, and tls are used by rhea and need to be shimmed
// dotenv doesn't work in the browser, so replace it with a no-op function
shim({
fs: `export default {}`,
net: `export default {}`,
tls: `export default {}`,
dotenv: `export function config() { }`,
path: `export default {}`,
dns: `export function resolve() { }`,
glob: `export default {}`
}),
nodeResolve({
mainFields: ["module", "browser"],
preferBuiltins: false
}),
cjs({
namedExports: {
events: ["EventEmitter"],
long: ["ZERO"],
chai: ["should", "assert"]
}
}),
// rhea and rhea-promise use the Buffer global which requires
// injection to shim properly
inject({
modules: {
Buffer: ["buffer", "Buffer"],
process: "process"
},
exclude: ["./**/package.json"]
}),
json()
];

return config;
}

export default inputs;
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Licensed under the MIT license.

import { Buffer } from "buffer";
import * as chai from "chai";
import chai, { assert } from "chai";
const should = chai.should();
import * as assert from "assert";
import isBuffer from "is-buffer";
import { defaultDataTransformer } from "../../../src/dataTransformer";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { MessageSender } from "../../../src/core/messageSender";
import { assertThrows } from "../../public/utils/testUtils";
import { createConnectionContextForTests } from "./unittestUtils";
import * as assert from "assert";
import { assert } from "chai";

describe("MessageSender unit tests", () => {
it("getMaxMessageSize should retry (exhaust retries)", async () => {
Expand Down