New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-test-each

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-test-each - npm Package Compare versions

Comparing version 0.3.20 to 0.3.21

coverage/clover.xml

59

dist/test-each.js

@@ -20,3 +20,3 @@ "use strict";

if (!this.env) {
throw new Error('Please specify test env (jest/mocha) like: ');
throw new Error('Please specify test env (jest/mocha) like');
}

@@ -54,20 +54,17 @@ }

// todo cleanup
if (this.onlyOneFilter) {
const notFound = this.groups.every(p => p.filter(k => { var _a; return (_a = this.onlyOneFilter) === null || _a === void 0 ? void 0 : _a.call(this, k); }).length === 0);
if (notFound) {
testRunner('Only one search failed', () => {
throw new Error('No such case: ' + this.onlyOneFilter.toString());
});
return;
}
this.groups = this.groups.map((p, i) => {
const notFound = this.groups.every(p => p.filter(k => { var _a; return (_a = this.onlyOneFilter) === null || _a === void 0 ? void 0 : _a.call(this, k); }).length === 0);
if (this.onlyOneFilter && notFound) {
testRunner('Only one search failed', () => {
throw new Error('No such case: ' + this.onlyOneFilter.toString());
});
return;
}
this.groups = this.onlyOneFilter
? this.groups.map((p, i) => {
const filtered = p.filter(k => { var _a; return (_a = this.onlyOneFilter) === null || _a === void 0 ? void 0 : _a.call(this, k); });
return [filtered.length === 0 ? p[0] : filtered[0]];
});
}
else {
this.groups = this.groups.map(p => [p[0]]);
}
})
: this.groups.map(p => [p[0]]);
}
const runCheck = () => {
const testIfOnly = () => {
if (this.onlyOne) {

@@ -79,6 +76,6 @@ testRunner('only() should be removed before committing', () => {

};
if (this.groups.length === 0) {
utils_1.guard(!!this.desc, 'Test should have name when no cases');
if (this.groups.length === 0 && !!this.desc) {
// should not group into suite when only one case
testRunner(this.desc, () => body({}));
runCheck();
testIfOnly();
return;

@@ -91,7 +88,2 @@ }

};
const runCase = (body) => (t, i) => {
utils_1.guard(!!t.name, 'Test should have name (empty group of cases)');
const name = entityName(i + 1, t.name);
testRunner(name, () => body(t.data)); // todo;
};
const allCases = [];

@@ -102,11 +94,18 @@ tree_1.treeWalk(root, undefined, t => {

const isFlat = allCases.every(p => p.flatDesc);
utils_1.guard(allCases.every(t => t.name), 'Every case in .each should have not empty data');
utils_1.guard(allCases.length !== 0, 'Should be at least one case');
const run = () => tree_1.treeWalk(root, (t, i, inside) => {
const suiteGuards = () => {
utils_1.guard(!(this.groups.length === 0 && !this.desc), 'Test should have name when no cases');
};
const runCase = (body) => (t, i) => {
utils_1.guard(!!t.name, 'Every case in .each should have not empty data');
const name = entityName(i + 1, t.name);
testRunner(name, () => body(t.data)); // todo;
};
const tests = () => tree_1.treeWalk(root, (t, i, inside) => {
this.env.describe(entityName(i + 1, t.name), inside);
}, runCase(body));
const runFlat = () => allCases.forEach(runCase(body));
const testsFlat = () => allCases.forEach(runCase(body));
runSuite(this.env.describe, () => {
runCheck();
groupBySuites && !isFlat ? run() : runFlat();
suiteGuards();
testIfOnly();
groupBySuites && !isFlat ? tests() : testsFlat();
}, this.desc);

@@ -113,0 +112,0 @@ }

{
"name": "jest-test-each",
"version": "0.3.20",
"version": "0.3.21",
"description": "run parametrised tests easily [typesafe] without text tables or arrays of arrays.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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