diff --git a/sdk/eventhub/event-hubs/karma.conf.js b/sdk/eventhub/event-hubs/karma.conf.js index d246c9c0a1a8..1397476115bd 100644 --- a/sdk/eventhub/event-hubs/karma.conf.js +++ b/sdk/eventhub/event-hubs/karma.conf.js @@ -105,7 +105,7 @@ module.exports = function(config) { // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits - singleRun: false, + singleRun: true, // Concurrency level // how many browser should be started simultaneous diff --git a/sdk/eventhub/event-hubs/rollup.base.config.js b/sdk/eventhub/event-hubs/rollup.base.config.js index b6a3a0238c47..505a27db20e4 100644 --- a/sdk/eventhub/event-hubs/rollup.base.config.js +++ b/sdk/eventhub/event-hubs/rollup.base.config.js @@ -107,19 +107,14 @@ export function browserConfig(test = false) { "if (isNode)": "if (false)" } ), - - // dotenv, path, and os don't work in the browser, so replace it with a no-op function - shim({ - fs: `export default {}`, - dotenv: `export function config() { }`, - os: ` - export function arch() { return "javascript" } - export function type() { return "Browser" } - export function release() { return typeof navigator === 'undefined' ? '' : navigator.appVersion } - `, - path: `export default {}` - }), - + ...(!test + ? [] + : [ + shim({ + // dotenv doesn't work in the browser, so replace it with a no-op function + dotenv: `export function config() { }` + }) + ]), nodeResolve({ mainFields: ["module", "browser"], preferBuiltins: false @@ -127,7 +122,6 @@ export function browserConfig(test = false) { cjs({ namedExports: { - events: ["EventEmitter"], "@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"] } }), diff --git a/sdk/eventhub/event-hubs/test/client.spec.ts b/sdk/eventhub/event-hubs/test/client.spec.ts index 48f3c7d7c242..5b4653558911 100644 --- a/sdk/eventhub/event-hubs/test/client.spec.ts +++ b/sdk/eventhub/event-hubs/test/client.spec.ts @@ -2,7 +2,6 @@ // Licensed under the MIT license. import chai from "chai"; -import * as os from "os"; const should = chai.should(); import chaiAsPromised from "chai-as-promised"; chai.use(chaiAsPromised); @@ -20,6 +19,7 @@ import { packageJsonInfo } from "../src/util/constants"; import { EnvVarKeys, getEnvVars, isNode } from "./utils/testUtils"; import { MessagingError } from "@azure/core-amqp"; import { ConnectionContext } from "../src/connectionContext"; +import { getRuntimeInfo } from "../src/util/runtimeInfo"; const env = getEnvVars(); describe("Create EventHubConsumerClient", function(): void { @@ -516,7 +516,9 @@ describe("EventHubProducerClient User Agent String", function(): void { function testUserAgentString(context: ConnectionContext, customValue?: string) { const packageVersion = packageJsonInfo.version; const properties = context.connection.options.properties; - properties!["user-agent"].should.startWith(`azsdk-js-azureeventhubs/${packageVersion}`); + properties!["user-agent"].should.startWith( + `azsdk-js-azureeventhubs/${packageVersion} (${getRuntimeInfo()})` + ); should.equal(properties!.product, "MSJSClient"); should.equal(properties!.version, packageVersion); if (isNode) { @@ -524,7 +526,7 @@ function testUserAgentString(context: ConnectionContext, customValue?: string) { } else { should.equal(properties!.framework.startsWith("Browser/"), true); } - should.equal(properties!.platform, `(${os.arch()}-${os.type()}-${os.release()})`); + should.exist(properties!.platform); if (customValue) { properties!["user-agent"].should.endWith(customValue); }