Skip to content

Commit faf954c

Browse files
committed
Add release-value-with-quotes tests
1 parent b1d7e9b commit faf954c

25 files changed

Lines changed: 210 additions & 0 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const sentryConfig = {
2+
telemetry: false,
3+
release: {
4+
name: 'i am a dangerous release value because I contain a "',
5+
},
6+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as esbuild from "esbuild";
2+
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
3+
import { sentryConfig } from "../configs/release-value-with-quotes.config.js";
4+
5+
await esbuild.build({
6+
entryPoints: ["./src/release-value-with-quotes.js"],
7+
bundle: true,
8+
outfile: "./out/release-value-with-quotes/bundle.js",
9+
minify: false,
10+
format: "iife",
11+
plugins: [sentryEsbuildPlugin(sentryConfig)],
12+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expect } from "vitest";
2+
import { test } from "./utils";
3+
4+
test(import.meta.url, ({ runBundler, runFileInNode }) => {
5+
runBundler();
6+
const output = runFileInNode("bundle.js");
7+
expect(output.trimEnd()).toBe('"i am a dangerous release value because I contain a \\""');
8+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Simply output the metadata to the console so it can be checked in a test
2+
// eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access
3+
console.log(JSON.stringify(global.SENTRY_RELEASE.id));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
2+
import { defineConfig } from "rolldown";
3+
import { sentryConfig } from "../configs/release-value-with-quotes.config.js";
4+
5+
export default defineConfig({
6+
input: "src/release-value-with-quotes.js",
7+
output: {
8+
file: "out/release-value-with-quotes/bundle.js",
9+
format: "iife",
10+
},
11+
plugins: [sentryRollupPlugin(sentryConfig)],
12+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expect } from "vitest";
2+
import { test } from "./utils";
3+
4+
test(import.meta.url, ({ runBundler, runFileInNode }) => {
5+
runBundler();
6+
const output = runFileInNode("bundle.js");
7+
expect(output.trimEnd()).toBe('"i am a dangerous release value because I contain a \\""');
8+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Simply output the metadata to the console so it can be checked in a test
2+
// eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access
3+
console.log(JSON.stringify(global.SENTRY_RELEASE.id));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
2+
import { defineConfig } from "rollup";
3+
import { sentryConfig } from "../configs/release-value-with-quotes.config.js";
4+
5+
export default defineConfig({
6+
input: "src/release-value-with-quotes.js",
7+
output: {
8+
file: "out/release-value-with-quotes/bundle.js",
9+
format: "iife",
10+
},
11+
plugins: [sentryRollupPlugin(sentryConfig)],
12+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expect } from "vitest";
2+
import { test } from "./utils";
3+
4+
test(import.meta.url, ({ runBundler, runFileInNode }) => {
5+
runBundler();
6+
const output = runFileInNode("bundle.js");
7+
expect(output.trimEnd()).toBe('"i am a dangerous release value because I contain a \\""');
8+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Simply output the metadata to the console so it can be checked in a test
2+
// eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access
3+
console.log(JSON.stringify(global.SENTRY_RELEASE.id));

0 commit comments

Comments
 (0)