Skip to content

Commit 6e35f2e

Browse files
committed
Merge branch 'master' into abhi-reset-idletimeout
2 parents e68a672 + 7525490 commit 6e35f2e

File tree

52 files changed

+456
-699
lines changed

Some content is hidden

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

52 files changed

+456
-699
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,26 @@ jobs:
276276
${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
277277
278278
job_browser_playwright_tests:
279-
name: Browser Playwright Tests
279+
name: Browser Playwright Tests (${{ matrix.bundle }} - tracing_only = ${{ matrix.tracing_only }})
280280
needs: job_build
281281
runs-on: ubuntu-latest
282+
strategy:
283+
matrix:
284+
bundle:
285+
- esm
286+
- cjs
287+
- bundle_es5
288+
- bundle_es5_min
289+
- bundle_es6
290+
- bundle_es6_min
291+
tracing_only:
292+
- true
293+
- false
294+
exclude:
295+
- bundle: esm
296+
tracing_only: true
297+
- bundle: cjs
298+
tracing_only: true
282299
steps:
283300
- name: Check out current commit (${{ github.sha }})
284301
uses: actions/checkout@v2
@@ -297,6 +314,9 @@ jobs:
297314
path: ${{ env.CACHED_BUILD_PATHS }}
298315
key: ${{ env.BUILD_CACHE_KEY }}
299316
- name: Run Playwright tests
317+
env:
318+
PW_BUNDLE: ${{ matrix.bundle }}
319+
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
300320
run: |
301321
cd packages/integration-tests
302322
yarn run playwright install-deps webkit

packages/browser/rollup.config.js

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { terser } from 'rollup-plugin-terser';
22
import typescript from 'rollup-plugin-typescript2';
3-
import license from 'rollup-plugin-license';
4-
import resolve from '@rollup/plugin-node-resolve';
5-
import replace from '@rollup/plugin-replace';
63

7-
const commitHash = require('child_process')
8-
.execSync('git rev-parse --short HEAD', { encoding: 'utf-8' })
9-
.trim();
4+
import {
5+
baseBundleConfig,
6+
makeLicensePlugin,
7+
markAsBrowserBuild,
8+
nodeResolvePlugin,
9+
paths,
10+
typescriptPluginES5,
11+
} from '../../rollup.config';
12+
13+
const licensePlugin = makeLicensePlugin();
1014

1115
const terserInstance = terser({
1216
compress: {
@@ -37,60 +41,23 @@ const terserInstance = terser({
3741
},
3842
});
3943

40-
const paths = {
41-
'@sentry/utils': ['../utils/src'],
42-
'@sentry/core': ['../core/src'],
43-
'@sentry/hub': ['../hub/src'],
44-
'@sentry/types': ['../types/src'],
45-
'@sentry/minimal': ['../minimal/src'],
46-
};
47-
4844
const plugins = [
49-
typescript({
50-
tsconfig: 'tsconfig.esm.json',
51-
tsconfigOverride: {
52-
compilerOptions: {
53-
declaration: false,
54-
declarationMap: false,
55-
paths,
56-
baseUrl: '.',
57-
},
58-
},
59-
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
60-
}),
61-
replace({
62-
// don't replace `__placeholder__` where it's followed immediately by a single `=` (to prevent ending up
63-
// with something of the form `let "replacementValue" = "some assigned value"`, which would cause a
64-
// syntax error)
65-
preventAssignment: true,
66-
// the replacements to make
67-
values: {
68-
__SENTRY_BROWSER_BUNDLE__: true,
69-
},
70-
}),
71-
resolve({
72-
mainFields: ['module'],
73-
}),
45+
typescriptPluginES5,
46+
// replace `__SENTRY_BROWSER_BUNDLE__` with `true` to enable treeshaking of non-browser code
47+
markAsBrowserBuild,
48+
nodeResolvePlugin,
7449
];
7550

7651
const bundleConfig = {
52+
...baseBundleConfig,
7753
input: 'src/index.ts',
7854
output: {
55+
...baseBundleConfig.output,
7956
format: 'iife',
8057
name: 'Sentry',
81-
sourcemap: true,
82-
strict: false,
83-
esModule: false,
8458
},
8559
context: 'window',
86-
plugins: [
87-
...plugins,
88-
license({
89-
sourcemap: true,
90-
banner: `/*! @sentry/browser <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/sentry-javascript */`,
91-
}),
92-
],
93-
treeshake: 'smallest',
60+
plugins: [...plugins, licensePlugin],
9461
};
9562

9663
export default [
@@ -109,10 +76,7 @@ export default [
10976
file: 'build/bundle.min.js',
11077
},
11178
// Uglify has to be at the end of compilation, BUT before the license banner
112-
plugins: bundleConfig.plugins
113-
.slice(0, -1)
114-
.concat(terserInstance)
115-
.concat(bundleConfig.plugins.slice(-1)),
79+
plugins: bundleConfig.plugins.slice(0, -1).concat(terserInstance).concat(bundleConfig.plugins.slice(-1)),
11680
},
11781
// ------------------
11882
// ES6 Browser Bundle
@@ -159,11 +123,7 @@ export default [
159123
},
160124
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
161125
}),
162-
...plugins
163-
.slice(1)
164-
.slice(0, -1)
165-
.concat(terserInstance)
166-
.concat(bundleConfig.plugins.slice(-1)),
126+
...plugins.slice(1).slice(0, -1).concat(terserInstance).concat(bundleConfig.plugins.slice(-1)),
167127
],
168128
},
169129
// ------------------

