Skip to content

Commit

Permalink
test(browser): Remove unused webpack build tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad committed Jul 18, 2024
1 parent d70182e commit 5bf6015
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 1,229 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/* eslint-disable no-console */
const Sentry = require('../../build/npm/cjs/index.js');

// Init
Sentry.init({
dsn: 'https://[email protected]/42',
beforeSend(_event) {
console.log('Got an event');
return null;
},
beforeBreadcrumb(crumb) {
console.log(`Got a breadcrumb: ${crumb.category}`);
return crumb;
},
});

// Configure
const scope = Sentry.getCurrentScope();
scope.setExtra('foo', 'bar');
scope.setFingerprint('foo');
Expand Down Expand Up @@ -75,6 +58,6 @@ Sentry.withScope(scope => {

var xhr = new XMLHttpRequest();
xhr.onload = () => console.log('loaded'); // This throws error
// xhr.addEventListener("load", () => console.log('loaded')); This does not throw error
xhr.addEventListener('load', () => console.log('loaded')); // This does not throw error
xhr.open('GET', 'https://httpbin.org/get');
xhr.send();
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as fs from 'node:fs';
import * as path from 'node:path';

import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';

// Regression test against https://github.com/getsentry/sentry-javascript/pull/1896
sentryTest('should not contain tslib_1__default', async ({ getLocalTestPath }) => {
await getLocalTestPath({ testDir: __dirname });

const initBundle = fs.readFileSync(path.join(__dirname, 'dist', 'init.bundle.js'), 'utf-8');
expect(initBundle.length).toBeGreaterThan(0);
expect(initBundle).not.toContain('tslib_1__default');

const subjectBundle = fs.readFileSync(path.join(__dirname, 'dist', 'subject.bundle.js'), 'utf-8');
expect(subjectBundle.length).toBeGreaterThan(0);
expect(subjectBundle).not.toContain('tslib_1__default');
});
3 changes: 1 addition & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
},
"devDependencies": {
"@sentry-internal/integration-shims": "8.18.0",
"fake-indexeddb": "^4.0.1",
"webpack": "^4.47.0"
"fake-indexeddb": "^6.0.0"
},
"scripts": {
"build": "run-p build:transpile build:bundle build:types",
Expand Down
69 changes: 0 additions & 69 deletions packages/browser/test/package/npm-build.js

This file was deleted.

Loading

0 comments on commit 5bf6015

Please sign in to comment.