Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 19 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ on:
pull_request:

jobs:
build:
test_linux:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand All @@ -33,9 +33,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g npm@8
Expand All @@ -44,3 +44,17 @@ jobs:
- run: npm run lint
- run: npm run format:check
- run: npm test

test_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run format:check
- run: npm test
4 changes: 2 additions & 2 deletions .prettierrc → .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"printWidth": 120,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"tabWidth": 4
"tabWidth": 4,
"endOfLine": "auto"
}
2 changes: 1 addition & 1 deletion examples/sdk/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"start": "NODE_ENV=production node ./lib/index.js",
"start": "cross-env NODE_ENV=production node ./lib/index.js",
"watch": "tsc -w"
},
"repository": {
Expand Down
45 changes: 40 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@
"@types/semver": "^7.5.3",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"cross-env": "^7.0.3",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-local-rules": "^1.3.2",
"prettier": "^2.8.8",
"prettier": "^3.3.2",
"rimraf": "^5.0.1",
"semver": "^7.5.4",
"ts-node": "^10.9.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf common main renderer",
"format": "prettier --write '**/*.ts'",
"lint": "eslint src --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest --passWithNoTests"
"test": "cross-env NODE_ENV=test jest --passWithNoTests"
},
"keywords": [
"Error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export interface WindowAttributeProviderOptions {
}

export class WindowAttributeProvider implements BacktraceAttributeProvider {
constructor(private readonly _window: BrowserWindow, private readonly _options?: WindowAttributeProviderOptions) {}
constructor(
private readonly _window: BrowserWindow,
private readonly _options?: WindowAttributeProviderOptions,
) {}

public readonly type = 'dynamic';

Expand Down
6 changes: 5 additions & 1 deletion packages/electron/src/main/ipc/ReadableIpcStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { ipcHandshake } from '../../common/ipc/ipcHandshake';
export class ReadableIpcStream extends Readable {
private _isConnected = false;

constructor(private readonly _name: string, private readonly _ipc: IpcTransport, opts?: ReadableOptions) {
constructor(
private readonly _name: string,
private readonly _ipc: IpcTransport,
opts?: ReadableOptions,
) {
super(opts);

const close = () => this.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ export class BacktraceMainElectronModule implements BacktraceModule {
}

function toStringDictionary(record: Record<string, unknown>): Record<string, string> {
return Object.keys(record).reduce((obj, key) => {
obj[key] = record[key]?.toString() ?? '';
return obj;
}, {} as Record<string, string>);
return Object.keys(record).reduce(
(obj, key) => {
obj[key] = record[key]?.toString() ?? '';
return obj;
},
{} as Record<string, string>,
);
}
6 changes: 5 additions & 1 deletion packages/electron/src/main/modules/IpcAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { IpcTransport } from '../../common';
import { ReadableIpcStream } from '../ipc/ReadableIpcStream';

export class IpcAttachment implements BacktraceAttachment {
constructor(public readonly name: string, private readonly _id: string, private readonly _ipc: IpcTransport) {}
constructor(
public readonly name: string,
private readonly _id: string,
private readonly _ipc: IpcTransport,
) {}

public get(): Readable {
return new ReadableIpcStream(this._id, this._ipc);
Expand Down
5 changes: 4 additions & 1 deletion packages/electron/src/renderer/ipc/WritableIpcStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export class WritableIpcStream<W> extends WritableStream<W> {
class WritableIpcStreamSink<W> implements UnderlyingSink<W> {
private _isPaused = false;

constructor(private readonly _name: string, private readonly _ipc: IpcTransport) {
constructor(
private readonly _name: string,
private readonly _ipc: IpcTransport,
) {
this._ipc.on(IpcEvents.streamEvent(_name, 'pause'), () => (this._isPaused = true));
this._ipc.on(IpcEvents.streamEvent(_name, 'resume'), () => (this._isPaused = false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { IpcRpc } from '../../common/ipc/IpcRpc';
import { WritableIpcStream } from '../ipc/WritableIpcStream';

export class IpcReportSubmission implements BacktraceReportSubmission {
constructor(private readonly _ipcRpc: IpcRpc, private readonly _ipcTransport: IpcTransport) {}
constructor(
private readonly _ipcRpc: IpcRpc,
private readonly _ipcTransport: IpcTransport,
) {}

public send(
data: BacktraceData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export class IpcSummedMetricsQueue implements MetricsQueue<SummedEvent> {
public readonly submissionUrl = '';
public readonly maximumEvents = -1;

constructor(private readonly _ipcTransport: IpcTransport, private readonly _ipcRpc: IpcRpc) {}
constructor(
private readonly _ipcTransport: IpcTransport,
private readonly _ipcRpc: IpcRpc,
) {}

public add(event: SummedEvent): void {
this._ipcTransport.emit(IpcEvents.addSummedMetric, event);
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest --passWithNoTests"
"test": "cross-env NODE_ENV=test jest --passWithNoTests"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"clean": "rimraf \"lib\"",
"format": "prettier --write '**/*.ts'",
"lint": "eslint . --ext .ts",
"prepublishOnly": "NODE_ENV=production npm run build",
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
"watch": "webpack -w",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/BacktraceNodeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export class BacktraceNodeRequestHandler implements BacktraceRequestHandler {
this.reason instanceof Error
? this.reason
: typeof this.reason === 'string'
? new Error(this.reason)
: new Error('Operation cancelled.');
? new Error(this.reason)
: new Error('Operation cancelled.');

request.destroy(reason);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/attachment/BacktraceBufferAttachment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BacktraceAttachment } from '@backtrace/sdk-core';

export class BacktraceBufferAttachment implements BacktraceAttachment<Buffer> {
constructor(public readonly name: string, public readonly buffer: Buffer) {}
constructor(
public readonly name: string,
public readonly buffer: Buffer,
) {}
public get(): Buffer {
return this.buffer;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/attachment/BacktraceFileAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { Readable } from 'stream';
export class BacktraceFileAttachment implements CoreBacktraceFileAttachment<Readable> {
public readonly name: string;

constructor(public readonly filePath: string, name?: string) {
constructor(
public readonly filePath: string,
name?: string,
) {
this.name = name ?? path.basename(this.filePath);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/node/tests/_mocks/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function mockStreamFileSystem(files?: Record<string, string>): MockedFile
const str = Buffer.isBuffer(chunk)
? chunk.toString('utf-8')
: typeof chunk === 'string'
? chunk
: String(chunk).toString();
? chunk
: String(chunk).toString();

const fullPath = path.resolve(p);
if (!fs.files[fullPath]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"clean": "rimraf \"lib\"",
"format:check": "eslint \"**/*.{js,ts,tsx}\"",
"prepublishOnly": "bob build",
"test": "NODE_ENV=test jest"
"test": "cross-env NODE_ENV=test jest"
},
"keywords": [
"Error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { NativeModules } from 'react-native';
export class NativeAttributeProvider implements BacktraceAttributeProvider {
private readonly _provider: { get(): Record<string, AttributeType> };

constructor(private readonly _name: string, public readonly type: 'scoped' | 'dynamic') {
constructor(
private readonly _name: string,
public readonly type: 'scoped' | 'dynamic',
) {
this._provider = NativeModules?.[this._name];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export class UnhandledExceptionHandler implements ExceptionHandler {
message = cachedPrettyFormat
? cachedPrettyFormat(rejection)
: typeof rejection === 'string'
? rejection
: JSON.stringify({ ...rejection });
? rejection
: JSON.stringify({ ...rejection });
}

const warning =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export class AndroidUnhandledException extends Error {
constructor(public readonly name: string, public readonly message: string, public readonly stack: string) {
constructor(
public readonly name: string,
public readonly message: string,
public readonly stack: string,
) {
super(message);
}
}
Loading