packages/integration-tests/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ To filter tests by their title:
5656

5757
You can refer to [Playwright documentation](https://playwright.dev/docs/test-cli) for other CLI options.
5858

59+
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against.
60+
Available options: `esm`, `cjs`, `bundle_es5`, `bundle_es5_min`, `bundle_es6`, `bundle_es6_min`
61+
5962
### Troubleshooting
6063

6164
Apart from [Playwright-specific issues](https://playwright.dev/docs/troubleshooting), below are common issues that might occur while writing tests for Sentry Browser SDK.

packages/integration-tests/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@
1313
"lint": "run-s lint:prettier lint:eslint",
1414
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
1515
"lint:prettier": "prettier --check \"{suites,utils}/**/*.ts\"",
16-
"test:ci": "playwright test ./suites --browser='all' --reporter='line'",
1716
"type-check": "tsc",
1817
"pretest": "yarn clean && yarn type-check",
19-
"test": "playwright test ./suites"
18+
"test": "playwright test ./suites",
19+
"test:bundle:es5": "PW_BUNDLE=bundle_es5 yarn test",
20+
"test:bundle:es5:min": "PW_BUNDLE=bundle_es5_min yarn test",
21+
"test:bundle:es6": "PW_BUNDLE=bundle_es6 yarn test",
22+
"test:bundle:es6:min": "PW_BUNDLE=bundle_es6_min yarn test",
23+
"test:cjs": "PW_BUNDLE=cjs yarn test",
24+
"test:esm": "PW_BUNDLE=esm yarn test",
25+
"test:ci": "playwright test ./suites --browser='all' --reporter='line'"
2026
},
2127
"dependencies": {
2228
"@babel/preset-typescript": "^7.16.7",
2329
"@playwright/test": "^1.17.0",
2430
"babel-loader": "^8.2.2",
25-
"handlebars-loader": "^1.7.1",
2631
"html-webpack-plugin": "^5.5.0",
2732
"playwright": "^1.17.1",
2833
"typescript": "^4.5.2",

packages/integration-tests/suites/public-api/addBreadcrumb/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/captureException/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/captureMessage/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/configureScope/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setContext/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setExtra/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setExtras/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setTag/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setTags/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/setUser/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/showReportDialog/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/startTransaction/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/public-api/withScope/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/integration-tests/suites/sessions/start-session/template.hbs

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8" />
4+
</head>
5+
<body>
6+
<a id='navigate' href="foo">Navigate</button>
7+
</body>
8+
</html>

packages/integration-tests/suites/sessions/update-session/template.hbs

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8" />
4+
</head>
5+
<body>
6+
<button id="throw-error">Throw Error</button>
7+
<button id="capture-exception">Capture Exception</button>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)