mirror of https://github.com/n2geoff/testit.git
Compare commits
No commits in common. "master" and "1.0.0" have entirely different histories.
|
@ -0,0 +1,34 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": [
|
||||||
|
"warn"
|
||||||
|
],
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4,
|
||||||
|
{"SwitchCase": 1}
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"double"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ The `dist` includes the minified version of the source code.
|
||||||
Run unit tests using this command:
|
Run unit tests using this command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reporting a bug
|
## Reporting a bug
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Geoff Doty
|
Copyright (c) 2018 testit authors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Test.it
|
# Test.it
|
||||||
|
|
||||||
> A minimalistic client-side testing library
|
> A minimalistic testing library
|
||||||
|
|
||||||
**Test.it** is a small client-side testing library for people that want to live in code, not in tests. No over engineering here. Inspired by the simplicity of libraries like [Jasmine](https://jasmine.github.io/), but implementation ideas based on [TinyTest](https://github.com/joewalnes/jstinytest)
|
**Test.it** is a small client-side testing library for people that want to live in code, not in tests. No over engineering here. Inspired by the simplicity of libraries like [Jasmine](https://jasmine.github.io/), but implementation ideas based on [TinyTest](https://github.com/joewalnes/jstinytest)
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ By default, you can run your tests like
|
||||||
import test from 'testit';
|
import test from 'testit';
|
||||||
|
|
||||||
test.it({
|
test.it({
|
||||||
'my passing test'() {
|
'my passing test': function() {
|
||||||
test.assert(true);
|
test.assert(true);
|
||||||
},
|
},
|
||||||
'my failing test'() {
|
'my failing test': function() {
|
||||||
test.assert(true === false, 'just wanted to fail fast');
|
test.assert(true === false, 'just wanted to fail fast');
|
||||||
}
|
}
|
||||||
}).run();
|
}).run();
|
||||||
|
@ -68,10 +68,10 @@ For Example...
|
||||||
|
|
||||||
```js
|
```js
|
||||||
test.it({
|
test.it({
|
||||||
'my passing test'() {
|
'my passing test': function() {
|
||||||
test.assert(true);
|
test.assert(true);
|
||||||
}
|
}
|
||||||
}, (results) => {
|
}, function(results) {
|
||||||
if (window.document && document.body) {
|
if (window.document && document.body) {
|
||||||
document.body.style.backgroundColor = (
|
document.body.style.backgroundColor = (
|
||||||
results.fail.length ? '#ff9999' : '#99ff99'
|
results.fail.length ? '#ff9999' : '#99ff99'
|
||||||
|
@ -112,7 +112,7 @@ putting that above your tests will allow you to write like
|
||||||
|
|
||||||
```js
|
```js
|
||||||
test.it({
|
test.it({
|
||||||
"my test should work"() {
|
"my test should work": function() {
|
||||||
assert(true);
|
assert(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -134,4 +134,4 @@ Anyone is welcome to contribute, however, if you decide to get involved, please
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](LICENSE) Geoff Doty
|
[MIT](LICENSE)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*! 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") {
|
||||||
|
next = errors;
|
||||||
|
errors = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tests = this._tests || [];
|
||||||
|
let failed = [];
|
||||||
|
let passed = [];
|
||||||
|
|
||||||
|
Object.keys(tests).forEach((name) => {
|
||||||
|
let test = tests[name];
|
||||||
|
|
||||||
|
try {
|
||||||
|
test();
|
||||||
|
passed.push(`\n+OK ${name}`);
|
||||||
|
} catch (err) {
|
||||||
|
if (errors) {
|
||||||
|
failed.push(`\n-ERR ${name} \n --- \n ${err.stack} \n ---`);
|
||||||
|
} else {
|
||||||
|
failed.push(`\n-ERR ${name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(typeof next === "function") {
|
||||||
|
return next({
|
||||||
|
pass: passed,
|
||||||
|
fail: failed
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
test.log(...passed, ...failed);
|
||||||
|
test.log(`\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);
|
||||||
|
|
||||||
|
return failed.length ? false : true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"it": function it(tests) {
|
||||||
|
this._tests = tests;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
"assert": (expression, msg) => {
|
||||||
|
try {
|
||||||
|
if(!expression) {
|
||||||
|
throw new Error(msg || "Assertion Failed");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default test;
|
|
@ -1,9 +1 @@
|
||||||
/*! Test.it v1.2.0 | MIT | https://github.com/n2geoff/testit */const o={log:console.log,version:"v1.2.0",_tests:{},run(t,s){typeof t!="boolean"&&(s=t,t=!0);let r=this._tests||[],e=[],l=[];return Object.keys(r).forEach(n=>{let h=r[n];try{h(),l.push(`
|
const test={log:console.log,version:"v1.0.0",_tests:{},run:function(t,e){"boolean"!=typeof t&&(e=t,t=!0);let s=this._tests||[],n=[],o=[];return Object.keys(s).forEach(e=>{let r=s[e];try{r(),o.push(`\n+OK ${e}`)}catch(s){t?n.push(`\n-ERR ${e} \n --- \n ${s.stack} \n ---`):n.push(`\n-ERR ${e}`)}}),"function"==typeof e?e({pass:o,fail:n}):(test.log(...o,...n),test.log(`\n# tests ${n.length+o.length} pass ${o.length} fail ${n.length}`),!n.length)},it:function(t){return this._tests=t,this},assert:(t,e)=>{try{if(!t)throw new Error(e||"Assertion Failed")}catch(t){throw new Error(e)}}};export default test;
|
||||||
+OK ${n}`)}catch(i){t?e.push(`
|
|
||||||
-ERR ${n}
|
|
||||||
---
|
|
||||||
${i.stack}
|
|
||||||
---`):e.push(`
|
|
||||||
-ERR ${n}`)}}),typeof s=="function"?s({pass:l,fail:e}):(o.log(...l,...e),o.log(`
|
|
||||||
# tests ${e.length+l.length} pass ${l.length} fail ${e.length}`),!e.length)},it(t){return this._tests=t,this},assert(t,s){try{if(!t)throw new Error(s||"Assertion Failed")}catch{throw new Error(s)}}};var f=o;export{f as default,o as test};
|
|
||||||
//# sourceMappingURL=testit.min.js.map
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../src/testit.js"],
|
|
||||||
"sourcesContent": ["/*! Test.it v1.2.0 | MIT | https://github.com/n2geoff/testit */\nexport const test = {\n log: console.log,\n version: \"v1.2.0\",\n _tests: {},\n run(errors, next) {\n // TODO: rewrite to allow show errors flag (optional)\n if(typeof errors !== \"boolean\") {\n next = errors;\n errors = true;\n }\n\n let tests = this._tests || [];\n // capture results\n let failed = [];\n let passed = [];\n\n // loop through tests\n Object.keys(tests).forEach((name) => {\n let test = tests[name];\n\n // execute\n try {\n test();\n passed.push(`\\n+OK ${name}`);\n } catch (err) {\n if (errors) {\n failed.push(`\\n-ERR ${name} \\n --- \\n ${err.stack} \\n ---`);\n } else {\n failed.push(`\\n-ERR ${name}`);\n }\n }\n });\n\n // summary\n if(typeof next === \"function\") {\n return next({\n pass: passed,\n fail: failed\n });\n } else {\n test.log(...passed, ...failed);\n test.log(`\\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);\n\n return failed.length ? false : true;\n }\n },\n it(tests) {\n this._tests = tests;\n return this;\n },\n assert(expression, msg) {\n try {\n if(!expression) {\n throw new Error(msg || \"Assertion Failed\");\n }\n } catch {\n throw new Error(msg);\n }\n }\n};\n\nexport default test;\n"],
|
|
||||||
"mappings": "AAAA,+DACO,MAAMA,EAAO,CAChB,IAAK,QAAQ,IACb,QAAS,SACT,OAAQ,CAAC,EACT,IAAIC,EAAQC,EAAM,CAEX,OAAOD,GAAW,YACjBC,EAAOD,EACPA,EAAS,IAGb,IAAIE,EAAQ,KAAK,QAAU,CAAC,EAExBC,EAAS,CAAC,EACVC,EAAS,CAAC,EAoBd,OAjBA,OAAO,KAAKF,CAAK,EAAE,QAASG,GAAS,CACjC,IAAIN,EAAOG,EAAMG,CAAI,EAGrB,GAAI,CACAN,EAAK,EACLK,EAAO,KAAK;AAAA,MAASC,CAAI,EAAE,CAC/B,OAASC,EAAK,CACNN,EACAG,EAAO,KAAK;AAAA,OAAUE,CAAI;AAAA;AAAA,GAAcC,EAAI,KAAK;AAAA,KAAS,EAE1DH,EAAO,KAAK;AAAA,OAAUE,CAAI,EAAE,CAEpC,CACJ,CAAC,EAGE,OAAOJ,GAAS,WACRA,EAAK,CACR,KAAMG,EACN,KAAMD,CACV,CAAC,GAEDJ,EAAK,IAAI,GAAGK,EAAQ,GAAGD,CAAM,EAC7BJ,EAAK,IAAI;AAAA,UAAaI,EAAO,OAASC,EAAO,MAAM,SAASA,EAAO,MAAM,SAASD,EAAO,MAAM,EAAE,EAE1F,CAAAA,EAAO,OAEtB,EACA,GAAGD,EAAO,CACN,YAAK,OAASA,EACP,IACX,EACA,OAAOK,EAAYC,EAAK,CACpB,GAAI,CACA,GAAG,CAACD,EACA,MAAM,IAAI,MAAMC,GAAO,kBAAkB,CAEjD,MAAQ,CACJ,MAAM,IAAI,MAAMA,CAAG,CACvB,CACJ,CACJ,EAEA,IAAOC,EAAQV",
|
|
||||||
"names": ["test", "errors", "next", "tests", "failed", "passed", "name", "err", "expression", "msg", "testit_default"]
|
|
||||||
}
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define('umd', factory) :
|
||||||
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.umd = factory());
|
||||||
|
}(this, (function () { 'use strict';
|
||||||
|
|
||||||
|
/*! 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") {
|
||||||
|
next = errors;
|
||||||
|
errors = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tests = this._tests || [];
|
||||||
|
let failed = [];
|
||||||
|
let passed = [];
|
||||||
|
|
||||||
|
Object.keys(tests).forEach((name) => {
|
||||||
|
let test = tests[name];
|
||||||
|
|
||||||
|
try {
|
||||||
|
test();
|
||||||
|
passed.push(`\n+OK ${name}`);
|
||||||
|
} catch (err) {
|
||||||
|
if (errors) {
|
||||||
|
failed.push(`\n-ERR ${name} \n --- \n ${err.stack} \n ---`);
|
||||||
|
} else {
|
||||||
|
failed.push(`\n-ERR ${name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(typeof next === "function") {
|
||||||
|
return next({
|
||||||
|
pass: passed,
|
||||||
|
fail: failed
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
test.log(...passed, ...failed);
|
||||||
|
test.log(`\n# tests ${failed.length + passed.length} pass ${passed.length} fail ${failed.length}`);
|
||||||
|
|
||||||
|
return failed.length ? false : true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"it": function it(tests) {
|
||||||
|
this._tests = tests;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
"assert": (expression, msg) => {
|
||||||
|
try {
|
||||||
|
if(!expression) {
|
||||||
|
throw new Error(msg || "Assertion Failed");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return test;
|
||||||
|
|
||||||
|
})));
|
|
@ -0,0 +1 @@
|
||||||
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("umd",e):(t="undefined"!=typeof globalThis?globalThis:t||self).umd=e()}(this,function(){"use strict";const t={log:console.log,version:"v1.0.0",_tests:{},run:function(e,n){"boolean"!=typeof e&&(n=e,e=!0);let o=this._tests||[],s=[],i=[];return Object.keys(o).forEach(t=>{let n=o[t];try{n(),i.push(`\n+OK ${t}`)}catch(n){e?s.push(`\n-ERR ${t} \n --- \n ${n.stack} \n ---`):s.push(`\n-ERR ${t}`)}}),"function"==typeof n?n({pass:i,fail:s}):(t.log(...i,...s),t.log(`\n# tests ${s.length+i.length} pass ${i.length} fail ${s.length}`),!s.length)},it:function(t){return this._tests=t,this},assert:(t,e)=>{try{if(!t)throw new Error(e||"Assertion Failed")}catch(t){throw new Error(e)}}};return t});
|
|
@ -1,26 +0,0 @@
|
||||||
import globals from "globals";
|
|
||||||
import path from "node:path";
|
|
||||||
import { fileURLToPath } from "node:url";
|
|
||||||
import js from "@eslint/js";
|
|
||||||
import { FlatCompat } from "@eslint/eslintrc";
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
const compat = new FlatCompat({
|
|
||||||
baseDirectory: __dirname,
|
|
||||||
recommendedConfig: js.configs.recommended,
|
|
||||||
allConfig: js.configs.all
|
|
||||||
});
|
|
||||||
|
|
||||||
export default [...compat.extends("eslint:recommended"), {
|
|
||||||
languageOptions: {
|
|
||||||
globals: {
|
|
||||||
...globals.browser,
|
|
||||||
},
|
|
||||||
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
sourceType: "module",
|
|
||||||
},
|
|
||||||
|
|
||||||
rules: {},
|
|
||||||
}];
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
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
17
package.json
17
package.json
|
@ -1,20 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "testit.run",
|
"name": "testit",
|
||||||
"version": "1.2.0",
|
"version": "1.0.0",
|
||||||
"description": "minimalistic client-side testing library",
|
"description": "minimalistic testing library",
|
||||||
"main": "src/testit.js",
|
"main": "src/testit.js",
|
||||||
"type": "module",
|
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx esbuild src/testit.js --minify --sourcemap --format=esm --outfile=dist/testit.min.js",
|
"build": "npx gulp default",
|
||||||
"lint": "npx eslint src/testit.js",
|
"lint": "npx eslint src/testit.js",
|
||||||
"test": "npx live-server --open=test/ --port=5000"
|
"test": "npx live-server --open=test/ --port=5000"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^9.23.0"
|
"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",
|
||||||
|
"live-server": "^1.2.1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*! Test.it v1.2.0 | MIT | https://github.com/n2geoff/testit */
|
/*! Test.it v1.0.0 | MIT | https://github.com/n2geoff/testit */
|
||||||
export const test = {
|
const test = {
|
||||||
log: console.log,
|
"log": console.log, // eslint-disable-line
|
||||||
version: "v1.2.0",
|
"version": "v1.0.0",
|
||||||
_tests: {},
|
"_tests": {},
|
||||||
run(errors, next) {
|
"run": function run(errors, next) {
|
||||||
// TODO: rewrite to allow show errors flag (optional)
|
// TODO: rewrite to allow a show errors flag (optional)
|
||||||
if(typeof errors !== "boolean") {
|
if(typeof errors !== "boolean") {
|
||||||
next = errors;
|
next = errors;
|
||||||
errors = true;
|
errors = true;
|
||||||
|
@ -45,16 +45,16 @@ export const test = {
|
||||||
return failed.length ? false : true;
|
return failed.length ? false : true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
it(tests) {
|
"it": function it(tests) {
|
||||||
this._tests = tests;
|
this._tests = tests;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
assert(expression, msg) {
|
"assert": (expression, msg) => {
|
||||||
try {
|
try {
|
||||||
if(!expression) {
|
if(!expression) {
|
||||||
throw new Error(msg || "Assertion Failed");
|
throw new Error(msg || "Assertion Failed");
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (e) {
|
||||||
throw new Error(msg);
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,35 @@
|
||||||
import test from "../src/testit.js";
|
import test from "../src/testit.js";
|
||||||
|
|
||||||
export default test.it({
|
export default test.it({
|
||||||
"'like' should do truthy evaluation via =="() {
|
"'like' should do truthy evaluation via ==": function () {
|
||||||
test.assert(1 == "1");
|
test.assert(1 == '1');
|
||||||
test.assert(1);
|
test.assert(1);
|
||||||
},
|
},
|
||||||
"'equal' should do === evaluation exist"() {
|
"'equal' should do === evaluation exist": function () {
|
||||||
test.assert(1 === 1);
|
test.assert(1 === 1);
|
||||||
test.assert("hello" === "hello");
|
test.assert('hello' === 'hello');
|
||||||
},
|
},
|
||||||
"you should be able to 'pass' a test"() {
|
"you should be able to 'pass' a test": function () {
|
||||||
test.assert(1);
|
test.assert(1);
|
||||||
},
|
},
|
||||||
"you should be able to fail' a test too"() {
|
"you should be able to fail' a test too": function () {
|
||||||
try {
|
try {
|
||||||
test.assert(0);
|
test.assert(0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// correct
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"you should be able to test if something 'exists'"() {
|
"you should be able to test if something 'exists'": function () {
|
||||||
test.assert({});
|
test.assert({});
|
||||||
test.assert(typeof ({}) === "object");
|
test.assert(typeof ({}) === 'object');
|
||||||
},
|
},
|
||||||
"should be able to check types"() {
|
"should be able to check types": function () {
|
||||||
|
|
||||||
test.assert(Array.isArray([]));
|
test.assert(Array.isArray([]));
|
||||||
test.assert(typeof (123) === "number");
|
test.assert(typeof (123) === 'number');
|
||||||
|
|
||||||
test.assert(typeof ({}) === "object");
|
test.assert(typeof ({}) === 'object');
|
||||||
test.assert(typeof (true) === "boolean");
|
test.assert(typeof (true) === 'boolean');
|
||||||
test.assert(typeof (false) === "boolean");
|
test.assert(typeof (false) === 'boolean');
|
||||||
test.assert(typeof (undefined) === "undefined");
|
test.assert(typeof (undefined) === 'undefined');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import spec from "./index.spec.js";
|
import spec from "./index.spec.js";
|
||||||
|
|
||||||
spec.run(false, (r) => {
|
spec.run(false, function (r) {
|
||||||
let errors = [];
|
let errors = [];
|
||||||
|
|
||||||
document.body.style.backgroundColor = (
|
document.body.style.backgroundColor = (
|
||||||
|
@ -10,6 +10,6 @@ spec.run(false, (r) => {
|
||||||
r.pass.forEach((p) => errors.push(`<br>${p}`));
|
r.pass.forEach((p) => errors.push(`<br>${p}`));
|
||||||
r.fail.forEach((f) => errors.push(`<br><b>${f}</b>`));
|
r.fail.forEach((f) => errors.push(`<br><b>${f}</b>`));
|
||||||
|
|
||||||
document.querySelector("#errors").innerHTML = errors;
|
document.querySelector('#errors').innerHTML = errors;
|
||||||
document.querySelector("#summary").innerHTML = `| tests: ${r.pass.length + r.fail.length} | pass: ${r.pass.length} | fail: ${r.fail.length} |`;
|
document.querySelector('#summary').innerHTML = `| tests: ${r.pass.length + r.fail.length} | pass: ${r.pass.length} | fail: ${r.fail.length} |`;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue