diff --git a/package.json b/package.json index eaa805956..a5573c8dd 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "test:unit:coverage": "vitest run --coverage", "test-ci": "run-s test:*", "testu": "cross-env SOCKET_CLI_NO_API_TOKEN=1 run-s test:prepare; npm run test:unit:update --", + "testuf": "SOCKET_CLI_NO_API_TOKEN=1 npm run test:unit:update --", "update": "run-p --aggregate-output update:**", "update:deps": "npx --yes npm-check-updates" }, diff --git a/src/commands/analytics/cmd-analytics.test.ts b/src/commands/analytics/cmd-analytics.test.ts new file mode 100644 index 000000000..76f962436 --- /dev/null +++ b/src/commands/analytics/cmd-analytics.test.ts @@ -0,0 +1,73 @@ +import path from 'node:path' + +import { describe, expect } from 'vitest' + +import constants from '../../../dist/constants.js' +import { cmdit, invokeNpm } from '../../../test/utils' + +const { CLI } = constants + +describe('socket analytics', async () => { + // Lazily access constants.rootBinPath. + const entryPath = path.join(constants.rootBinPath, `${CLI}.js`) + + cmdit(['analytics', '--help'], 'should support --help', async cmd => { + const { code, stderr, stdout } = await invokeNpm(entryPath, cmd) + expect(stdout).toMatchInlineSnapshot( + ` + "Look up analytics data + + Usage + $ socket analytics --scope= --time=