Skip to content

Commit

Permalink
fix console logs and file path regex
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Feb 17, 2025
1 parent b1826fe commit 5239b78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void describe('serializable error', () => {
);
error.stack = `${error.stack} at methodName (${pathToFileURL(
process.cwd()
).toString()}:12:34)\n`;
).toString()}/node_modules/@aws-amplify/test-package/lib/test.js:12:34)\n`;
const serializableError = new SerializableError(error);
assert.ok(serializableError.stack);
const matches = [
Expand All @@ -95,5 +95,7 @@ void describe('serializable error', () => {
matches.length === 0,
`${os.homedir()} is included in ${serializableError.stack}`
);
const expectedFilePath = 'node_modules/@aws-amplify/test-package/lib/test.js';
assert.ok(serializableError.stack.includes(expectedFilePath), `${expectedFilePath} is not found in ${serializableError.stack}`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export class SerializableError {
// breakdown of filePathRegex:
// (file:/+)? -> matches optional file url prefix
// homedir() -> users home directory, replacing \ with /
// [\\w.\\-_\\\\/]+ -> matches nested directories and file name
// [\\w.\\-_@\\\\/]+ -> matches nested directories and file name
private filePathRegex = new RegExp(
`(file:/+)?${homedir().replaceAll('\\', '/')}[\\w.\\-_\\\\/]+`,
`(file:/+)?${homedir().replaceAll('\\', '/')}[\\w.\\-_@\\\\/]+`,
'g'
);
private arnRegex =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class DefaultTelemetryDataEmitter implements TelemetryDataEmitter {
metrics,
dimensions,
});
console.log(data);
console.log(JSON.stringify(data, null, 2));

Check failure on line 70 in packages/platform-core/src/telemetry-data/telemetry_data_emitter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
// await this.send(data);
// eslint-disable-next-line amplify-backend-rules/no-empty-catch
} catch {
Expand All @@ -87,7 +87,7 @@ export class DefaultTelemetryDataEmitter implements TelemetryDataEmitter {
metrics,
dimensions,
});
console.log(data);
console.log(JSON.stringify(data, null, 2));

Check failure on line 90 in packages/platform-core/src/telemetry-data/telemetry_data_emitter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
// await this.send(data);
// eslint-disable-next-line amplify-backend-rules/no-empty-catch
} catch {
Expand All @@ -105,7 +105,7 @@ export class DefaultTelemetryDataEmitter implements TelemetryDataEmitter {
metrics,
dimensions,
});
console.log(data);
console.log(JSON.stringify(data, null, 2));

Check failure on line 108 in packages/platform-core/src/telemetry-data/telemetry_data_emitter.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
// await this.send(data);
// eslint-disable-next-line amplify-backend-rules/no-empty-catch
} catch {
Expand Down Expand Up @@ -200,8 +200,6 @@ export class DefaultTelemetryDataEmitter implements TelemetryDataEmitter {
}
}

console.log('path', path);
console.log('parameters', parameters);
return { path: path.split(' '), parameters: parameters.split(' ') };
};

Expand Down

0 comments on commit 5239b78

Please sign in to comment.