Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
cypress-redirect-browser-log
Advanced tools
Will connect to **chrome** debugging protocol and redirect logs to node process
Will connect to chrome debugging protocol and redirect logs to node process
Will redirect browser console events like:
Install:
npm i --save-dev cypress-redirect-browser-log
Requires Cypress >11.x as peer dependency
Logs will be redirected to node console when environment variable REDIRECT_BROWSER_LOG
is set to true.
You need to add redirectLog(on, config);
into your plugins file.
See example of the simplest configuration:
// cypress.config.ts
import { redirectLog } from 'cypress-redirect-browser-log/plugins';
export default defineConfig({
e2e: {
// ...
setupNodeEvents(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) {
redirectLog(on, config);
//... other existing configrations
return config;
}
}
});
For more options see advanced section below.
To see logs from tests put this into your support file (e2e.ts
or support/index.ts
)
// support/index.ts or where is support located (e2e.ts)
import { redirectTestLogs } from 'cypress-redirect-browser-log';
redirectTestLogs({
isLogCommandDetails: false,
});
isLogCommandDetails
: set to true to see all commands with details from testTo disable logs from tests you can setup plugins as follows:
// disable test log
redirectLog(on, config, handler => {
handler.on('test:log', () => {
// ignore
});
});
// or specify only events you want to see
redirectLog(on, config, ['excpetion', 'error', 'log', 'warn']);
Run tests with --browser chrome --headless
(for electron logs will not be redirected)
You'll see logs in node console like:
FROM CHROME >> 2023-06-06T07:12:01.046Z | test | ======== TEST STARTED: test integration should be no details for commands
FROM CHROME >> 2023-06-06T07:12:01.148Z | test | command: route ->
FROM CHROME >> 2023-06-06T07:12:01.166Z | test | command: visit -> mytest.com
FROM CHROME >> 2023-06-06T07:12:01.438Z | log | LOG FROM APPLICATION!!
FROM CHROME >> 2023-06-06T07:12:01.438Z | warning | WARN FROM APPLICATION!!
FROM CHROME >> 2023-06-06T07:12:01.438Z | warning | at http://localhost:58040/mytest.com:23:16 (<no functionName>)
FROM CHROME >> 2023-06-06T07:12:01.438Z | error | ERROR FROM APPLICATION!!
FROM CHROME >> 2023-06-06T07:12:01.438Z | error | at http://localhost:58040/mytest.com:24:16 (<no functionName>)
FROM CHROME >> 2023-06-06T07:12:01.466Z | test | command: get -> div
FROM CHROME >> 2023-06-06T07:12:01.486Z | test | command: assert -> expected [ <div>, 1 more... ] to exist in the DOM
FROM CHROME >> 2023-06-06T07:12:01.504Z | test | ==== TEST RESULT: PASSED
:tada:
For your own log events and formatting see advanced
With default configuration you will see logs from events : exception
, error
, warn
, log
, debug
, test:log
.
If you need to show for example only errors and exceptions in plugins add one more argument:
// will show only errors in excpetions
redirectLog(on, config, ['error', 'exception']);
If you want to create your own message (or do anything you want with result):
// will override output of errors and excpetions
redirectLog(on, config, handler => {
handler.on('error', res => {
console.error(res.message);
});
handler.on('exception', res => {
console.error(res.message);
});
});
If you want to show default log for specific events and own messages:
// will show all from test logs and your errors and exceptions
redirectLog(on, config, ['test:log'], handler => {
handler.on('error', res => {
console.error(res.message);
});
handler.on('exception', res => {
console.error(res.message);
});
});
if you need to handle 'before:browser:launch' you can use this configuration :
const browserHandler = redirectLogBrowser(config);
on('before:browser:launch', (browser: Browser, browserLaunchOptions: BrowserLaunchOptions) => {
// your other browser handling
return browserHandler(browser, browserLaunchOptions);
});
redirectLogBrowser accepts similar overloads as redirectLog
FAQs
Will connect to **chrome** debugging protocol and redirect logs to node process
The npm package cypress-redirect-browser-log receives a total of 366 weekly downloads. As such, cypress-redirect-browser-log popularity was classified as not popular.
We found that cypress-redirect-browser-log demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.