diff --git a/packages/webhook/package.json b/packages/webhook/package.json index b9f8f6fb8..6ccc68eda 100644 --- a/packages/webhook/package.json +++ b/packages/webhook/package.json @@ -37,8 +37,8 @@ "build:clean": "shx rm -rf ./dist", "docs": "npx typedoc --plugin typedoc-plugin-markdown", "prepack": "npm run build", - "test": "npm run build && node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/IncomingWebhook.test.ts", - "test:coverage": "npm run build && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/IncomingWebhook.test.ts" + "test": "npm run build && node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/*.test.ts", + "test:coverage": "npm run build && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/*.test.ts" }, "dependencies": { "@slack/types": "^2.20.1", diff --git a/packages/webhook/src/index.ts b/packages/webhook/src/index.ts index 74420ffba..8c3183fed 100644 --- a/packages/webhook/src/index.ts +++ b/packages/webhook/src/index.ts @@ -14,3 +14,5 @@ export { IncomingWebhookResult, IncomingWebhookSendArguments, } from './IncomingWebhook'; + +export {addAppMetadata} from './instrument'; \ No newline at end of file diff --git a/packages/webhook/src/instrument.test.ts b/packages/webhook/src/instrument.test.ts new file mode 100644 index 000000000..0b2e8380c --- /dev/null +++ b/packages/webhook/src/instrument.test.ts @@ -0,0 +1,16 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; + +import { addAppMetadata } from './index'; +import { getUserAgent } from './instrument'; + +describe('@slack/webhook public exports', () => { + it('exposes a working addAppMetadata from the package entry point', () => { + // addAppMetadata must be reachable from the package's public API (./index) and the instrument function. + addAppMetadata({ name: '@slack/slack-github-action', version: '3.0.3' }); + assert.ok( + getUserAgent().includes('@slack:slack-github-action/3.0.3'), + 'addAppMetadata re-exported from ./index should affect the User-Agent', + ); + }); +}); \ No newline at end of file