Socket
Socket
Sign inDemoInstall

serverless-mocha-plugin

Package Overview
Dependencies
73
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.1 to 1.9.2

62

index.js

@@ -90,3 +90,3 @@ 'use strict';

lifecycleEvents: [
'invoke'
'invoke',
],

@@ -160,3 +160,3 @@ options: {

runTests() {
return new Promise((resolve, error) => {
return new Promise((resolve) => {
const myModule = this;

@@ -199,3 +199,2 @@ const funcOption = this.options.f || this.options.function || [];

myModule.serverless.environment = inited.environment;
const vars = new myModule.serverless.classes.Variables(myModule.serverless);

@@ -293,28 +292,25 @@ myModule.runScripts('preTestCommands')

}
const mochaRunner = mocha.run((failures) => {
process.on('exit', () => {
myModule.runScripts('postTestCommands')
// exit with non-zero status if there were failures
.then(() => process.exit(failures));
});
}).on('test', (suite) => {
const testFuncName = utils.funcNameFromPath(suite.file);
// set env only for functions
if (testFileMap[testFuncName]) {
utils.setEnv(myModule.serverless, testFuncName);
} else {
utils.setEnv(myModule.serverless);
}
}).on('end', () => {
resolve();
if (myModule.options.exit) {
process.exit();
}
});
return null;
}, error => myModule.serverless.cli.log(error));
mocha.run((failures) => {
process.on('exit', () => {
myModule.runScripts('postTestCommands')
// exit with non-zero status if there were failures
.then(() => process.exit(failures));
});
}).on('test', (suite) => {
const testFuncName = utils.funcNameFromPath(suite.file);
// set env only for functions
if (testFileMap[testFuncName]) {
utils.setEnv(myModule.serverless, testFuncName);
} else {
utils.setEnv(myModule.serverless);
}
}).on('end', () => {
resolve();
if (myModule.options.exit) {
process.exit();
}
});
return null;
});

@@ -349,3 +345,3 @@ });

}
if ((! templateFilenamePath) || (! fs.existsSync(templateFilenamePath))) {
if ((!templateFilenamePath) || (!fs.existsSync(templateFilenamePath))) {
templateFilenamePath = path.join(__dirname, testTemplateFile);

@@ -391,4 +387,2 @@ }

return (funcObjs);
return null;
}

@@ -424,5 +418,5 @@

}
if(fs.writeFileSync(path.join(handlerDir, handlerFile), jsFile)) {
myModule.serverless.cli.log(`Creating file ${handlerFile} failed`);
return new Error(`Creating file ${handlerFile} failed`);
if (fs.writeFileSync(path.join(handlerDir, handlerFile), jsFile)) {
this.serverless.cli.log(`Creating file ${handlerFile} failed`);
return new Error(`Creating file ${handlerFile} failed`);
}

@@ -434,3 +428,3 @@ this.serverless.cli.log(`Created function file "${path.join(handlerDir, handlerFile)}"`);

createFunctionTest() {
const plugin=this;
const plugin = this;
return plugin.createFunction()

@@ -437,0 +431,0 @@ .then(plugin.createTest);

{
"name": "serverless-mocha-plugin",
"version": "1.9.1",
"version": "1.9.2",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=4.0"

@@ -46,4 +46,4 @@ 'use strict';

it('tests default createTestFolder', () => {
const folder = utils.createTestFolder();
expect(folder).to.be.equal('test');
const folder = utils.createTestFolder();
expect(folder).to.be.equal('test');
});

@@ -50,0 +50,0 @@

'use strict';
const BbPromise = require('bluebird');
const path = require('path');

@@ -40,3 +39,3 @@ const fs = require('fs');

const funcFiles = traverseTestFolder(testFolder);
let resFuncs = {};
const resFuncs = {};
if (funcFiles.length > 0) {

@@ -56,3 +55,3 @@ funcFiles.forEach((val) => {

});
}
}
return resFuncs;

@@ -68,4 +67,3 @@ }

}
const create = fs.mkdirSync(testsFolder);
fs.mkdirSync(testsFolder);
return testsFolder;

@@ -72,0 +70,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with âšĄïž by Socket Inc