Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ interface ReleaseManagementPluginOptions {
createDependencyOnSourcemapFiles: () => () => void;
}

/**
* Creates a plugin that creates releases, sets commits, deploys and finalizes releases.
*
* Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
*/
export function releaseManagementPlugin({
releaseName,
include,
Expand All @@ -47,7 +52,7 @@ export function releaseManagementPlugin({
}: ReleaseManagementPluginOptions): UnpluginOptions {
const freeGlobalDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
return {
name: "sentry-debug-id-upload-plugin",
name: "sentry-release-management-plugin",
async writeBundle() {
// It is possible that this writeBundle hook is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
Expand Down
14 changes: 14 additions & 0 deletions packages/esbuild-plugin/test/public-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { EsbuildPlugin } from "unplugin";
import { sentryEsbuildPlugin } from "../src";

test("Esbuild plugin should exist", () => {
expect(sentryEsbuildPlugin).toBeDefined();
expect(typeof sentryEsbuildPlugin).toBe("function");
});

describe("sentryEsbuildPlugin", () => {
it("returns an esbuild plugin", () => {
const plugins = sentryEsbuildPlugin({
authToken: "test-token",
org: "test-org",
project: "test-project",
}) as EsbuildPlugin;

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
expect(plugins).toEqual({ name: "unplugin-host-0", setup: expect.any(Function) });
});
});
24 changes: 24 additions & 0 deletions packages/rollup-plugin/test/public-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import { Plugin } from "rollup";
import { sentryRollupPlugin } from "../src";

test("Rollup plugin should exist", () => {
expect(sentryRollupPlugin).toBeDefined();
expect(typeof sentryRollupPlugin).toBe("function");
});

describe("sentryRollupPlugin", () => {
it("returns an array of rollup plugins", () => {
const plugins = sentryRollupPlugin({
authToken: "test-token",
org: "test-org",
project: "test-project",
}) as Plugin[];

expect(Array.isArray(plugins)).toBe(true);

const pluginNames = plugins.map((plugin) => plugin.name);

expect(pluginNames).toEqual([
"sentry-telemetry-plugin",
"sentry-rollup-release-injection-plugin",
"sentry-release-management-plugin",
"sentry-rollup-debug-id-injection-plugin",
"sentry-rollup-debug-id-upload-plugin",
"sentry-file-deletion-plugin",
]);
});
});
24 changes: 24 additions & 0 deletions packages/vite-plugin/test/public-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import { VitePlugin } from "unplugin";
import { sentryVitePlugin } from "../src";

test("Vite plugin should exist", () => {
expect(sentryVitePlugin).toBeDefined();
expect(typeof sentryVitePlugin).toBe("function");
});

describe("sentryVitePlugin", () => {
it("returns an array of Vite plugins", () => {
const plugins = sentryVitePlugin({
authToken: "test-token",
org: "test-org",
project: "test-project",
}) as VitePlugin[];

expect(Array.isArray(plugins)).toBe(true);

const pluginNames = plugins.map((plugin) => plugin.name);

expect(pluginNames).toEqual([
"sentry-telemetry-plugin",
"sentry-vite-release-injection-plugin",
"sentry-release-management-plugin",
"sentry-vite-debug-id-injection-plugin",
"sentry-vite-debug-id-upload-plugin",
"sentry-file-deletion-plugin",
]);
});
});
14 changes: 14 additions & 0 deletions packages/webpack-plugin/test/public-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { Plugin } from "webpack";
import { sentryWebpackPlugin } from "../src";

test("Webpack plugin should exist", () => {
expect(sentryWebpackPlugin).toBeDefined();
expect(typeof sentryWebpackPlugin).toBe("function");
});

describe("sentryWebpackPlugin", () => {
it("returns a webpack plugin", () => {
const plugin = sentryWebpackPlugin({
authToken: "test-token",
org: "test-org",
project: "test-project",
}) as Plugin;

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
expect(plugin).toEqual({ apply: expect.any(Function) });
});
});
Loading