Skip to content

Commit e668a5e

Browse files
authored
Cosmosdb/fix test commands (Azure#34308)
### Packages impacted by this PR @azure/cosmos ### Issues associated with this PR ### Describe the problem that is addressed by this PR 1. This PR fixes the issue of integration tests not running as part of pipeline. 2. Fix a failing test case ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent 90b2d3c commit e668a5e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

sdk/cosmosdb/cosmos/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@
5151
"pack": "npm pack 2>&1",
5252
"test": "npm run test:node && npm run test:browser",
5353
"test:browser": "echo skipped",
54-
"test:node": "dev-tool run vendored cross-env NODE_OPTIONS='--dns-result-order=ipv4first' dev-tool run test:vitest --no-test-proxy -- -c vitest.unit.config.ts",
54+
"test:node": "npm run test:node:unit && npm run test:node:live",
5555
"test:node:esm": "dev-tool run test:vitest --esm",
5656
"test:node:live": "dev-tool run vendored cross-env NODE_OPTIONS='--dns-result-order=ipv4first' dev-tool run test:vitest --no-test-proxy -- -c vitest.int.config.ts",
57+
"test:node:unit": "dev-tool run vendored cross-env NODE_OPTIONS='--dns-result-order=ipv4first' dev-tool run test:vitest --no-test-proxy -- -c vitest.unit.config.ts",
5758
"update-snippets": "dev-tool run update-snippets"
5859
},
5960
"repository": "github:Azure/azure-sdk-for-js",

sdk/cosmosdb/cosmos/test/public/integration/aggregateQuery.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,10 @@ describe("Aggregate Query", { timeout: 20000 }, () => {
393393
// If the fetch succeeds unexpectedly, fail the test
394394
assert.fail("Expected composite index not found error, but the fetch succeeded");
395395
} catch (error) {
396+
const stringifiedError = JSON.stringify(error);
396397
if (
397398
error instanceof Error &&
398-
error.message.includes(
399-
"The order by query does not have a corresponding composite index that it can be served from.",
400-
)
399+
stringifiedError.includes("does not have a corresponding composite index")
401400
) {
402401
// If the fetch fails as expected, pass the test
403402
} else {

sdk/cosmosdb/cosmos/vitest.int.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default mergeConfig(
1414
enabled: false,
1515
},
1616
fileParallelism: false,
17+
include: ["test/public/**/*.spec.ts"],
18+
exclude: ["test/internal/unit/**/*.spec.ts"],
1719
},
1820
}),
1921
);

0 commit comments

Comments
 (0)