Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare to move to @types/node v12 #16012

Merged
1 commit merged into from
Jun 25, 2021
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
2 changes: 1 addition & 1 deletion sdk/core/core-rest-pipeline/src/nodeHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class NodeHttpClient implements HttpClient {
throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`);
}

const agent = request.agent ?? this.getOrCreateAgent(request, isInsecure);
const agent = (request.agent as http.Agent) ?? this.getOrCreateAgent(request, isInsecure);
const options: http.RequestOptions = {
agent,
hostname: url.hostname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { InteractiveBrowserCredential } from "../../../src";
import { MsalTestCleanup, msalNodeTestSetup } from "../../msalTestUtils";
import { interactiveBrowserMockable } from "../../../src/msal/nodeFlows/msalOpenBrowser";

import { URL } from "url";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was worried you were removing this from the runtime code, but it's just tests!


declare global {
namespace NodeJS {
interface Global {
Expand All @@ -38,11 +36,6 @@ describe("InteractiveBrowserCredential (internal)", function() {
const scope = "https://vault.azure.net/.default";

it("Throws an expected error if no browser is available", async function(this: Context) {
// On Node 8, URL is not defined. We use URL on the msalOpenBrowser.ts file.
if (process.version.startsWith("v8.")) {
global.URL = URL;
}

// The SinonStub type does not include this second parameter to throws().
const testErrorMessage = "No browsers available on this test.";
(sandbox.stub(interactiveBrowserMockable, "open") as any).throws("TestError", testErrorMessage);
Expand Down
4 changes: 2 additions & 2 deletions sdk/test-utils/perfstress/src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as url from "url";
*/
export class PerfStressPolicy extends BaseRequestPolicy {
private host: string;
private port?: string;
private port?: string | null;

/**
* It receives the common parameters sent to any core-http policy, plus the host and the port.
Expand All @@ -27,7 +27,7 @@ export class PerfStressPolicy extends BaseRequestPolicy {
nextPolicy: RequestPolicy,
options: RequestPolicyOptions,
host: string,
port?: string
port?: string | null
) {
super(nextPolicy, options);
this.host = host;
Expand Down