Skip to content

Commit

Permalink
[Cosmos] Change imports from dist-esm to src in tests (#8936)
Browse files Browse the repository at this point in the history
* Change imports from dist esm to src

* Remove build:test scripts

* Add back skipped build:test

* Skip version test locally and change import to dist-esm

* Removes unused tsconfig and moves to root

* Comments file for later review

* Keep simplified build and import dist-esm for platform spec

* Fix build test tsconfig
  • Loading branch information
zfoster authored May 20, 2020
1 parent d4724be commit c0c8bce
Show file tree
Hide file tree
Showing 43 changed files with 118 additions and 144 deletions.
10 changes: 5 additions & 5 deletions sdk/cosmosdb/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
"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:test": "tsc",
"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}\"",
Expand All @@ -66,10 +66,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:browser": "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-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",
Expand Down
25 changes: 0 additions & 25 deletions sdk/cosmosdb/cosmos/src/tsconfig.json

This file was deleted.

16 changes: 5 additions & 11 deletions sdk/cosmosdb/cosmos/test/common/TestHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/authorization.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions sdk/cosmosdb/cosmos/test/functional/container.spec.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/database.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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 });
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/item.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
10 changes: 2 additions & 8 deletions sdk/cosmosdb/cosmos/test/functional/npcontainer.spec.ts
Original file line number Diff line number Diff line change
@@ -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[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/offer.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/permission.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
6 changes: 3 additions & 3 deletions sdk/cosmosdb/cosmos/test/functional/plugin.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/query.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/spatial.spec.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/sproc.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/trigger.spec.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/functional/ttl.spec.ts
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/udf.spec.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/functional/user.spec.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions sdk/cosmosdb/cosmos/test/integration/aggregateQuery.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/integration/authorization.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/integration/changeFeed.spec.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions sdk/cosmosdb/cosmos/test/integration/crossPartition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/integration/encoding.spec.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/test/integration/failover.spec.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/test/integration/multiregion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/";

Expand Down
Loading

0 comments on commit c0c8bce

Please sign in to comment.