-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(browser): Remove unused webpack build tests
- Loading branch information
1 parent
ac6e2f1
commit a323292
Showing
9 changed files
with
91 additions
and
1,286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
|
@@ -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(); |
19 changes: 19 additions & 0 deletions
19
dev-packages/browser-integration-tests/suites/public-api/init/built-pkg/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as fs from 'node:fs'; | ||
import * as path from 'node:path'; | ||
|
||
const testStrings = ['/// <reference types="node" />']; | ||
|
||
const paths = [path.join('./build/cjs'), path.join('./build/esm')]; | ||
|
||
test('typedef', () => { | ||
paths.forEach(dir => { | ||
if (!fs.existsSync(dir)) { | ||
throw new Error(`${dir} doesn't exist please build first`); | ||
} | ||
const files = fs.readdirSync(dir); | ||
files.forEach(file => { | ||
if (file.includes('.d.ts')) { | ||
testStrings.forEach(testString => { | ||
const filePath = path.join(dir, file); | ||
if (fs.readFileSync(filePath, 'utf8').includes(testString)) { | ||
throw new Error(`${filePath} contains types`); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.