Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
n2geoff committed Sep 20, 2020
1 parent 7444e0a commit c99bd20
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 84 deletions.
49 changes: 9 additions & 40 deletions dist/testit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*! Test.it v 0.9.0 | MIT | https://github.com/n2geoff/testit */
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */
const test = {
"log": console.log,
"version": "v1.0.0",
"_tests": {},
"run": function run(errors, next) {
if(typeof errors !== "boolean") {
Expand Down Expand Up @@ -43,46 +44,14 @@ const test = {
this._tests = tests;
return this;
},
"expects": function expects(val) {
return {
"to": {
"be": {
"a": (type) => { return test.expects(val).to.be.an(type); },
"an": (type) => {

if(["array"].indexOf(type) !== -1) {
if(val.constructor.name.toLowerCase() !== "array") {
throw new Error(`expected ${typeof val} to be an ${type}`);
}

return true;
}

if(typeof val !== type) {
throw new Error(`expected ${typeof val} to be an ${type}`);
}
},
"ok": () => { return test.expects(val).to.exist(); },
"like": (comp) => {
if(val != comp) {
throw new Error(`expected ${val} == ${comp}`);
}
}
},
"equal": (comp) => {
if(val !== comp) {
throw new Error(`expected ${val} === ${comp}`);
}
},
"exist": () => {
if(!val) {
throw new Error(`expected ${val} to be truthy`);
}
},
"pass": () => { return true; },
"fail": (msg) => { throw new Error(msg); }
"assert": (expression, msg) => {
try {
if(!expression) {
throw new Error(msg || "Assertion Failed");
}
};
} catch (e) {
throw new Error(msg);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion dist/testit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 9 additions & 40 deletions dist/testit.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.umd = factory());
}(this, (function () { 'use strict';

/*! Test.it v 0.9.0 | MIT | https://github.com/n2geoff/testit */
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */
const test = {
"log": console.log,
"version": "v1.0.0",
"_tests": {},
"run": function run(errors, next) {
if(typeof errors !== "boolean") {
Expand Down Expand Up @@ -49,46 +50,14 @@
this._tests = tests;
return this;
},
"expects": function expects(val) {
return {
"to": {
"be": {
"a": (type) => { return test.expects(val).to.be.an(type); },
"an": (type) => {

if(["array"].indexOf(type) !== -1) {
if(val.constructor.name.toLowerCase() !== "array") {
throw new Error(`expected ${typeof val} to be an ${type}`);
}

return true;
}

if(typeof val !== type) {
throw new Error(`expected ${typeof val} to be an ${type}`);
}
},
"ok": () => { return test.expects(val).to.exist(); },
"like": (comp) => {
if(val != comp) {
throw new Error(`expected ${val} == ${comp}`);
}
}
},
"equal": (comp) => {
if(val !== comp) {
throw new Error(`expected ${val} === ${comp}`);
}
},
"exist": () => {
if(!val) {
throw new Error(`expected ${val} to be truthy`);
}
},
"pass": () => { return true; },
"fail": (msg) => { throw new Error(msg); }
"assert": (expression, msg) => {
try {
if(!expression) {
throw new Error(msg || "Assertion Failed");
}
};
} catch (e) {
throw new Error(msg);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion dist/testit.umd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testit",
"version": "0.9.0",
"version": "1.0.0",
"description": "minimalistic testing library",
"main": "src/testit.js",
"directories": {
Expand Down
3 changes: 2 additions & 1 deletion src/testit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*! Test.it v 0.9.0 | MIT | https://github.com/n2geoff/testit */
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */
const test = {
"log": console.log, // eslint-disable-line
"version": "v1.0.0",
"_tests": {},
"run": function run(errors, next) {
// TODO: rewrite to allow a show errors flag (optional)
Expand Down

0 comments on commit c99bd20

Please sign in to comment.