Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screwdriver-executor-base

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screwdriver-executor-base - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

package.json
{
"name": "screwdriver-executor-base",
"version": "0.0.1",
"version": "0.0.2",
"description": "Base class defining the interface for executor implementations",

@@ -21,3 +21,3 @@ "main": "index.js",

"license": "BSD-3-Clause",
"author": "Dao Lam <d2lam@yahoo-inc.com>",
"author": "Dao Lam <daolam112@gmail.com>",
"contributors": [

@@ -42,2 +42,2 @@ "Dao Lam <daolam112@gmail.com>",

"dependencies": {}
}
}

@@ -12,2 +12,29 @@ # executor base

## Extending
```js
class MyExecutor extends Executor {
// Implement the interface
start(config, callback) {
if (config.buildId) {
// do stuff here...
return callback(null);
}
return process.nextTick(() => {
callback(new Error('Error starting executor'));
});
}
}
const executor = new MyExecutor({});
executor.start({
buildId: '4b8d9b530d2e5e297b4f470d5b0a6e1310d29c5e',
jobId: '50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0',
pipelineId: 'ccc49349d3cffbd12ea9e3d41521480b4aa5de5f',
container: 'node:4',
scmUrl: 'git@github.com:screwdriver-cd/data-model.git#master'
}, (err) => {
// do something...
});
```
## Testing

@@ -14,0 +41,0 @@

'use strict';
const assert = require('chai').assert;
const Executor = require('../index');
describe('index test', () => {
it('fails', () => {
assert.isTrue(false);
let instance;
beforeEach(() => {
instance = new Executor({ foo: 'bar' });
});
afterEach(() => {
instance = null;
});
it('can create a Executor base class', () => {
assert.instanceOf(instance, Executor);
});
it('has methods that need to be extended', () => {
assert.throws(instance.start, Error, 'not implemented');
assert.throws(instance.stop, Error, 'not implemented');
});
it('can be extended', (done) => {
class Foo extends Executor {
get(id, callback) {
if (id > 0) {
return callback(null, { id });
}
return process.nextTick(() => {
callback(new Error('invalid id'));
});
}
}
const bar = new Foo({ foo: 'bar' });
assert.instanceOf(bar, Executor);
bar.get(1, (err, data) => {
assert.isNull(err);
assert.equal(data.id, 1);
done();
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc