Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
41a6b67
test(node): New ee2e test runner
timfish Jan 9, 2024
abb74bf
Fix lint
timfish Jan 9, 2024
f15e1ad
Allow ignoring of specific envelope item types
timfish Jan 9, 2024
4da924f
Move `loggingTransport` to `@sentry-internal/node-integration-tests`
timfish Jan 9, 2024
005c65b
Allow building of types
timfish Jan 9, 2024
24a0b20
Longer tests
timfish Jan 9, 2024
fd992b4
fix lint
timfish Jan 9, 2024
111a7c2
Build utils before testing
timfish Jan 9, 2024
48587cd
Ensure e2e utils are cached on build
timfish Jan 9, 2024
120cc5b
support server in scenario and making requests to it
timfish Jan 9, 2024
af66eb4
Merge remote-tracking branch 'upstream/develop' into test/e2e-runner
timfish Jan 9, 2024
aec3278
remove the timeout overrides and add some more comments
timfish Jan 9, 2024
171abfb
swap test
timfish Jan 9, 2024
cfb7e0d
Push dummy test
timfish Jan 9, 2024
ff1f88a
dummy test
timfish Jan 9, 2024
97391ae
Reduce Anr hangs
timfish Jan 10, 2024
24309be
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
9ac27d6
Let the runner optionally do the assertions
timfish Jan 10, 2024
937c117
Merge remote-tracking branch 'origin/test/e2e-runner' into test/e2e-r…
timfish Jan 10, 2024
96d6db1
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
bf29936
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
ede8ad8
Fix lint
timfish Jan 10, 2024
800f886
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
eb32d5d
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
d2834a2
Merge remote-tracking branch 'origin/test/e2e-runner' into test/e2e-r…
timfish Jan 10, 2024
c36d147
Merge remote-tracking branch 'upstream/develop' into test/e2e-runner
timfish Jan 10, 2024
214cb8e
Merge branch 'develop' into test/e2e-runner
timfish Jan 10, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ env:

# packages/utils/cjs and packages/utils/esm: Symlinks to the folders inside of `build`, needed for tests
CACHED_BUILD_PATHS: |
${{ github.workspace }}/dev-packages/*/build
${{ github.workspace }}/packages/*/build
${{ github.workspace }}/packages/ember/*.d.ts
${{ github.workspace }}/packages/gatsby/*.d.ts
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
extends: ['../../.eslintrc.js'],
overrides: [
{
files: ['utils/**/*.ts'],
files: ['utils/**/*.ts', 'src/**/*.ts'],
parserOptions: {
project: ['tsconfig.json'],
sourceType: 'module',
Expand Down
9 changes: 9 additions & 0 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"node": ">=10"
},
"private": true,
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/src/index.d.ts",
"scripts": {
"build": "run-s build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:types": "tsc -p tsconfig.types.json",
"clean": "rimraf -g **/node_modules",
"prisma:init": "(cd suites/tracing/prisma-orm && ts-node ./setup.ts)",
"prisma:init:new": "(cd suites/tracing-new/prisma-orm && ts-node ./setup.ts)",
Expand All @@ -15,12 +22,14 @@
"type-check": "tsc",
"pretest": "run-s --silent prisma:init prisma:init:new",
"test": "ts-node ./utils/run-tests.ts",
"jest": "jest --config ./jest.config.js",
Copy link
Collaborator Author

@timfish timfish Jan 9, 2024

Choose a reason for hiding this comment

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

I added this simply because it allows you to call yarn jest -t "name-of-test" --verbose and get debug output very quickly from a single test. yarn test -t "name-of-test" runs through the existing custom test runner code and takes ages...

Hopefully we can migrate to just using the jest runner!

"test:watch": "yarn test --watch"
},
"dependencies": {
"@prisma/client": "3.15.2",
"@sentry/node": "7.93.0",
"@sentry/tracing": "7.93.0",
"@sentry/types": "7.93.0",
"@types/mongodb": "^3.6.20",
"@types/mysql": "^2.15.21",
"@types/pg": "^8.6.5",
Expand Down
3 changes: 3 additions & 0 deletions dev-packages/node-integration-tests/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';

export default makeNPMConfigVariants(makeBaseNPMConfig());
31 changes: 31 additions & 0 deletions dev-packages/node-integration-tests/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { AddressInfo } from 'net';
import type { BaseTransportOptions, Envelope, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { Express } from 'express';

/**
* Debug logging transport
*/
export function loggingTransport(_options: BaseTransportOptions): Transport {
return {
send(request: Envelope): Promise<void | TransportMakeRequestResponse> {
// eslint-disable-next-line no-console
console.log(JSON.stringify(request));
return Promise.resolve({ statusCode: 200 });
},
flush(): PromiseLike<boolean> {
return Promise.resolve(true);
},
};
}

/**
* Starts an express server and sends the port to the runner
*/
export function startExpressServerAndSendPortToRunner(app: Express): void {
const server = app.listen(0, () => {
const address = server.address() as AddressInfo;

// eslint-disable-next-line no-console
console.log(`{"port":${address.port}}`);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
debug: true,
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
});

function longWork() {
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
// eslint-disable-next-line no-unused-vars
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/suites/anr/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Sentry.init({
release: '1.0',
debug: true,
autoSessionTracking: false,
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
});

function longWork() {
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
// eslint-disable-next-line no-unused-vars
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/suites/anr/basic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Sentry.init({
release: '1.0',
debug: true,
autoSessionTracking: false,
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
});

function longWork() {
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
// eslint-disable-next-line no-unused-vars
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/suites/anr/forked.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Sentry.init({
release: '1.0',
debug: true,
autoSessionTracking: false,
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
});

function longWork() {
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
// eslint-disable-next-line no-unused-vars
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/suites/anr/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Sentry.init({
});

// eslint-disable-next-line deprecation/deprecation
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 200 }).then(() => {
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 100 }).then(() => {
function longWork() {
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 20; i++) {
const salt = crypto.randomBytes(128).toString('base64');
// eslint-disable-next-line no-unused-vars
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512');
Expand Down
Loading