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
35 changes: 29 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,36 @@ jobs:
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
- name: Use build cache
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifacts-${{ github.run_id }}
path: packages
- run: yarn test:integration

test-integration-next:
needs: build
name: "Integration Tests Next (Node ${{ matrix.node-version }}, OS ${{ matrix.os }})"
strategy:
fail-fast: false
matrix:
node-version: [18, 20, 22, 24]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Use dependency cache
uses: actions/cache@v4
id: dependency-cache
with:
path: .nxcache
key: build-cache-key-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
build-cache-key-${{ runner.os }}-
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
if: steps.dependency-cache.outputs.cache-hit != 'true'
Expand All @@ -160,7 +183,7 @@ jobs:
with:
name: dist-artifacts-${{ github.run_id }}
path: packages
- run: yarn test:integration
- run: yarn test:integration-next

test-e2e:
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.defaultFormatter": "oxc.oxc-vscode"
}
19 changes: 10 additions & 9 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/*.js", "{workspaceRoot}/*.json", "{workspaceRoot}/yarn.lock"]
},
"targetDefaults": {
"build": {
"inputs": ["sharedGlobals"],
"inputs": ["default"],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist"],
"cache": true
},
"lint": {
"inputs": ["sharedGlobals"],
"inputs": ["default"],
"dependsOn": ["^build", "build"],
"outputs": [],
"cache": true
},
"test": {
"inputs": ["sharedGlobals"],
"outputs": [],
"cache": true
"inputs": ["default"],
"cache": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: That is intentional I guess?

Copy link
Collaborator Author

@timfish timfish Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intentional but this probably needs revising too.

I was changing the integration tests and re-running and it was hitting the cache.

Should we ever cache test output?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No let's not

},
"check:types": {
"inputs": ["sharedGlobals"],
"dependsOn": ["^build"],
"outputs": []
"inputs": ["default"],
"dependsOn": ["^build"]
},
"build:npm": {
"dependsOn": ["build", "^build"]
Expand All @@ -33,5 +31,8 @@
"cacheDirectory": ".nxcache",
"tui": {
"autoExit": true
},
"nxCloudOptions": {
"detectFlakyTasks": false
}
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
"packages/rollup-plugin",
"packages/tsconfigs",
"packages/vite-plugin",
"packages/webpack-plugin"
"packages/webpack-plugin",
"packages/integration-tests-next",
"packages/integration-tests-next/fixtures/rolldown"
],
"scripts": {
"postinstall": "patch-package",
"build": "nx run-many --target=build --all",
"build:watch": "nx run-many --target=build:watch --all",
"build:graph": "nx graph",
Expand All @@ -29,8 +32,9 @@
"clean:all": "nx run-many --target=clean:all --all && yarn",
"test": "nx run-many --target=test --all --exclude=@sentry-internal/bundler-plugin-e2e-tests",
"test:all": "nx run-many --target=test --all",
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/bundler-plugin-e2e-tests",
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next,@sentry-internal/bundler-plugin-e2e-tests",
"test:integration": "nx run @sentry-internal/integration-tests:test",
"test:integration-next": "nx run @sentry-internal/integration-tests-next:test",
"test:e2e": "nx run @sentry-internal/bundler-plugin-e2e-tests:test",
"lint": "nx run-many --target=lint --all",
"check:formatting": "oxfmt --check .",
Expand All @@ -41,7 +45,8 @@
"npm-run-all": "^4.1.5",
"nx": "22.5.2",
"oxfmt": "^0.33.0",
"ts-node": "^10.9.2"
"ts-node": "^10.9.2",
"patch-package": "^8.0.1"
},
"volta": {
"node": "22.22.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-component-annotate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"eslint": "^8.18.0",
"vitest": "^4.0.0",
"premove": "^4.0.0",
"rolldown": "^1.0.0-rc.4",
"rolldown": "^1.0.0-rc.6",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"eslint": "^8.18.0",
"vitest": "^4.0.0",
"premove": "^4.0.0",
"rolldown": "^1.0.0-rc.4",
"rolldown": "^1.0.0-rc.6",
"typescript": "^4.7.4"
},
"volta": {
Expand Down
9 changes: 9 additions & 0 deletions packages/bundler-plugin-core/src/sentry/transports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ export function makeOptionallyEnabledNodeTransport(
}

if (await shouldSendTelemetry) {
if (process.env["SENTRY_TEST_OUT_DIR"]) {
// eslint-disable-next-line @typescript-eslint/unbound-method
const { join } = await import("node:path");
const { appendFileSync } = await import("node:fs");
const path = join(process.env["SENTRY_TEST_OUT_DIR"], "sentry-telemetry.json");
appendFileSync(path, JSON.stringify(request) + ",\n");
return { statusCode: 200 };
}
Comment on lines +122 to +129
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: Not blocking but would there be a way around this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a mock server but spent too long trying to get it working and then found we already did something similar above for the existing integration tests.

I will revisit this though!


return nodeTransport.send(request);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint": "^8.18.0",
"vitest": "^4.0.0",
"premove": "^4.0.0",
"rolldown": "^1.0.0-rc.4",
"rolldown": "^1.0.0-rc.6",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
},
Expand Down
16 changes: 16 additions & 0 deletions packages/integration-tests-next/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type {import('eslint').ESLint.Options} */
module.exports = {
root: true,
extends: ["@sentry-internal/eslint-config/base"],
ignorePatterns: [".eslintrc.js", "fixtures/*/out", "fixtures/*/src"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
env: {
node: true,
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
},
};
1 change: 1 addition & 0 deletions packages/integration-tests-next/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fixtures/*/out/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/after-upload-deletion/basic.js",
sourcemap: true,
},
plugins: [
sentryRollupPlugin({
telemetry: false,
sourcemaps: {
filesToDeleteAfterUpload: ["out/after-upload-deletion/basic.js.map"],
},
}),
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => {
runRolldown();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "//#region src/basic.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");

//#endregion
//# sourceMappingURL=basic.js.map",
}
`);

const output = runFileInNode("basic.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/application-key/basic.js",
},
plugins: [sentryRollupPlugin({ telemetry: false, applicationKey: "1234567890abcdef" })],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runRolldown, readOutputFiles }) => {
runRolldown();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "//#region src/basic.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];if(null!=a)for(var t in a)a.hasOwnProperty(t)&&(e[t]=a[t])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:1234567890abcdef":true});var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");

//#endregion",
}
`);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/basic-release-disabled/basic.js",
},
plugins: [sentryRollupPlugin({ telemetry: false, release: { create: false, inject: false } })],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runRolldown, readOutputFiles }) => {
runRolldown();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "//#region src/basic.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");

//#endregion",
}
`);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/basic-sourcemaps/basic.js",
sourcemap: true,
},
plugins: [
sentryRollupPlugin({
telemetry: false,
authToken: "fake-auth",
org: "fake-org",
project: "fake-project",
}),
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => {
runRolldown();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "//#region src/basic.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");

//#endregion
//# sourceMappingURL=basic.js.map",
"basic.js.map": "{"version":3,"file":"basic.js","names":[],"sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"mappings":";scACA,OAAA,CAAQ,GAAA,CAAI,CAAA,KAAA,CAAA,KAAA,CAAA,CAAc"}",
"sentry-cli-mock.json": "["releases","new","CURRENT_SHA"],
["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"],
["releases","finalize","CURRENT_SHA"],
["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"],
",
}
`);

const output = runFileInNode("basic.js");
expect(output).toBe("hello world\n");
});
17 changes: 17 additions & 0 deletions packages/integration-tests-next/fixtures/rolldown/basic.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/basic/basic.js",
},
plugins: [
sentryRollupPlugin({
telemetry: false,
authToken: "fake-auth",
org: "fake-org",
project: "fake-project",
}),
],
});
22 changes: 22 additions & 0 deletions packages/integration-tests-next/fixtures/rolldown/basic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => {
runRolldown();
expect(readOutputFiles()).toMatchInlineSnapshot(`
{
"basic.js": "//#region src/basic.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b699d9c1-b033-4536-aa25-233c92609b54",e._sentryDebugIdIdentifier="sentry-dbid-b699d9c1-b033-4536-aa25-233c92609b54");}catch(e){}}();console.log("hello world");

//#endregion",
"sentry-cli-mock.json": "["releases","new","CURRENT_SHA"],
["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"],
["releases","finalize","CURRENT_SHA"],
["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"],
",
}
`);

const output = runFileInNode("basic.js");
expect(output).toBe("hello world\n");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "rolldown";

export default defineConfig({
input: "src/basic.js",
output: {
file: "out/build-info/basic.js",
},
plugins: [
sentryRollupPlugin({
telemetry: false,
release: {
name: "build-information-injection-test",
},
_experiments: { injectBuildInformation: true },
}),
],
});
Loading
Loading