Skip to content

Commit ef7d97f

Browse files
authored
test: New integration tests (#896)
1 parent bdc5345 commit ef7d97f

File tree

61 files changed

+1256
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1256
-121
lines changed

.github/workflows/checks.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,36 @@ jobs:
145145
with:
146146
path: "**/node_modules"
147147
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
148-
- name: Use build cache
148+
- name: Install dependencies
149+
run: yarn --frozen-lockfile --ignore-engines
150+
if: steps.dependency-cache.outputs.cache-hit != 'true'
151+
- name: Download build artifacts
152+
uses: actions/download-artifact@v4
153+
with:
154+
name: dist-artifacts-${{ github.run_id }}
155+
path: packages
156+
- run: yarn test:integration
157+
158+
test-integration-next:
159+
needs: build
160+
name: "Integration Tests Next (Node ${{ matrix.node-version }}, OS ${{ matrix.os }})"
161+
strategy:
162+
fail-fast: false
163+
matrix:
164+
node-version: [18, 20, 22, 24]
165+
os: [ubuntu-latest, windows-latest]
166+
runs-on: ${{ matrix.os }}
167+
steps:
168+
- uses: actions/checkout@v4
169+
- uses: actions/setup-node@v4
170+
with:
171+
node-version: ${{ matrix.node-version }}
172+
- name: Use dependency cache
149173
uses: actions/cache@v4
174+
id: dependency-cache
150175
with:
151-
path: .nxcache
152-
key: build-cache-key-${{ runner.os }}-${{ github.run_id }}
153-
restore-keys: |
154-
build-cache-key-${{ runner.os }}-
176+
path: "**/node_modules"
177+
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
155178
- name: Install dependencies
156179
run: yarn --frozen-lockfile --ignore-engines
157180
if: steps.dependency-cache.outputs.cache-hit != 'true'
@@ -160,7 +183,7 @@ jobs:
160183
with:
161184
name: dist-artifacts-${{ github.run_id }}
162185
path: packages
163-
- run: yarn test:integration
186+
- run: yarn test:integration-next
164187

165188
test-e2e:
166189
# 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

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"editor.defaultFormatter": "oxc.oxc-vscode",
2+
"editor.defaultFormatter": "oxc.oxc-vscode"
33
}

