Skip to content
Snippets Groups Projects
Verified Commit 63d69ed2 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: commit save point

parent 5d18d797
No related branches found
No related tags found
No related merge requests found
Showing
with 1297 additions and 61 deletions
......@@ -38,9 +38,16 @@ export {typeOf}
function typeOf(value) {
let type = ({}).toString.call(value).match(/\s([a-zA-Z]+)/)[1];
if ('Object' === type) {
const name=value.constructor.name;
if (name) {
return name.toLowerCase();
}
const results = (/^(class|function)\s+(\w+)/).exec(value.constructor.toString());
type = (results && results.length > 2) ? results[2] : '';
}
return type.toLowerCase();
}
......@@ -13,10 +13,25 @@ NPM ?= npm
EXECUTABLES = $(EXECUTABLES:-) $(npm);
NODE_PACKAGES := $(shell find $(PROJECT_ROOT) -type f -name 'package.json' -not -path '*/node_modules/*')
NODE_MODULES := $(shell find $(PROJECT_ROOT) -maxdepth 2 -type d -name 'node_modules')
$(NODE_MODULES).modified: $(NODE_PACKAGES)
@echo "node_modules modified"
echo $@
a: $(NODE_MODULES).modified
@echo "node_modules modified"
echo $@
NODE_ROOT_DIR ?= $(PROJECT_ROOT)
NODE_MODULES_DIR ?= $(NODE_ROOT_DIR)node_modules/
NODE_MODULES_BIN_DIR ?= $(NODE_MODULES_DIR).bin/
ESBUILD ?= $(NODE_MODULES_BIN_DIR)esbuild
WEBPACK ?= $(NODE_MODULES_BIN_DIR)webpack
BABEL ?= $(NODE_MODULES_BIN_DIR)babel
UGLIFYJS ?= $(NODE_MODULES_BIN_DIR)uglifyjs
......
#.PHONY: create-polyfill-monster
### create polyfill.io url
#create-polyfill-monster: $(MONSTER_SOURCE_FILES)
# $(ECHOMARKER) "create and replace polyfill"
# $(QUIET) $(SCRIPT_PATH)create-polyfill.sh $(MJS_RELATIVE_SOURCE_FILES)
\ No newline at end of file
.PHONY: create-polyfill-monster
## create polyfill.io url
create-polyfill-monster: $(MONSTER_SOURCE_FILES)
$(ECHOMARKER) "create and replace polyfill"
$(QUIET) $(DEVELOPMENT_SCRIPTS_PATH)create-polyfill.sh $(MJS_RELATIVE_SOURCE_FILES)
.PHONY: test-browser-monster
## create test-browser-monster
test-browser-monster: create-polyfill-monster
$(QUIET) $(ECHOMARKER) "create browser test and start chrome"
$(QUIET) $(FIND) $(TEST_PATH)cases -type f | $(SED) "s|^$(TEST_PATH)cases||" > $(TEST_PATH)web/import.js
$(QUIET) $(SED) -i 's|^|import "../cases|' $(TEST_PATH)web/import.js
$(QUIET) $(SED) -i 's|$$|";|' $(TEST_PATH)web/import.js
$(QUIET) $(SED) -i "1 i import \"./prepare.js\";" $(TEST_PATH)web/import.js
$(QUIET) $(SED) -i "1 i /** this file was created automatically by the make target test-browser-monster */" $(TEST_PATH)web/import.js
$(ESBUILD) --platform=browser --sourcemap=inline --external:jsdom --external:process --external:crypto --bundle $(TEST_PATH)web/import.js --outfile=$(TEST_PATH)web/tests.js
# $(QUIET) $(CD) $(MONSTER_BUILD_TEST_BROWSER_DIR); $(WEBPACK) ; $(CD) -
$(QUIET) $(SED) -i -E "/<h1/s_.*_ <h1 style='margin-bottom: 0.1em;'>Monster $(PROJECT_VERSION)</h1>_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
$(QUIET) $(SED) -i -E "/id=\"lastupdate\"/s_.*_ <div id=\"lastupdate\" style='font-size:0.7em'>last update $(shell date)</div>_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
$(QUIET) $(SED) -i -E "s_src=\"([\"]*)\.js.*\"_src=\"\1.js?r=$(shell date +"%T")\"_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
$(QUIET) $(SED) -i -E "s_dist/([0-9]+\.[0-9]+\.[0-9]+)*/dist/monster_dist/$(PROJECT_VERSION)/dist/monster_" $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
#$(QUIET) if $(OPENBROWSER) ; then google-chrome --profile-directory="Default" $(TEST_PATH)web/test.html ; fi
This diff is collapsed.
......@@ -14,6 +14,7 @@
"@peculiar/webcrypto": "^1.4.0",
"btoa": "^1.2.1",
"c8": "^7.12.0",
"esbuild": "^0.14.53",
"chai": "^4.3.6",
"chai-dom": "^1.11.0",
"clean-jsdoc-theme": "^4.1.6",
......
......@@ -11,14 +11,14 @@ describe('RestAPI', function () {
let returnStatus;
afterEach(() => {
global['fetch'] = fetchReference;
globalThis['fetch'] = fetchReference;
});
beforeEach(() => {
returnStatus = 200;
fetchReference = global['fetch'];
global['fetch'] = function (url, options) {
fetchReference = globalThis['fetch'];
globalThis['fetch'] = function (url, options) {
if (!url) throw new Error('missing url')
......
......@@ -10,13 +10,13 @@ let localStorageReference;
describe('LocalStorage', function () {
afterEach(() => {
global['localStorage'] = localStorageReference;
globalThis['localStorage'] = localStorageReference;
});
beforeEach(function () {
localStorageReference = global['localStorage']
global['localStorage'] = createStorage();
localStorageReference = globalThis['localStorage']
globalThis['localStorage'] = createStorage();
})
......
......@@ -10,13 +10,13 @@ let storageReference;
describe('SessionStorage', function () {
afterEach(() => {
global['sessionStorage'] = storageReference;
globalThis['sessionStorage'] = storageReference;
});
beforeEach(function () {
storageReference = global['sessionStorage']
global['sessionStorage'] = createStorage();
storageReference = globalThis['sessionStorage']
globalThis['sessionStorage'] = createStorage();
})
......
"use strict";
import * as Crypto from "@peculiar/webcrypto";
import {expect} from "chai"
import {Pipe} from "../../../../application/source/data/pipe.mjs";
import {initJSDOM} from "../../util/jsdom.mjs";
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
}
describe('Pipe', function () {
before(function (done) {
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
});
describe('run different pipes', function () {
[
['path:b | if:x:\\ ', {a:true}, ' '], // '\\ '.length ↦ 2
......
"use strict";
import * as Crypto from "@peculiar/webcrypto";
import {expect} from "chai"
import {Transformer} from "../../../../application/source/data/transformer.mjs";
import {initJSDOM} from "../../util/jsdom.mjs";
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
}
describe('Transformer', function () {
before(function (done) {
initJSDOM().then(() => {
let promises = []
promises.push(initJSDOM());
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
});
describe('Transformer.run()', function () {
......
......@@ -33,8 +33,8 @@ describe('Data', function () {
initMutationObserverForTesting()
returnStatus = 200;
fetchReference = global['fetch'];
global['fetch'] = function (url, options) {
fetchReference = globalThis['fetch'];
globalThis['fetch'] = function (url, options) {
if (!url) throw new Error('missing url')
......@@ -55,7 +55,7 @@ describe('Data', function () {
})
afterEach(() => {
global['fetch'] = fetchReference;
globalThis['fetch'] = fetchReference;
cleanupDOMFromTesting();
})
......
......@@ -17,7 +17,7 @@ describe('ResourceManager', function () {
});
afterEach(() => {
global['fetch'] = fetchReference;
globalThis['fetch'] = fetchReference;
cleanupDOMFromTesting();
})
......@@ -26,8 +26,8 @@ describe('ResourceManager', function () {
initMutationObserverForTesting()
returnStatus = 200;
fetchReference = global['fetch'];
global['fetch'] = function (url, options) {
fetchReference = globalThis['fetch'];
globalThis['fetch'] = function (url, options) {
if (!url) throw new Error('missing url')
......
/** nodejs doesnt support window.crypt */
import {expect} from "chai"
import {getGlobal} from "../../../../application/source/types/global.mjs";
import * as Crypto from "@peculiar/webcrypto";
import {random} from "../../../../application/source/math/random.mjs";
import {initJSDOM} from "../../util/jsdom.mjs";
const global = getGlobal();
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
}
describe('Math', function () {
before(function (done) {
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
});
describe('.random()', function () {
......
import {ID} from "../../../../application/source/types/id.mjs";
import {expect} from "chai"
import {initJSDOM} from "../../util/jsdom.mjs";
import * as Crypto from "@peculiar/webcrypto";
describe('ID', function () {
before(function (done) {
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
describe('ID', function () {
Promise.all(promises).then(() => {
done()
});
});
describe('.toString()', function () {
let id = new ID()
......
......@@ -12,17 +12,30 @@ import {
} from "../../../../application/source/types/is.mjs";
import * as Crypto from "@peculiar/webcrypto";
if(!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
}
import {ID} from "../../../../application/source/types/id.mjs"
import {expect} from "chai"
import {initJSDOM} from "../../util/jsdom.mjs";
describe('Is', function () {
before(function (done) {
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
});
describe('.isPrimitive()', function () {
[
......
import {RandomID} from "../../../../application/source/types/randomid.mjs";
import {expect} from "chai"
import {initJSDOM} from "../../util/jsdom.mjs";
import * as Crypto from "@peculiar/webcrypto";
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
describe('RandomID', function () {
before(function (done) {
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
describe('RandomID', function () {
Promise.all(promises).then(() => {
done()
});
});
describe('.toString()', function () {
let id = new RandomID()
......
import * as Crypto from "@peculiar/webcrypto";
import {expect} from "chai"
import {escapeString} from "../../../../application/source/types/regex.mjs"
import {initJSDOM} from "../../util/jsdom.mjs";
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
}
describe('escapeString', function () {
before(function (done) {
let promises = []
promises.push(initJSDOM());
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
});
[
['test1', 'test1'],
......
......@@ -28,7 +28,7 @@ describe('typeOf', function () {
[[], 'array'],
['', 'string'],
[new Error, 'error'],
[new Stack(), 'stack']
[new Stack, 'stack']
].forEach(function (data) {
......
import * as Crypto from "@peculiar/webcrypto";
import {expect} from "chai"
import {UUID} from "../../../../application/source/types/uuid.mjs";
import {initJSDOM} from "../../util/jsdom.mjs";
if (!global['crypto']) {
global['crypto'] = new Crypto.Crypto();
describe('UUID', function () {
before(function (done) {
let promises = []
if(!globalThis['crypto']) {
promises.push(import("@peculiar/webcrypto").then(m => {
globalThis['crypto'] = new m.Crypto();
return true;
}))
}
Promise.all(promises).then(() => {
done()
});
describe('UUID', function () {
});
describe('.toString()', function () {
let uuid = new UUID()
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment