From 41c9ff87dbac28f3634afd554cc0695dc56a2b1a Mon Sep 17 00:00:00 2001 From: Zach foster Date: Thu, 14 May 2020 16:38:48 -0400 Subject: [PATCH 1/8] Change imports from dist esm to src --- sdk/cosmosdb/cosmos/test/common/TestHelpers.ts | 16 +++++----------- .../cosmos/test/functional/authorization.spec.ts | 4 ++-- .../cosmos/test/functional/client.spec.ts | 2 +- .../cosmos/test/functional/container.spec.ts | 12 ++++++------ .../cosmos/test/functional/database.spec.ts | 2 +- .../test/functional/databaseaccount.spec.ts | 2 +- .../functional/globalEndpointManager.spec.ts | 6 +++--- sdk/cosmosdb/cosmos/test/functional/item.spec.ts | 4 ++-- .../cosmos/test/functional/npcontainer.spec.ts | 10 ++-------- .../cosmos/test/functional/offer.spec.ts | 2 +- .../cosmos/test/functional/permission.spec.ts | 4 ++-- .../cosmos/test/functional/plugin.spec.ts | 6 +++--- .../cosmos/test/functional/query.spec.ts | 4 ++-- .../cosmos/test/functional/spatial.spec.ts | 2 +- .../cosmos/test/functional/sproc.spec.ts | 4 ++-- .../cosmos/test/functional/trigger.spec.ts | 4 ++-- sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts | 4 ++-- sdk/cosmosdb/cosmos/test/functional/udf.spec.ts | 2 +- sdk/cosmosdb/cosmos/test/functional/user.spec.ts | 2 +- .../test/integration/aggregateQuery.spec.ts | 10 +++++----- .../test/integration/aggregates/groupBy.spec.ts | 2 +- .../test/integration/authorization.spec.ts | 4 ++-- .../cosmos/test/integration/changeFeed.spec.ts | 4 ++-- .../test/integration/crossPartition.spec.ts | 10 +++++----- .../cosmos/test/integration/encoding.spec.ts | 2 +- .../test/integration/extractPartitionKey.spec.ts | 2 +- .../cosmos/test/integration/failover.spec.ts | 2 +- .../cosmos/test/integration/multiregion.spec.ts | 4 ++-- .../cosmos/test/integration/proxy.spec.ts | 2 +- .../cosmos/test/integration/query.spec.ts | 2 +- .../cosmos/test/integration/queryMetrics.spec.ts | 2 +- .../cosmos/test/integration/retry.spec.ts | 4 ++-- .../cosmos/test/integration/session.spec.ts | 16 ++++++++-------- .../cosmos/test/integration/split.spec.ts | 12 +++--------- .../test/integration/sslVerification.spec.ts | 2 +- sdk/cosmosdb/cosmos/test/tsconfig.json | 7 +++++-- .../unit/defaultQueryExecutionContext.spec.ts | 6 +++--- sdk/cosmosdb/cosmos/test/unit/helper.spec.ts | 2 +- .../unit/inMemoryCollectionRoutingMap.spec.ts | 4 ++-- sdk/cosmosdb/cosmos/test/unit/platform.spec.ts | 4 ++-- .../cosmos/test/unit/sessionContainer.spec.ts | 8 ++++---- .../test/unit/smartRoutingMapProvider.spec.ts | 8 ++------ 42 files changed, 96 insertions(+), 115 deletions(-) diff --git a/sdk/cosmosdb/cosmos/test/common/TestHelpers.ts b/sdk/cosmosdb/cosmos/test/common/TestHelpers.ts index be08b6788aee..e595a0376162 100644 --- a/sdk/cosmosdb/cosmos/test/common/TestHelpers.ts +++ b/sdk/cosmosdb/cosmos/test/common/TestHelpers.ts @@ -8,18 +8,12 @@ import { DatabaseDefinition, RequestOptions, Response -} from "../../dist-esm"; -import { - ItemDefinition, - ItemResponse, - PermissionResponse, - Resource, - User -} from "../../dist-esm/client"; -import { UserResponse } from "../../dist-esm/client/User/UserResponse"; +} from "../../src"; +import { ItemDefinition, ItemResponse, PermissionResponse, Resource, User } from "../../src/client"; +import { UserResponse } from "../../src/client/User/UserResponse"; import { endpoint, masterKey } from "./_testConfig"; -import { DatabaseRequest } from "../../dist-esm/client/Database/DatabaseRequest"; -import { ContainerRequest } from "../../dist-esm/client/Container/ContainerRequest"; +import { DatabaseRequest } from "../../src/client/Database/DatabaseRequest"; +import { ContainerRequest } from "../../src/client/Container/ContainerRequest"; const defaultClient = new CosmosClient({ endpoint, key: masterKey }); diff --git a/sdk/cosmosdb/cosmos/test/functional/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/functional/authorization.spec.ts index 6ca457f0e2d2..1b9ab6cabe58 100644 --- a/sdk/cosmosdb/cosmos/test/functional/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/authorization.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient, PermissionMode } from "../../dist-esm"; -import { PermissionDefinition } from "../../dist-esm/client"; +import { CosmosClient, PermissionMode } from "../../src"; +import { PermissionDefinition } from "../../src/client"; import { endpoint, masterKey } from "../common/_testConfig"; import { createOrUpsertPermission, diff --git a/sdk/cosmosdb/cosmos/test/functional/client.spec.ts b/sdk/cosmosdb/cosmos/test/functional/client.spec.ts index ce755fbbba38..9fa32dfdbbd9 100644 --- a/sdk/cosmosdb/cosmos/test/functional/client.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/client.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import assert from "assert"; import { Agent } from "http"; -import { CosmosClient } from "../../dist-esm"; +import { CosmosClient } from "../../src"; import { endpoint, masterKey } from "../common/_testConfig"; import { getTestDatabase, diff --git a/sdk/cosmosdb/cosmos/test/functional/container.spec.ts b/sdk/cosmosdb/cosmos/test/functional/container.spec.ts index e7dd814a3d75..02ca476146fd 100644 --- a/sdk/cosmosdb/cosmos/test/functional/container.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/container.spec.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants } from "../../dist-esm"; -import { ContainerDefinition, Database, Container } from "../../dist-esm/client"; -import { ContainerRequest } from "../../dist-esm/client/Container/ContainerRequest"; +import { Constants } from "../../src"; +import { ContainerDefinition, Database, Container } from "../../src/client"; +import { ContainerRequest } from "../../src/client/Container/ContainerRequest"; import { DataType, IndexedPath, IndexingMode, IndexingPolicy, IndexKind -} from "../../dist-esm/documents"; -import { SpatialType } from "../../dist-esm/documents/IndexingPolicy"; -import { GeospatialType } from "../../dist-esm/documents/GeospatialType"; +} from "../../src/documents"; +import { SpatialType } from "../../src/documents/IndexingPolicy"; +import { GeospatialType } from "../../src/documents/GeospatialType"; import { getTestDatabase, removeAllDatabases, getTestContainer } from "../common/TestHelpers"; describe("Containers", function() { diff --git a/sdk/cosmosdb/cosmos/test/functional/database.spec.ts b/sdk/cosmosdb/cosmos/test/functional/database.spec.ts index 992f180c9b27..0b2316f29db8 100644 --- a/sdk/cosmosdb/cosmos/test/functional/database.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/database.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient, DatabaseDefinition, Database } from "../../dist-esm"; +import { CosmosClient, DatabaseDefinition, Database } from "../../src/index"; import { endpoint, masterKey } from "../common/_testConfig"; import { addEntropy, removeAllDatabases, getTestDatabase } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/functional/databaseaccount.spec.ts b/sdk/cosmosdb/cosmos/test/functional/databaseaccount.spec.ts index e9239680f1d5..ff6e6ab31be4 100644 --- a/sdk/cosmosdb/cosmos/test/functional/databaseaccount.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/databaseaccount.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient } from "../../dist-esm"; +import { CosmosClient } from "../../src"; import { endpoint, masterKey } from "../common/_testConfig"; const client = new CosmosClient({ endpoint, key: masterKey }); diff --git a/sdk/cosmosdb/cosmos/test/functional/globalEndpointManager.spec.ts b/sdk/cosmosdb/cosmos/test/functional/globalEndpointManager.spec.ts index ed6eadbdd3cf..14dac2f2e100 100644 --- a/sdk/cosmosdb/cosmos/test/functional/globalEndpointManager.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/globalEndpointManager.spec.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DatabaseAccount, ResourceResponse, RequestOptions } from "../../dist-esm"; +import { DatabaseAccount, ResourceResponse, RequestOptions } from "../../src"; import { masterKey } from "../common/_testConfig"; -import { GlobalEndpointManager } from "../../dist-esm/globalEndpointManager"; -import { OperationType, ResourceType } from "../../dist-esm/common"; +import { GlobalEndpointManager } from "../../src/globalEndpointManager"; +import { OperationType, ResourceType } from "../../src/common"; import assert from "assert"; diff --git a/sdk/cosmosdb/cosmos/test/functional/item.spec.ts b/sdk/cosmosdb/cosmos/test/functional/item.spec.ts index 29785eebf3d8..b577d363cde2 100644 --- a/sdk/cosmosdb/cosmos/test/functional/item.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/item.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Container } from "../../dist-esm"; -import { ItemDefinition } from "../../dist-esm/client"; +import { Container } from "../../src"; +import { ItemDefinition } from "../../src/client"; import { bulkDeleteItems, bulkInsertItems, diff --git a/sdk/cosmosdb/cosmos/test/functional/npcontainer.spec.ts b/sdk/cosmosdb/cosmos/test/functional/npcontainer.spec.ts index 201e02de04e3..8c8eca8081f4 100644 --- a/sdk/cosmosdb/cosmos/test/functional/npcontainer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/npcontainer.spec.ts @@ -1,16 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { - CosmosClient, - Constants, - Container, - PluginConfig, - CosmosClientOptions -} from "../../dist-esm"; +import { CosmosClient, Constants, Container, PluginConfig, CosmosClientOptions } from "../../src"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; import { endpoint, masterKey } from "../common/_testConfig"; -import { ResourceType, HTTPMethod, StatusCodes } from "../../dist-esm/common"; +import { ResourceType, HTTPMethod, StatusCodes } from "../../src/common"; const plugins: PluginConfig[] = [ { diff --git a/sdk/cosmosdb/cosmos/test/functional/offer.spec.ts b/sdk/cosmosdb/cosmos/test/functional/offer.spec.ts index 22f0e6f4d36f..d1c72edfa9a3 100644 --- a/sdk/cosmosdb/cosmos/test/functional/offer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/offer.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants, CosmosClient } from "../../dist-esm"; +import { Constants, CosmosClient } from "../../src"; import { endpoint, masterKey } from "../common/_testConfig"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/functional/permission.spec.ts b/sdk/cosmosdb/cosmos/test/functional/permission.spec.ts index bfec16e9a09e..89c7e7a5d234 100644 --- a/sdk/cosmosdb/cosmos/test/functional/permission.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/permission.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { PermissionMode } from "../../dist-esm"; -import { PermissionDefinition } from "../../dist-esm/client"; +import { PermissionMode } from "../../src"; +import { PermissionDefinition } from "../../src/client"; import { createOrUpsertPermission, getTestContainer, diff --git a/sdk/cosmosdb/cosmos/test/functional/plugin.spec.ts b/sdk/cosmosdb/cosmos/test/functional/plugin.spec.ts index 3ec860f302cc..eb14fe153b25 100644 --- a/sdk/cosmosdb/cosmos/test/functional/plugin.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/plugin.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { CosmosClient, CosmosClientOptions } from "../../dist-esm"; -import { RequestContext } from "../../dist-esm/request/RequestContext"; -import { Plugin, Next, PluginConfig } from "../../dist-esm/plugins/Plugin"; +import { CosmosClient, CosmosClientOptions } from "../../src"; +import { RequestContext } from "../../src/request/RequestContext"; +import { Plugin, Next, PluginConfig } from "../../src/plugins/Plugin"; import * as assert from "assert"; diff --git a/sdk/cosmosdb/cosmos/test/functional/query.spec.ts b/sdk/cosmosdb/cosmos/test/functional/query.spec.ts index 7de886279fb9..fb2f3525954d 100644 --- a/sdk/cosmosdb/cosmos/test/functional/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/query.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient } from "../../dist-esm"; -import { Container } from "../../dist-esm/client"; +import { CosmosClient } from "../../src"; +import { Container } from "../../src/client"; import { endpoint, masterKey } from "../common/_testConfig"; import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/functional/spatial.spec.ts b/sdk/cosmosdb/cosmos/test/functional/spatial.spec.ts index b3b578956ff8..42a0a9fb7287 100644 --- a/sdk/cosmosdb/cosmos/test/functional/spatial.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/spatial.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Database, DataType, IndexKind } from "../../dist-esm"; +import { Database, DataType, IndexKind } from "../../src"; import { createOrUpsertItem, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; describe("Spatial Indexes", function() { diff --git a/sdk/cosmosdb/cosmos/test/functional/sproc.spec.ts b/sdk/cosmosdb/cosmos/test/functional/sproc.spec.ts index 5a3467c58fb7..581b10788e93 100644 --- a/sdk/cosmosdb/cosmos/test/functional/sproc.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/sproc.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants } from "../../dist-esm"; -import { Container, StoredProcedureDefinition } from "../../dist-esm/client"; +import { Constants } from "../../src"; +import { Container, StoredProcedureDefinition } from "../../src/client"; import { bulkInsertItems, getTestContainer, diff --git a/sdk/cosmosdb/cosmos/test/functional/trigger.spec.ts b/sdk/cosmosdb/cosmos/test/functional/trigger.spec.ts index fdd23fa8babf..c02c023b0ab1 100644 --- a/sdk/cosmosdb/cosmos/test/functional/trigger.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/trigger.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { TriggerOperation, TriggerType } from "../../dist-esm"; -import { TriggerDefinition, Container } from "../../dist-esm/client"; +import { TriggerOperation, TriggerType } from "../../src"; +import { TriggerDefinition, Container } from "../../src/client"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; const notFoundErrorCode = 404; diff --git a/sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts b/sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts index 11fc65a58bbd..ebba4f4496d4 100644 --- a/sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Container, ContainerDefinition, Database } from "../../dist-esm/client"; +import { Container, ContainerDefinition, Database } from "../../src/client"; import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -import { StatusCodes } from "../../dist-esm"; +import { StatusCodes } from "../../src"; async function sleep(time: number) { return new Promise((resolve) => { diff --git a/sdk/cosmosdb/cosmos/test/functional/udf.spec.ts b/sdk/cosmosdb/cosmos/test/functional/udf.spec.ts index 6ea87ef813c8..ec8ce9b38081 100644 --- a/sdk/cosmosdb/cosmos/test/functional/udf.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/udf.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { UserDefinedFunctionDefinition, Container } from "../../dist-esm/client"; +import { UserDefinedFunctionDefinition, Container } from "../../src/client"; import { removeAllDatabases, getTestContainer } from "../common/TestHelpers"; describe("User Defined Function", function() { diff --git a/sdk/cosmosdb/cosmos/test/functional/user.spec.ts b/sdk/cosmosdb/cosmos/test/functional/user.spec.ts index 518ad8b08790..f5f7dd0dddd3 100644 --- a/sdk/cosmosdb/cosmos/test/functional/user.spec.ts +++ b/sdk/cosmosdb/cosmos/test/functional/user.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { UserDefinition } from "../../dist-esm/client"; +import { UserDefinition } from "../../src/client"; import { createOrUpsertUser, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; describe("NodeJS CRUD Tests", function() { diff --git a/sdk/cosmosdb/cosmos/test/integration/aggregateQuery.spec.ts b/sdk/cosmosdb/cosmos/test/integration/aggregateQuery.spec.ts index 5b66d1d5e132..fad6b8a9ac83 100644 --- a/sdk/cosmosdb/cosmos/test/integration/aggregateQuery.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/aggregateQuery.spec.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Container, ContainerDefinition } from "../../dist-esm/client"; -import { DataType, IndexKind } from "../../dist-esm/documents"; -import { QueryIterator } from "../../dist-esm/index"; -import { SqlQuerySpec } from "../../dist-esm/queryExecutionContext"; -import { FeedOptions } from "../../dist-esm/request"; +import { Container, ContainerDefinition } from "../../src/client"; +import { DataType, IndexKind } from "../../src/documents"; +import { QueryIterator } from "../../src/index"; +import { SqlQuerySpec } from "../../src/queryExecutionContext"; +import { FeedOptions } from "../../src/request"; import { TestData } from "../common/TestData"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/integration/aggregates/groupBy.spec.ts b/sdk/cosmosdb/cosmos/test/integration/aggregates/groupBy.spec.ts index d44784e577ac..f5185e9b026c 100644 --- a/sdk/cosmosdb/cosmos/test/integration/aggregates/groupBy.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/aggregates/groupBy.spec.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { Container, ContainerDefinition } from "../../../dist-esm/client"; +import { Container, ContainerDefinition } from "../../../src/client"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../../common/TestHelpers"; import snapshot from "snap-shot-it"; import assert from "assert"; diff --git a/sdk/cosmosdb/cosmos/test/integration/authorization.spec.ts b/sdk/cosmosdb/cosmos/test/integration/authorization.spec.ts index 738c232d6140..6caad9331338 100644 --- a/sdk/cosmosdb/cosmos/test/integration/authorization.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/authorization.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Container, CosmosClient, PermissionMode } from "../../dist-esm"; -import { Database } from "../../dist-esm/client"; +import { Container, CosmosClient, PermissionMode } from "../../src"; +import { Database } from "../../src/client"; import { endpoint } from "../common/_testConfig"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/integration/changeFeed.spec.ts b/sdk/cosmosdb/cosmos/test/integration/changeFeed.spec.ts index 0a67a1c1d4b1..aa7440835934 100644 --- a/sdk/cosmosdb/cosmos/test/integration/changeFeed.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/changeFeed.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { RequestOptions } from "../../dist-esm"; -import { Container, ContainerDefinition } from "../../dist-esm/client"; +import { RequestOptions } from "../../src"; +import { Container, ContainerDefinition } from "../../src/client"; import { getTestContainer, removeAllDatabases } from "../common/TestHelpers"; describe("Change Feed Iterator", function() { diff --git a/sdk/cosmosdb/cosmos/test/integration/crossPartition.spec.ts b/sdk/cosmosdb/cosmos/test/integration/crossPartition.spec.ts index ecaba0586503..d27057c8f5b0 100644 --- a/sdk/cosmosdb/cosmos/test/integration/crossPartition.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/crossPartition.spec.ts @@ -2,17 +2,17 @@ // Licensed under the MIT license. import assert from "assert"; import * as util from "util"; -import { Container, ContainerDefinition } from "../../dist-esm/client"; -import { DataType, IndexKind } from "../../dist-esm/documents"; -import { SqlQuerySpec } from "../../dist-esm/queryExecutionContext"; -import { QueryIterator } from "../../dist-esm/queryIterator"; +import { Container, ContainerDefinition } from "../../src/client"; +import { DataType, IndexKind } from "../../src/documents"; +import { SqlQuerySpec } from "../../src/queryExecutionContext"; +import { QueryIterator } from "../../src/queryIterator"; import { bulkInsertItems, getTestContainer, removeAllDatabases, generateDocuments } from "../common/TestHelpers"; -import { FeedResponse, FeedOptions } from "../../dist-esm"; +import { FeedResponse, FeedOptions } from "../../src"; function compare(key: string) { return function(a: any, b: any): number { diff --git a/sdk/cosmosdb/cosmos/test/integration/encoding.spec.ts b/sdk/cosmosdb/cosmos/test/integration/encoding.spec.ts index fb1b0c6899a5..bb539e9ca3e7 100644 --- a/sdk/cosmosdb/cosmos/test/integration/encoding.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/encoding.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { IndexingMode } from "../../dist-esm/documents"; +import { IndexingMode } from "../../src/documents"; import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; const testDoc = { diff --git a/sdk/cosmosdb/cosmos/test/integration/extractPartitionKey.spec.ts b/sdk/cosmosdb/cosmos/test/integration/extractPartitionKey.spec.ts index e8b9806760c3..a6bccb7a8042 100644 --- a/sdk/cosmosdb/cosmos/test/integration/extractPartitionKey.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/extractPartitionKey.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { extractPartitionKey } from "../../dist-esm/extractPartitionKey"; +import { extractPartitionKey } from "../../src/extractPartitionKey"; describe("extractPartitionKey", function() { describe("With undefined partitionKeyDefinition", function() { diff --git a/sdk/cosmosdb/cosmos/test/integration/failover.spec.ts b/sdk/cosmosdb/cosmos/test/integration/failover.spec.ts index 120ad67e5fee..13f43235a021 100644 --- a/sdk/cosmosdb/cosmos/test/integration/failover.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/failover.spec.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { CosmosClient, PluginOn, CosmosClientOptions, PluginConfig } from "../../dist-esm"; +import { CosmosClient, PluginOn, CosmosClientOptions, PluginConfig } from "../../src"; import { masterKey } from "../common/_testConfig"; import assert from "assert"; diff --git a/sdk/cosmosdb/cosmos/test/integration/multiregion.spec.ts b/sdk/cosmosdb/cosmos/test/integration/multiregion.spec.ts index 33247db8a735..dd7f25e655af 100644 --- a/sdk/cosmosdb/cosmos/test/integration/multiregion.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/multiregion.spec.ts @@ -2,9 +2,9 @@ // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient } from "../../dist-esm/CosmosClient"; +import { CosmosClient } from "../../src/CosmosClient"; import { masterKey } from "../common/_testConfig"; -import { PluginOn, PluginConfig, CosmosClientOptions } from "../../dist-esm"; +import { PluginOn, PluginConfig, CosmosClientOptions } from "../../src"; const endpoint = "https://failovertest.documents.azure.com/"; diff --git a/sdk/cosmosdb/cosmos/test/integration/proxy.spec.ts b/sdk/cosmosdb/cosmos/test/integration/proxy.spec.ts index efbbfe2f4f1b..e5c44a54e58e 100644 --- a/sdk/cosmosdb/cosmos/test/integration/proxy.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/proxy.spec.ts @@ -4,7 +4,7 @@ import * as http from "http"; import * as net from "net"; import { URL } from "url"; import ProxyAgent from "proxy-agent"; -import { CosmosClient } from "../../dist-esm/index"; +import { CosmosClient } from "../../src/index"; import { endpoint, masterKey } from "../common/_testConfig"; import { addEntropy } from "../common/TestHelpers"; diff --git a/sdk/cosmosdb/cosmos/test/integration/query.spec.ts b/sdk/cosmosdb/cosmos/test/integration/query.spec.ts index 04ea1d613b80..d0c15acbc2c2 100644 --- a/sdk/cosmosdb/cosmos/test/integration/query.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/query.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { FeedOptions } from "../../dist-esm"; +import { FeedOptions } from "../../src"; import { getTestContainer, getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; const doc = { id: "myId", pk: "pk" }; diff --git a/sdk/cosmosdb/cosmos/test/integration/queryMetrics.spec.ts b/sdk/cosmosdb/cosmos/test/integration/queryMetrics.spec.ts index 1a7a8c397c3d..ef4c3fc76951 100644 --- a/sdk/cosmosdb/cosmos/test/integration/queryMetrics.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/queryMetrics.spec.ts @@ -7,7 +7,7 @@ import { QueryPreparationTimes, RuntimeExecutionTimes, TimeSpan -} from "../../dist-esm/queryMetrics"; +} from "../../src/queryMetrics"; describe("QueryMetrics", function() { // Properties diff --git a/sdk/cosmosdb/cosmos/test/integration/retry.spec.ts b/sdk/cosmosdb/cosmos/test/integration/retry.spec.ts index d39470479041..fa239fecbeba 100644 --- a/sdk/cosmosdb/cosmos/test/integration/retry.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/retry.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. // import assert from "assert"; -// import { ConnectionPolicy, Constants, CosmosClient, RetryOptions } from "../../dist-esm"; -// import * as request from "../../dist-esm/request"; +// import { ConnectionPolicy, Constants, CosmosClient, RetryOptions } from "../../src"; +// import * as request from "../../src/request"; describe("retry policy tests", function() { // this.timeout(300000); diff --git a/sdk/cosmosdb/cosmos/test/integration/session.spec.ts b/sdk/cosmosdb/cosmos/test/integration/session.spec.ts index 339163db006d..ddb2798592a7 100644 --- a/sdk/cosmosdb/cosmos/test/integration/session.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/session.spec.ts @@ -2,16 +2,16 @@ // Licensed under the MIT license. import assert from "assert"; import * as sinon from "sinon"; -import { ClientContext } from "../../dist-esm/ClientContext"; -import { OperationType, ResourceType, trimSlashes } from "../../dist-esm/common"; -import { ConsistencyLevel } from "../../dist-esm/documents"; -import { Constants, CosmosClient } from "../../dist-esm/index"; -import { SessionContainer } from "../../dist-esm/session/sessionContainer"; -import { VectorSessionToken } from "../../dist-esm/session/VectorSessionToken"; +import { ClientContext } from "../../src/ClientContext"; +import { OperationType, ResourceType, trimSlashes } from "../../src/common"; +import { ConsistencyLevel } from "../../src/documents"; +import { Constants, CosmosClient } from "../../src/index"; +import { SessionContainer } from "../../src/session/sessionContainer"; +import { VectorSessionToken } from "../../src/session/VectorSessionToken"; import { endpoint, masterKey } from "../common/_testConfig"; import { getTestDatabase, removeAllDatabases } from "../common/TestHelpers"; -import * as RequestHandler from "../../dist-esm/request/RequestHandler"; -import { RequestContext } from "../../dist-esm/request/RequestContext"; +import * as RequestHandler from "../../src/request/RequestHandler"; +import { RequestContext } from "../../src/request/RequestContext"; // TODO: there is alot of "any" types for tokens here // TODO: there is alot of leaky document client stuff here that will make removing document client hard diff --git a/sdk/cosmosdb/cosmos/test/integration/split.spec.ts b/sdk/cosmosdb/cosmos/test/integration/split.spec.ts index 212bd61210fb..fb7bf1f3e9f7 100644 --- a/sdk/cosmosdb/cosmos/test/integration/split.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/split.spec.ts @@ -1,16 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { Container } from "../../dist-esm/client"; +import { Container } from "../../src/client"; import { bulkInsertItems, getTestContainer, removeAllDatabases } from "../common/TestHelpers"; -import { - Constants, - CosmosClient, - PluginOn, - CosmosClientOptions, - PluginConfig -} from "../../dist-esm"; +import { Constants, CosmosClient, PluginOn, CosmosClientOptions, PluginConfig } from "../../src"; import { masterKey, endpoint } from "../common/_testConfig"; -import { SubStatusCodes } from "../../dist-esm/common"; +import { SubStatusCodes } from "../../src/common"; import assert from "assert"; const splitError = new Error("Fake Partition Split") as any; diff --git a/sdk/cosmosdb/cosmos/test/integration/sslVerification.spec.ts b/sdk/cosmosdb/cosmos/test/integration/sslVerification.spec.ts index f3fb44f5a8e9..c5edeb44ea11 100644 --- a/sdk/cosmosdb/cosmos/test/integration/sslVerification.spec.ts +++ b/sdk/cosmosdb/cosmos/test/integration/sslVerification.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { CosmosClient } from "../../dist-esm"; +import { CosmosClient } from "../../src"; import { getTestDatabase } from "../common/TestHelpers"; import https from "https"; diff --git a/sdk/cosmosdb/cosmos/test/tsconfig.json b/sdk/cosmosdb/cosmos/test/tsconfig.json index d515d04ab499..489a48aad12b 100644 --- a/sdk/cosmosdb/cosmos/test/tsconfig.json +++ b/sdk/cosmosdb/cosmos/test/tsconfig.json @@ -13,6 +13,9 @@ "sourceMap": true, "newLine": "LF", "composite": true, - "noUnusedLocals": true - } + "noUnusedLocals": true, + "rootDir": "../src", + "outDir": "../dist-esm" + }, + "include": ["../src"] } diff --git a/sdk/cosmosdb/cosmos/test/unit/defaultQueryExecutionContext.spec.ts b/sdk/cosmosdb/cosmos/test/unit/defaultQueryExecutionContext.spec.ts index 037d9857293d..915688a51a48 100644 --- a/sdk/cosmosdb/cosmos/test/unit/defaultQueryExecutionContext.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/defaultQueryExecutionContext.spec.ts @@ -3,10 +3,10 @@ import { FetchFunctionCallback, DefaultQueryExecutionContext -} from "../../dist-esm/queryExecutionContext"; -import { FeedOptions } from "../../dist-esm"; +} from "../../src/queryExecutionContext"; +import { FeedOptions } from "../../src"; import assert from "assert"; -import { sleep } from "../../dist-esm/common"; +import { sleep } from "../../src/common"; describe("defaultQueryExecutionContext", function() { it("should not buffer items if bufferItems is false", async function() { diff --git a/sdk/cosmosdb/cosmos/test/unit/helper.spec.ts b/sdk/cosmosdb/cosmos/test/unit/helper.spec.ts index 743305179e43..0222f30a0f51 100644 --- a/sdk/cosmosdb/cosmos/test/unit/helper.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/helper.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { isResourceValid, parseConnectionString } from "../../dist-esm/common"; +import { isResourceValid, parseConnectionString } from "../../src/common"; describe("Helper methods", function() { describe("isResourceValid Unit Tests", function() { diff --git a/sdk/cosmosdb/cosmos/test/unit/inMemoryCollectionRoutingMap.spec.ts b/sdk/cosmosdb/cosmos/test/unit/inMemoryCollectionRoutingMap.spec.ts index 3b591ec53d39..7c58f73d0c91 100644 --- a/sdk/cosmosdb/cosmos/test/unit/inMemoryCollectionRoutingMap.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/inMemoryCollectionRoutingMap.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { QueryRange } from "../../dist-esm/routing"; -import { createCompleteRoutingMap } from "../../dist-esm/routing/CollectionRoutingMapFactory"; +import { QueryRange } from "../../src/routing"; +import { createCompleteRoutingMap } from "../../src/routing/CollectionRoutingMapFactory"; describe("InMemoryCollectionRoutingMap Tests", function() { describe("getOverlappingRanges", function() { diff --git a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts index f0b8b518d2d6..81f6ae1a9e15 100644 --- a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants } from "../../dist-esm/index"; -import { getUserAgent } from "../../dist-esm/common"; +import { Constants } from "../../src/index"; +import { getUserAgent } from "../../src/common"; const packageJson = require("../../package.json"); const packageVersion = packageJson["version"]; diff --git a/sdk/cosmosdb/cosmos/test/unit/sessionContainer.spec.ts b/sdk/cosmosdb/cosmos/test/unit/sessionContainer.spec.ts index b9421f2d5216..a3422925e47e 100644 --- a/sdk/cosmosdb/cosmos/test/unit/sessionContainer.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/sessionContainer.spec.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants, OperationType, ResourceType } from "../../dist-esm/common"; -import { CosmosHeaders } from "../../dist-esm/queryExecutionContext/CosmosHeaders"; -import { SessionContainer } from "../../dist-esm/session/sessionContainer"; -import { SessionContext } from "../../dist-esm/session/SessionContext"; +import { Constants, OperationType, ResourceType } from "../../src/common"; +import { CosmosHeaders } from "../../src/queryExecutionContext/CosmosHeaders"; +import { SessionContainer } from "../../src/session/sessionContainer"; +import { SessionContext } from "../../src/session/SessionContext"; describe("SessionContainer", function() { const collectionLink = "dbs/testDatabase/colls/testCollection"; diff --git a/sdk/cosmosdb/cosmos/test/unit/smartRoutingMapProvider.spec.ts b/sdk/cosmosdb/cosmos/test/unit/smartRoutingMapProvider.spec.ts index 28a616a068d1..4a8e0be6ecb3 100644 --- a/sdk/cosmosdb/cosmos/test/unit/smartRoutingMapProvider.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/smartRoutingMapProvider.spec.ts @@ -1,12 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { ClientContext } from "../../dist-esm/ClientContext"; -import { - PartitionKeyRangeCache, - QueryRange, - SmartRoutingMapProvider -} from "../../dist-esm/routing"; +import { ClientContext } from "../../src/ClientContext"; +import { PartitionKeyRangeCache, QueryRange, SmartRoutingMapProvider } from "../../src/routing"; import { MockedClientContext } from "../common/MockClientContext"; describe("Smart Routing Map Provider OverlappingRanges", function() { From fc27ddb772a23f8880f30ee996eeef6b0595de2a Mon Sep 17 00:00:00 2001 From: Zach foster Date: Thu, 14 May 2020 18:52:37 -0400 Subject: [PATCH 2/8] Remove build:test scripts --- sdk/cosmosdb/cosmos/package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/cosmosdb/cosmos/package.json b/sdk/cosmosdb/cosmos/package.json index 45d396b2fcb9..48a03fa8e59d 100644 --- a/sdk/cosmosdb/cosmos/package.json +++ b/sdk/cosmosdb/cosmos/package.json @@ -48,7 +48,6 @@ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "node prep-samples.js && tsc -b samples", "build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty", - "build:test": "tsc -b src test --verbose", "build:types": "downlevel-dts dist/types/latest dist/types/3.1", "build": "npm run clean && tslint --project ./src/tsconfig.json && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", "bundle": "rollup -c", @@ -66,10 +65,10 @@ "lint": "eslint package.json tsconfig.json src test samples --ext .ts -f html -o cosmos-lintReport.html || exit 0", "pack": "npm pack 2>&1", "prebuild": "npm run clean", - "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:browser": "npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run unit-test:node && npm run integration-test:node", "test-consumer": "node consumer-test.js 2>&1", - "test": "npm run build:test && npm run unit-test && npm run integration-test", + "test": "npm run unit-test && npm run integration-test", "test:signoff": "mocha -r esm -r dotenv/config -r ./test/common/setup.js \"./test/**/*.spec.js\" --timeout 100000 --grep \"#nosignoff\" --invert", "unit-test:browser": "echo skipped", "unit-test:node": "echo skipped", From 94ba9557789020ae13e6b8430ac6d507598e8a74 Mon Sep 17 00:00:00 2001 From: Zach foster Date: Fri, 15 May 2020 09:58:12 -0400 Subject: [PATCH 3/8] Add back skipped build:test --- sdk/cosmosdb/cosmos/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/cosmosdb/cosmos/package.json b/sdk/cosmosdb/cosmos/package.json index 48a03fa8e59d..24fe1fc3d201 100644 --- a/sdk/cosmosdb/cosmos/package.json +++ b/sdk/cosmosdb/cosmos/package.json @@ -48,6 +48,7 @@ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "node prep-samples.js && tsc -b samples", "build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty", + "build:test": "echo skipped", "build:types": "downlevel-dts dist/types/latest dist/types/3.1", "build": "npm run clean && tslint --project ./src/tsconfig.json && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", "bundle": "rollup -c", From dfb9b33c36d65ba6a4300103d3c4ae51fd05292e Mon Sep 17 00:00:00 2001 From: Zach foster Date: Fri, 15 May 2020 14:12:38 -0400 Subject: [PATCH 4/8] Skip version test locally and change import to dist-esm --- sdk/cosmosdb/cosmos/test/unit/platform.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts index 81f6ae1a9e15..df82b19f2feb 100644 --- a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants } from "../../src/index"; +import { Constants } from "../../dist-esm/index"; import { getUserAgent } from "../../src/common"; const packageJson = require("../../package.json"); @@ -23,8 +23,10 @@ describe("getUserAgent", function() { }); }); -describe("Version", function() { +describe.only("Version", function() { it("should have matching constant version & package version", function() { + console.log(process.env); + if (process.env.NODE_ENV !== "development") return this.skip(); assert.equal( constantVersion, packageVersion, From 391932ef8e87b1d9032a4c076c263ff8976e6a00 Mon Sep 17 00:00:00 2001 From: Zach foster Date: Sat, 16 May 2020 13:31:31 -0400 Subject: [PATCH 5/8] Removes unused tsconfig and moves to root --- sdk/cosmosdb/cosmos/package.json | 4 +-- sdk/cosmosdb/cosmos/src/tsconfig.json | 25 ----------------- sdk/cosmosdb/cosmos/test/tsconfig.json | 7 ++--- .../cosmos/test/unit/platform.spec.ts | 24 ++++++++--------- sdk/cosmosdb/cosmos/tsconfig.json | 27 ++++++++++++++++--- 5 files changed, 39 insertions(+), 48 deletions(-) delete mode 100644 sdk/cosmosdb/cosmos/src/tsconfig.json diff --git a/sdk/cosmosdb/cosmos/package.json b/sdk/cosmosdb/cosmos/package.json index 24fe1fc3d201..64719a5c53b0 100644 --- a/sdk/cosmosdb/cosmos/package.json +++ b/sdk/cosmosdb/cosmos/package.json @@ -50,12 +50,12 @@ "build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty", "build:test": "echo skipped", "build:types": "downlevel-dts dist/types/latest dist/types/3.1", - "build": "npm run clean && tslint --project ./src/tsconfig.json && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", + "build": "npm run clean && npm run lint && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", "bundle": "rollup -c", "bundle-types": "node bundle-types.js", "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm temp types *.tgz *.html *.log *.tsbuildinfo test/**/*.{js,js.map,d.ts}", - "docs": "typedoc --tsconfig ./src/tsconfig.json --excludePrivate --mode file --out ./dist/docs ./src", + "docs": "typedoc --excludePrivate --mode file --out ./dist/docs ./src", "execute:samples": " cd samples && npm run all-samples", "extract-api": "npm run build:src && api-extractor run --local", "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", diff --git a/sdk/cosmosdb/cosmos/src/tsconfig.json b/sdk/cosmosdb/cosmos/src/tsconfig.json deleted file mode 100644 index 9c53832ba041..000000000000 --- a/sdk/cosmosdb/cosmos/src/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "module": "esnext", - "moduleResolution": "node", - "importHelpers": true, - "noImplicitAny": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "outDir": "../dist-esm", - "preserveConstEnums": true, - "removeComments": false, - "target": "es6", - "sourceMap": true, - "inlineSources": true, - "newLine": "LF", - "resolveJsonModule": true, - "composite": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "stripInternal": true - }, - "include": ["./**/*"] -} diff --git a/sdk/cosmosdb/cosmos/test/tsconfig.json b/sdk/cosmosdb/cosmos/test/tsconfig.json index 489a48aad12b..d515d04ab499 100644 --- a/sdk/cosmosdb/cosmos/test/tsconfig.json +++ b/sdk/cosmosdb/cosmos/test/tsconfig.json @@ -13,9 +13,6 @@ "sourceMap": true, "newLine": "LF", "composite": true, - "noUnusedLocals": true, - "rootDir": "../src", - "outDir": "../dist-esm" - }, - "include": ["../src"] + "noUnusedLocals": true + } } diff --git a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts index df82b19f2feb..c9866e33924a 100644 --- a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import assert from "assert"; -import { Constants } from "../../dist-esm/index"; +// import { Constants } from "../../src/index"; import { getUserAgent } from "../../src/common"; const packageJson = require("../../package.json"); const packageVersion = packageJson["version"]; -const constantVersion = Constants.SDKVersion; +// const constantVersion = Constants.SDKVersion; describe("getUserAgent", function() { it("should contain the current SDK version", () => { @@ -23,14 +23,12 @@ describe("getUserAgent", function() { }); }); -describe.only("Version", function() { - it("should have matching constant version & package version", function() { - console.log(process.env); - if (process.env.NODE_ENV !== "development") return this.skip(); - assert.equal( - constantVersion, - packageVersion, - "Package.json and Constants.SDKVersion don't match" - ); - }); -}); +// describe("Version", function() { +// it("should have matching constant version & package version", function() { +// assert.equal( +// constantVersion, +// packageVersion, +// "Package.json and Constants.SDKVersion don't match" +// ); +// }); +// }); diff --git a/sdk/cosmosdb/cosmos/tsconfig.json b/sdk/cosmosdb/cosmos/tsconfig.json index d8c6fc5cde96..ac0425d109e9 100644 --- a/sdk/cosmosdb/cosmos/tsconfig.json +++ b/sdk/cosmosdb/cosmos/tsconfig.json @@ -1,5 +1,26 @@ { - "compilerOptions": {}, - "files": [], - "references": [{ "path": "./src" }, { "path": "./test" }] + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "module": "esnext", + "moduleResolution": "node", + "importHelpers": true, + "noImplicitAny": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "outDir": "dist-esm", + "preserveConstEnums": true, + "removeComments": false, + "target": "es6", + "sourceMap": true, + "inlineSources": true, + "newLine": "LF", + "resolveJsonModule": true, + "composite": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "stripInternal": true, + "rootDir": "src" + }, + "include": ["src/**/*"] } From 9c7f02fdd31c7b7d9601f2497a88e31fed4edbdb Mon Sep 17 00:00:00 2001 From: Zach foster Date: Sat, 16 May 2020 14:01:13 -0400 Subject: [PATCH 6/8] Comments file for later review --- .../cosmos/test/unit/platform.spec.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts index c9866e33924a..f791e4d61212 100644 --- a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts @@ -1,27 +1,27 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -import assert from "assert"; +// // Copyright (c) Microsoft Corporation. +// // Licensed under the MIT license. +// import assert from "assert"; // import { Constants } from "../../src/index"; -import { getUserAgent } from "../../src/common"; +// import { getUserAgent } from "../../src/common"; -const packageJson = require("../../package.json"); -const packageVersion = packageJson["version"]; +// const packageJson = require("../../package.json"); +// const packageVersion = packageJson["version"]; // const constantVersion = Constants.SDKVersion; -describe("getUserAgent", function() { - it("should contain the current SDK version", () => { - assert(getUserAgent().includes(packageVersion)); - }); +// describe("getUserAgent", function() { +// it("should contain the current SDK version", () => { +// assert(getUserAgent().includes(packageVersion)); +// }); - it("should contain the current node version", () => { - assert(getUserAgent().includes(process.version.replace("v", ""))); - }); +// it("should contain the current node version", () => { +// assert(getUserAgent().includes(process.version.replace("v", ""))); +// }); - it("should allow a custom suffix", () => { - const suffix = "myApp"; - assert(getUserAgent(suffix).includes(suffix)); - }); -}); +// it("should allow a custom suffix", () => { +// const suffix = "myApp"; +// assert(getUserAgent(suffix).includes(suffix)); +// }); +// }); // describe("Version", function() { // it("should have matching constant version & package version", function() { From dde1a0d857a19e91ea67089c3d54d41fc6e29afc Mon Sep 17 00:00:00 2001 From: Zach foster Date: Wed, 20 May 2020 13:43:21 -0400 Subject: [PATCH 7/8] Keep simplified build and import dist-esm for platform spec --- sdk/cosmosdb/cosmos/package.json | 4 +- .../cosmos/test/unit/platform.spec.ts | 58 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/sdk/cosmosdb/cosmos/package.json b/sdk/cosmosdb/cosmos/package.json index 64719a5c53b0..13064a9e9305 100644 --- a/sdk/cosmosdb/cosmos/package.json +++ b/sdk/cosmosdb/cosmos/package.json @@ -48,7 +48,7 @@ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "node prep-samples.js && tsc -b samples", "build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty", - "build:test": "echo skipped", + "build:test": "tsc -b src --verbose", "build:types": "downlevel-dts dist/types/latest dist/types/3.1", "build": "npm run clean && npm run lint && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", "bundle": "rollup -c", @@ -67,7 +67,7 @@ "pack": "npm pack 2>&1", "prebuild": "npm run clean", "test:browser": "npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run unit-test:node && npm run integration-test:node", + "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", "test-consumer": "node consumer-test.js 2>&1", "test": "npm run unit-test && npm run integration-test", "test:signoff": "mocha -r esm -r dotenv/config -r ./test/common/setup.js \"./test/**/*.spec.js\" --timeout 100000 --grep \"#nosignoff\" --invert", diff --git a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts index f791e4d61212..f0b8b518d2d6 100644 --- a/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts +++ b/sdk/cosmosdb/cosmos/test/unit/platform.spec.ts @@ -1,34 +1,34 @@ -// // Copyright (c) Microsoft Corporation. -// // Licensed under the MIT license. -// import assert from "assert"; -// import { Constants } from "../../src/index"; -// import { getUserAgent } from "../../src/common"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +import assert from "assert"; +import { Constants } from "../../dist-esm/index"; +import { getUserAgent } from "../../dist-esm/common"; -// const packageJson = require("../../package.json"); -// const packageVersion = packageJson["version"]; -// const constantVersion = Constants.SDKVersion; +const packageJson = require("../../package.json"); +const packageVersion = packageJson["version"]; +const constantVersion = Constants.SDKVersion; -// describe("getUserAgent", function() { -// it("should contain the current SDK version", () => { -// assert(getUserAgent().includes(packageVersion)); -// }); +describe("getUserAgent", function() { + it("should contain the current SDK version", () => { + assert(getUserAgent().includes(packageVersion)); + }); -// it("should contain the current node version", () => { -// assert(getUserAgent().includes(process.version.replace("v", ""))); -// }); + it("should contain the current node version", () => { + assert(getUserAgent().includes(process.version.replace("v", ""))); + }); -// it("should allow a custom suffix", () => { -// const suffix = "myApp"; -// assert(getUserAgent(suffix).includes(suffix)); -// }); -// }); + it("should allow a custom suffix", () => { + const suffix = "myApp"; + assert(getUserAgent(suffix).includes(suffix)); + }); +}); -// describe("Version", function() { -// it("should have matching constant version & package version", function() { -// assert.equal( -// constantVersion, -// packageVersion, -// "Package.json and Constants.SDKVersion don't match" -// ); -// }); -// }); +describe("Version", function() { + it("should have matching constant version & package version", function() { + assert.equal( + constantVersion, + packageVersion, + "Package.json and Constants.SDKVersion don't match" + ); + }); +}); From 911868612b0ca518aa10a7f276ecb3d3d94509ab Mon Sep 17 00:00:00 2001 From: Zach foster Date: Wed, 20 May 2020 16:33:34 -0400 Subject: [PATCH 8/8] Fix build test tsconfig --- sdk/cosmosdb/cosmos/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cosmosdb/cosmos/package.json b/sdk/cosmosdb/cosmos/package.json index 13064a9e9305..bc307608fe16 100644 --- a/sdk/cosmosdb/cosmos/package.json +++ b/sdk/cosmosdb/cosmos/package.json @@ -48,7 +48,7 @@ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "node prep-samples.js && tsc -b samples", "build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty", - "build:test": "tsc -b src --verbose", + "build:test": "tsc", "build:types": "downlevel-dts dist/types/latest dist/types/3.1", "build": "npm run clean && npm run lint && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle", "bundle": "rollup -c",