
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
agent-js-jasmine
Advanced tools
Agent for integration Jasmine with ReportPortal.
ReportPortal
ReportPortal on GitHub
npm i agent-js-jasmine --save-dev
var ReportportalAgent = require('agent-js-jasmine');
var agent = new ReportportalAgent({
// client settings
token: "00000000-0000-0000-0000-000000000000",
endpoint: "http://your-instance.com:8080/api/v1",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME",
// agent settings
attachPicturesToLogs: true,
});
jasmine.addReporter(agent.getJasmineReporter());
agent.getExitPromise().then(() => {
console.log('finish work');
})
Agent settings consist of two parts:
Parameter | Description |
---|---|
attachPicturesToLogs | It is 'true' or 'false', if set 'true' then attempts will be made to attach screenshots to the logs. Default: 'true'. |
If you launch protractor in single tread mode , just add agent initialization to the onPrepare function. Add agent.getJasmineReporter to the jasmine.getEnv().addReporter() as an argument. You can see this in the example bellow. Update your configuration file as follows:
const ReportportalAgent = require('agent-js-jasmine');
...
const agent = new ReportportalAgent({
token: "00000000-0000-0000-0000-000000000000",
endpoint: "http://your-instance.com:8080/api/v1",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME",
attachPicturesToLogs: false
});
exports.config = {
...
onPrepare: ()=> {
...
jasmine.getEnv().addReporter(agent.getJasmineReporter());
},
afterLaunch:() => {
return agent.getExitPromise();
}
};
For launching agents in multi thread mode firstly parent launch must be created and it ID must be sent to the child launches , so they would send data to the right place, and wouldn't create new launch instances at the Report Portal.
The main problem is that node.js is a single threaded platform. And for providing multi treading launch with browsers protractor generate new processes of node, which can't interact with each other, so Singelton objects or functions can't be created for synchronizing it work. Only primitive types could be sent as args to the new processes before launch. The way of resolving this problem is to create launch file that would generate a Parent Launch and send launch's ID to protractor as argument. Then protractor would launch jasmine-agents with parent ID. Look through example of the Launch File with protractor-flake module at the 'Settings fot the multi threaded launch' section or at the examples folder. Any node runner could be used!
npm install protractor-flake --save-dev
reportportalConf.js
module.exports = {
token: "00000000-0000-0000-0000-000000000000",
endpoint: "http://your-instance.com:8080/api/v1",
launch: "LAUNCH_NAME",
project: "PROJECT_NAME",
attachPicturesToLogs: false
}
protractorLaunchFile.js
const protractorFlake = require('protractor-flake');
const AgentJasmine = require('agent-js-jasmine');
const reportportalConfig = require('./reportportalConf');
const agent = new AgentJasmine(reportportalConfig);
agent.getLaunchStartPromise().then((launchData) =>{
protractorFlake({
maxAttempts: 1,
protractorArgs: [
'./multiThreadConf.js',
'--params.id',
launchData.id
]
}, (status) => {
agent.getExitPromise().then(() =>{
process.exit(status);
});
});
});
multiThreadConf.js file
const ReportportalAgent = require('agent-js-jasmine');
const reportportalConfig = require('./reportportalConf');
exports.config = {
multiCapabilities: [
{
name: 'normal',
browserName: 'chrome',
maxInstances: 2,
shardTestFiles: true,
chromeOptions: {
args: ['--window-size=1024,768', '--disable-infobars']
}
}
],
specs: ['testAngularPage.js', 'testGithubPage.js'],
onPrepare() {
const config = Object.assign({
id: browser.params.id
}, reportportalConfig);
const agent = new ReportportalAgent(config);
/*Its a hack. There is an issue since 2015. That Jasmine doesn't wait for report's async functions.
links to the issues https://github.com/jasmine/jasmine/issues/842
https://github.com/angular/protractor/issues/1938
So it needed to wait until requests would be sent to the Report Portal.
*/
afterAll((done) => agent.getPromiseFinishAllItems(agent.tempLaunchId).then(()=> done()));
jasmine.getEnv().addReporter(agent.getJasmineReporter());
}
};
"scripts": {
"protractor-multi": "node protractorLaunchFile.js"
}
npm run protractor-multi
Link to the jasmine issue , that it doesn't work well with async functions jasmine issue, protractor's community
Licensed under the GPLv3 license (see the LICENSE.txt file).
FAQs
Agent for integration Jasmine with ReportPortal.
The npm package agent-js-jasmine receives a total of 134 weekly downloads. As such, agent-js-jasmine popularity was classified as not popular.
We found that agent-js-jasmine 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.