Skip to content

Commit 0260808

Browse files
committed
chore: Fixed aws-sdk-v3 bedrock tests (again)
1 parent 050469e commit 0260808

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

test/versioned/aws-sdk-v3/bedrock-chat-completions.tap.js

+10-14
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,16 @@ const createAiResponseServer = require('../../lib/aws-server-stubs/ai-server')
1313
const { FAKE_CREDENTIALS } = require('../../lib/aws-server-stubs')
1414
const { DESTINATIONS } = require('../../../lib/config/attribute-filter')
1515

16-
const pkgVersion = (function () {
17-
try {
18-
const { version } = require('@smithy/smithy-client/package.json')
19-
return version
20-
} catch {
21-
try {
22-
const {
23-
version
24-
} = require('./node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json')
25-
return version
26-
} catch {}
27-
}
28-
/* eslint-disable-next-line */
29-
}())
16+
// The shim will utilize the version of `@smithy/smithy-client` that is required
17+
// by the `@aws-sdk/client-bedrock-runtime` module to set the version string
18+
// on metrics. So we want to require that specific version instead of the one
19+
// in our dependency tree. We can't use `require.resolve('mod', { paths: [] })`
20+
// here because that appends the paths to the lookup tree instead of prepending
21+
// them. Thus, we will still occasionally resolve to the module in our tree
22+
// instead of the one in the test suite's tree.
23+
const {
24+
version: pkgVersion
25+
} = require('./node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json')
3026

3127
const requests = {
3228
ai21: (prompt, modelId) => ({

0 commit comments

Comments
 (0)