nx.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
{
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
33
"namedInputs": {
4+
"default": ["{projectRoot}/**/*", "sharedGlobals"],
45
"sharedGlobals": ["{workspaceRoot}/*.js", "{workspaceRoot}/*.json", "{workspaceRoot}/yarn.lock"]
56
},
67
"targetDefaults": {
78
"build": {
8-
"inputs": ["sharedGlobals"],
9+
"inputs": ["default"],
910
"dependsOn": ["^build"],
1011
"outputs": ["{projectRoot}/dist"],
1112
"cache": true
1213
},
1314
"lint": {
14-
"inputs": ["sharedGlobals"],
15+
"inputs": ["default"],
1516
"dependsOn": ["^build", "build"],
16-
"outputs": [],
1717
"cache": true
1818
},
1919
"test": {
20-
"inputs": ["sharedGlobals"],
21-
"outputs": [],
22-
"cache": true
20+
"inputs": ["default"],
21+
"cache": false
2322
},
2423
"check:types": {
25-
"inputs": ["sharedGlobals"],
26-
"dependsOn": ["^build"],
27-
"outputs": []
24+
"inputs": ["default"],
25+
"dependsOn": ["^build"]
2826
},
2927
"build:npm": {
3028
"dependsOn": ["build", "^build"]
@@ -33,5 +31,8 @@
3331
"cacheDirectory": ".nxcache",
3432
"tui": {
3533
"autoExit": true
34+
},
35+
"nxCloudOptions": {
36+
"detectFlakyTasks": false
3637
}
3738
}

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
"packages/rollup-plugin",
1818
"packages/tsconfigs",
1919
"packages/vite-plugin",
20-
"packages/webpack-plugin"
20+
"packages/webpack-plugin",
21+
"packages/integration-tests-next",
22+
"packages/integration-tests-next/fixtures/rolldown"
2123
],
2224
"scripts": {
25+
"postinstall": "patch-package",
2326
"build": "nx run-many --target=build --all",
2427
"build:watch": "nx run-many --target=build:watch --all",
2528
"build:graph": "nx graph",
@@ -29,8 +32,9 @@
2932
"clean:all": "nx run-many --target=clean:all --all && yarn",
3033
"test": "nx run-many --target=test --all --exclude=@sentry-internal/bundler-plugin-e2e-tests",
3134
"test:all": "nx run-many --target=test --all",
32-
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/bundler-plugin-e2e-tests",
35+
"test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next,@sentry-internal/bundler-plugin-e2e-tests",
3336
"test:integration": "nx run @sentry-internal/integration-tests:test",
37+
"test:integration-next": "nx run @sentry-internal/integration-tests-next:test",
3438
"test:e2e": "nx run @sentry-internal/bundler-plugin-e2e-tests:test",
3539
"lint": "nx run-many --target=lint --all",
3640
"check:formatting": "oxfmt --check .",
@@ -41,7 +45,8 @@
4145
"npm-run-all": "^4.1.5",
4246
"nx": "22.5.2",
4347
"oxfmt": "^0.33.0",
44-
"ts-node": "^10.9.2"
48+
"ts-node": "^10.9.2",
49+
"patch-package": "^8.0.1"
4550
},
4651
"volta": {
4752
"node": "22.22.0",

packages/babel-plugin-component-annotate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"eslint": "^8.18.0",
5959
"vitest": "^4.0.0",
6060
"premove": "^4.0.0",
61-
"rolldown": "^1.0.0-rc.4",
61+
"rolldown": "^1.0.0-rc.6",
6262
"ts-node": "^10.9.1",
6363
"typescript": "^4.7.4"
6464
},

packages/bundler-plugin-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"eslint": "^8.18.0",
7373
"vitest": "^4.0.0",
7474
"premove": "^4.0.0",
75-
"rolldown": "^1.0.0-rc.4",
75+
"rolldown": "^1.0.0-rc.6",
7676
"typescript": "^4.7.4"
7777
},
7878
"volta": {

packages/bundler-plugin-core/src/sentry/transports.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ export function makeOptionallyEnabledNodeTransport(
119119
}
120120

121121
if (await shouldSendTelemetry) {
122+
if (process.env["SENTRY_TEST_OUT_DIR"]) {
123+
// eslint-disable-next-line @typescript-eslint/unbound-method
124+
const { join } = await import("node:path");
125+
const { appendFileSync } = await import("node:fs");
126+
const path = join(process.env["SENTRY_TEST_OUT_DIR"], "sentry-telemetry.json");
127+
appendFileSync(path, JSON.stringify(request) + ",\n");
128+
return { statusCode: 200 };
129+
}
130+
122131
return nodeTransport.send(request);
123132
}
124133

packages/esbuild-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"eslint": "^8.18.0",
5858
"vitest": "^4.0.0",
5959
"premove": "^4.0.0",
60-
"rolldown": "^1.0.0-rc.4",
60+
"rolldown": "^1.0.0-rc.6",
6161
"ts-node": "^10.9.1",
6262
"typescript": "^4.7.4"
6363
},
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/** @type {import('eslint').ESLint.Options} */
2+
module.exports = {
3+
root: true,
4+
extends: ["@sentry-internal/eslint-config/base"],
5+
ignorePatterns: [".eslintrc.js", "fixtures/*/out", "fixtures/*/src"],
6+
parserOptions: {
7+
tsconfigRootDir: __dirname,
8+
project: ["./tsconfig.json"],
9+
},
10+
env: {
11+
node: true,
12+
},
13+
rules: {
14+
"@typescript-eslint/explicit-function-return-type": "off",
15+
},
16+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fixtures/*/out/**

0 commit comments

Comments
 (0)