mirror of https://github.com/n2geoff/testit.git
convert to rollup build system
This commit is contained in:
parent
1a388656f2
commit
ec4e087e90
16
gulpfile.js
16
gulpfile.js
|
@ -1,9 +1,25 @@
|
|||
const gulp = require("gulp");
|
||||
const minify = require("gulp-minify");
|
||||
const strip = require("gulp-strip-comments");
|
||||
const rollup = require("gulp-rollup-2").rollup;
|
||||
|
||||
gulp.task("default", function build() {
|
||||
return gulp.src("./src/testit.js")
|
||||
.pipe(rollup({
|
||||
input: "./src/testit.js",
|
||||
output: [
|
||||
{
|
||||
file: "testit.js",
|
||||
name: "es",
|
||||
format: "es"
|
||||
},
|
||||
{
|
||||
file: "testit.umd.js",
|
||||
name: "umd",
|
||||
format: "umd"
|
||||
},
|
||||
]
|
||||
}))
|
||||
.pipe(strip({safe: true}))
|
||||
.pipe(minify({ext: {min: ".min.js"}}))
|
||||
.pipe(gulp.dest("dist"))
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "testit",
|
||||
"version": "0.8.2",
|
||||
"description": "a minimalistic testing library",
|
||||
"version": "0.9.0",
|
||||
"description": "minimalistic testing library",
|
||||
"main": "src/testit.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
|
@ -15,6 +15,7 @@
|
|||
"eslint": "^7.8.1",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-minify": "^3.1.0",
|
||||
"gulp-rollup-2": "^1.1.0",
|
||||
"gulp-strip-comments": "^2.5.2"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
/*! Test.it v 0.8.0 | MIT | https://github.com/n2geoff/testit */
|
||||
;(function (root, factory) {
|
||||
"use strict";
|
||||
// support browser & commonjs
|
||||
if (typeof module === "object" && module.exports) {
|
||||
module.exports = factory(root.test);
|
||||
} else {
|
||||
root.test = factory(root.test);
|
||||
}
|
||||
}(this, function () {
|
||||
"use strict";
|
||||
|
||||
/*! Test.it v 0.9.0 | MIT | https://github.com/n2geoff/testit */
|
||||
const test = {
|
||||
"log": console.log,
|
||||
"_tests": {},
|
||||
"run": function run(errors, next) {
|
||||
// TODO: rewrite to allow a show errors flag (optional)
|
||||
|
@ -19,7 +9,7 @@
|
|||
errors = true;
|
||||
}
|
||||
|
||||
let tests = this._tests;
|
||||
let tests = this._tests || [];
|
||||
// capture results
|
||||
let failed = [];
|
||||
let passed = [];
|
||||
|
@ -48,8 +38,8 @@
|
|||
fail: failed
|
||||
});
|
||||
} else {
|
||||
console.log(...passed, ...failed);
|
||||
console.log(`\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);
|
||||
test.log(...passed, ...failed);
|
||||
test.log(`\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);
|
||||
|
||||
return failed.length ? false : true;
|
||||
}
|
||||
|
@ -65,8 +55,8 @@
|
|||
"a": (type) => { return test.expects(val).to.be.an(type); },
|
||||
"an": (type) => {
|
||||
|
||||
if(['array'].indexOf(type) !== -1) {
|
||||
if(val.constructor.name.toLowerCase() !== 'array') {
|
||||
if(["array"].indexOf(type) !== -1) {
|
||||
if(val.constructor.name.toLowerCase() !== "array") {
|
||||
throw new Error(`expected ${typeof val} to be an ${type}`);
|
||||
}
|
||||
|
||||
|
@ -101,5 +91,4 @@
|
|||
}
|
||||
};
|
||||
|
||||
return test;
|
||||
}));
|
||||
export default test;
|
||||
|
|
Loading…
Reference in New Issue