From 394a3038c4d3a95670f81ad26df2ddcc6f70eb24 Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 5 Jan 2021 02:47:55 -0600 Subject: [PATCH] flow: testing --- app/postcss.config.js | 3 + app/yarn.lock | 267 ++++++++++++++++++++----- config/.neutrinorc.js | 6 + config/package/package.json | 5 +- config/package/test/exists.js | 9 + package.json | 1 + packages/core/package.json | 5 +- packages/core/src/latus.js | 38 ++-- packages/db/package.json | 5 +- packages/db/src/docker.js | 2 +- packages/governor/package.json | 5 +- packages/http/.neutrinorc.js | 2 +- packages/http/package.json | 7 +- packages/http/src/build/.neutrinorc.js | 12 +- packages/http/src/client/tests.js | 13 ++ packages/http/src/http.js | 17 +- packages/react/package.json | 5 +- packages/redis/package.json | 5 +- packages/redis/src/docker.js | 2 +- packages/redux/package.json | 5 +- packages/repl/package.json | 5 +- packages/socket/package.json | 5 +- packages/user/package.json | 5 +- 23 files changed, 336 insertions(+), 93 deletions(-) create mode 100644 app/postcss.config.js create mode 100644 config/package/test/exists.js create mode 100644 packages/http/src/client/tests.js diff --git a/app/postcss.config.js b/app/postcss.config.js new file mode 100644 index 0000000..9361eff --- /dev/null +++ b/app/postcss.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: {}, +}; diff --git a/app/yarn.lock b/app/yarn.lock index 23d5b89..4d7e9b8 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -886,8 +886,8 @@ "@latus/core@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fcore/-/core-2.0.0.tgz#74444a0a269246930dceb8d445b30873d7ed73a2" - integrity sha512-ob2Mbxd10yRqLRv0bNZkiZ9OWjQrHKBXxQsu++n42lWkM6A/TXudp955CemJbl5IMzBkCAG5spXiID0eIZb/9Q== + resolved "https://npm.i12e.cha0s.io/@latus%2fcore/-/core-2.0.0.tgz#f8a860fa8ef52368e25adbef28b9554e4e45bab4" + integrity sha512-rZGy5utsb22klB85SG72m2+bc92NzFMDvNbtDEVKqCtVN2DzPDUqDBcqfoFcyN6DMDtG3NhAMxw71dj0JLFZiA== dependencies: debug "4.3.1" js-yaml "3.14.0" @@ -895,8 +895,8 @@ "@latus/db@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fdb/-/db-2.0.0.tgz#09e5c797a9d18247bc07b767a82e126e3cba912a" - integrity sha512-Mg60IclWnpj/2aWy5bQm+k9tlKEQcyjexSAYMQWQLg5ZauYskdp05pB421Q3NZzD+vBP3MuKFyZlrjgueNsiLw== + resolved "https://npm.i12e.cha0s.io/@latus%2fdb/-/db-2.0.0.tgz#d0a64da1f5269ad4aa2490605e4b2763f26452bf" + integrity sha512-VLJ17QxrByag7IaO/+80PO5ZMQk/eBj65K0wuZHX8/wMobP4GzNKqbCgT0ASQS3MXCN6NiS8akTRFxCgH9p7jw== dependencies: "@latus/core" "2.0.0" debug "4.3.1" @@ -906,16 +906,16 @@ "@latus/governor@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fgovernor/-/governor-2.0.0.tgz#d725f0c021cbce515c682687931e6ba54ea5ec08" - integrity sha512-DZAAS3pnyOcHBm+P9A5j0A/DAZJGwqWHOqJbGeaMZX+lxGX/pDUzuhhFLc+utzR202O9fG+Uf94hsM2aZ6Z++A== + resolved "https://npm.i12e.cha0s.io/@latus%2fgovernor/-/governor-2.0.0.tgz#938c50afd1b9970941f9c8b67f295dd0110da0da" + integrity sha512-OLnlD5S4w2MNDvWzcpZkA6fed0HgaUWvvY4zoY6Pdb2NeDWn6vo0onOTzQwHiTrxXdNZ22tUMESxo+K2dbm1TQ== dependencies: debug "4.3.1" rate-limiter-flexible "^2.1.13" "@latus/http@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fhttp/-/http-2.0.0.tgz#e43bae8090b82afb105b3c50a491c26ab1ccf184" - integrity sha512-pE9hncMWLZFf6SR6ru6w+BoemR7VDskTHW0+BDUqhMRbukPimKZnxKaVvfORKkW2q4eJcf2ud3noGoe4Vm5h0A== + resolved "https://npm.i12e.cha0s.io/@latus%2fhttp/-/http-2.0.0.tgz#da9bed42d196b6864510b6cd0838cb16319c89c9" + integrity sha512-mnFpisdMvM44AqmPUCvSP8cgFSz2gCcB/9emietkFcAp22GmYZ//rqzjRzqDnr4NYseXfU0H3n60dIRPSBXOQQ== dependencies: "@latus/core" "2.0.0" "@neutrinojs/web" "^9.1.0" @@ -923,6 +923,7 @@ express "^4.17.1" http-proxy "^1.18.1" memfs "3.2.0" + mocha "^8" neutrino "9.4.0" webpack "^4" webpack-dev-middleware "^4.0.2" @@ -932,8 +933,8 @@ "@latus/react@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2freact/-/react-2.0.0.tgz#07021682373488f24cc80fa0f1f2dc9bb088764d" - integrity sha512-AsLYTR4YJTbLrXJTY5zE3skq7oqhcVj5qjMSgK7mGwCp0QEC7xJob6TJKE2aamklWKV1DWYKtJMexb+F2M8Gxg== + resolved "https://npm.i12e.cha0s.io/@latus%2freact/-/react-2.0.0.tgz#12161a30c2b3c5b0c26be7903524546b84cf4b3e" + integrity sha512-hh4mzDvb7y8bQ9fUo0Vf9XafIbh+mLl3i/FvFifhhQk0R39y5PXJw3TQ/zxb8eIwtRbrm1+LpLXXfGUH0YVosw== dependencies: "@neutrinojs/react" "^9.4.0" debug "4.3.1" @@ -946,8 +947,8 @@ "@latus/redis@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fredis/-/redis-2.0.0.tgz#f50de2f442e04055ef812d1d3b2b9966280b4a9a" - integrity sha512-InP/9SHqKBk55v5M/xNewcxbtCQ+jTML8Y2UOdWHwU3wAKNJcRaFc7y1ydemUrMhxqTD6OGRuXDk9WGL47VSmQ== + resolved "https://npm.i12e.cha0s.io/@latus%2fredis/-/redis-2.0.0.tgz#64cc87516a07b96d7d8478f55534157d9f03bcd0" + integrity sha512-sZ4L3VsGGrHialyt0JYulwkHHeEOq9XTszxqOoYaAxxFavRNEaZo6JIEhEk7UaeGx40QSEs4sZkItxuRZmvXUQ== dependencies: connect-redis "^5.0.0" debug "4.3.1" @@ -958,15 +959,15 @@ "@latus/repl@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2frepl/-/repl-2.0.0.tgz#43be27bf288cf2ea21c87d723debdfc21712d028" - integrity sha512-9Q2pBEYZ4n6p6ZJnZFcYWSH3dyLFTlM/wLBz5nnErjrLpQAYzXNO4TAyUPXw1rrZ53icFB4TtxyZGoon0wAaLQ== + resolved "https://npm.i12e.cha0s.io/@latus%2frepl/-/repl-2.0.0.tgz#ee220133c7cce98b466f3f728b3744c92e0d45e0" + integrity sha512-UGykc1D6QNLIBRX4HsFzLEoCL4omMmymQYRihGGnNuhsQ/l9wuwM9zFZZzBGkmud4dzfOIdlM3r3HShpSuJsBg== dependencies: debug "4.3.1" "@latus/socket@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fsocket/-/socket-2.0.0.tgz#f730a77aae7c1eefd0beadb0ddfcf56d85bf1c66" - integrity sha512-jWN6veQAXSST37Jy+lidwxnqyN/N1N8WI2bhyvQFbCQz77/5auFnnIy7uwLPIncEXu0vnnKBT84oc11fBlubTw== + resolved "https://npm.i12e.cha0s.io/@latus%2fsocket/-/socket-2.0.0.tgz#9183d1f349033a6ca76f8403fbd743163bb691e9" + integrity sha512-KuMofkVXMTvg5HJTQDq/1BZAoPk+VzpWZ2yAcj741luwOvS/fZeywyQc5WYwvc13LZdSQ8dim2JMOevTBqDAcA== dependencies: "@latus/core" "2.0.0" "@latus/http" "2.0.0" @@ -979,8 +980,8 @@ "@latus/user@2.0.0": version "2.0.0" - resolved "https://npm.i12e.cha0s.io/@latus%2fuser/-/user-2.0.0.tgz#e1c97ebbc9be263b2941424ae06924438ea47a14" - integrity sha512-xrCs1T/yKyCw1Bkr+aHTqYRtGWsk+2LxTwb5U/LpEkg1J/1H0/jwrOI1JffVOPGS0SlFpm1HetljLAtdqpXxjQ== + resolved "https://npm.i12e.cha0s.io/@latus%2fuser/-/user-2.0.0.tgz#d59fa8b56131766e811e4406b124eaf11ffb2231" + integrity sha512-GYukwYQCbzJP3AWQRU8uCA45SCOrh/JM5VCvnGlkqWlX2qITyKY6hblUa+5qf/JH/n5Tsei6WZ6atRESMMbSZQ== dependencies: bcrypt "^5.0.0" debug "4.3.1" @@ -1227,6 +1228,11 @@ "@types/webpack-sources" "*" source-map "^0.6.0" +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://npm.i12e.cha0s.io/@ungap%2fpromise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://npm.i12e.cha0s.io/@webassemblyjs%2fast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" @@ -1440,6 +1446,11 @@ amdefine@>=0.0.4: resolved "https://npm.i12e.cha0s.io/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://npm.i12e.cha0s.io/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + ansi-colors@^3.0.0: version "3.2.4" resolved "https://npm.i12e.cha0s.io/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" @@ -1985,6 +1996,11 @@ brorand@^1.0.1: resolved "https://npm.i12e.cha0s.io/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://npm.i12e.cha0s.io/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + browserify-aes@^1.0.0, browserify-aes@^1.0.4: version "1.2.0" resolved "https://npm.i12e.cha0s.io/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -2211,6 +2227,11 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://npm.i12e.cha0s.io/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +camelcase@^6.0.0: + version "6.2.0" + resolved "https://npm.i12e.cha0s.io/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" + integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== + caniuse-lite@^1.0.30001165: version "1.0.30001173" resolved "https://npm.i12e.cha0s.io/caniuse-lite/-/caniuse-lite-1.0.30001173.tgz#3c47bbe3cd6d7a9eda7f50ac016d158005569f56" @@ -2241,7 +2262,7 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.0" resolved "https://npm.i12e.cha0s.io/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== @@ -2254,6 +2275,21 @@ chardet@^0.7.0: resolved "https://npm.i12e.cha0s.io/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +chokidar@3.4.3, chokidar@^3.4.1: + version "3.4.3" + resolved "https://npm.i12e.cha0s.io/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" + integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.1.2" + chokidar@^2.1.8: version "2.1.8" resolved "https://npm.i12e.cha0s.io/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" @@ -2273,21 +2309,6 @@ chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" -chokidar@^3.4.1: - version "3.4.3" - resolved "https://npm.i12e.cha0s.io/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" - integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== - dependencies: - anymatch "~3.1.1" - braces "~3.0.2" - glob-parent "~5.1.0" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.5.0" - optionalDependencies: - fsevents "~2.1.2" - chownr@^1.1.1: version "1.1.4" resolved "https://npm.i12e.cha0s.io/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -2763,6 +2784,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: dependencies: ms "2.0.0" +debug@4.2.0: + version "4.2.0" + resolved "https://npm.i12e.cha0s.io/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + debug@4.3.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.3.1" resolved "https://npm.i12e.cha0s.io/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" @@ -2796,6 +2824,11 @@ decamelize@^1.1.2, decamelize@^1.2.0: resolved "https://npm.i12e.cha0s.io/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decamelize@^4.0.0: + version "4.0.0" + resolved "https://npm.i12e.cha0s.io/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://npm.i12e.cha0s.io/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -2936,6 +2969,11 @@ detect-node@^2.0.4: resolved "https://npm.i12e.cha0s.io/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== +diff@4.0.2: + version "4.0.2" + resolved "https://npm.i12e.cha0s.io/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://npm.i12e.cha0s.io/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -3289,6 +3327,11 @@ escape-html@~1.0.3: resolved "https://npm.i12e.cha0s.io/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-string-regexp@4.0.0: + version "4.0.0" + resolved "https://npm.i12e.cha0s.io/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://npm.i12e.cha0s.io/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -3822,6 +3865,14 @@ find-root@^1.1.0: resolved "https://npm.i12e.cha0s.io/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== +find-up@5.0.0: + version "5.0.0" + resolved "https://npm.i12e.cha0s.io/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + find-up@^1.0.0: version "1.1.2" resolved "https://npm.i12e.cha0s.io/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -3871,6 +3922,11 @@ flat-cache@^2.0.1: rimraf "2.6.3" write "1.0.3" +flat@^5.0.2: + version "5.0.2" + resolved "https://npm.i12e.cha0s.io/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatted@^2.0.0: version "2.0.2" resolved "https://npm.i12e.cha0s.io/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" @@ -4085,7 +4141,7 @@ glob-parent@^5.0.0, glob-parent@~5.1.0: dependencies: is-glob "^4.0.1" -glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: +glob@7.1.6, glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: version "7.1.6" resolved "https://npm.i12e.cha0s.io/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -4190,6 +4246,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://npm.i12e.cha0s.io/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +growl@1.10.5: + version "1.10.5" + resolved "https://npm.i12e.cha0s.io/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + handle-thing@^2.0.0: version "2.0.1" resolved "https://npm.i12e.cha0s.io/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -4302,7 +4363,7 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" -he@1.2.x, he@^1.2.0: +he@1.2.0, he@1.2.x, he@^1.2.0: version "1.2.0" resolved "https://npm.i12e.cha0s.io/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -4889,6 +4950,11 @@ is-plain-obj@^1.0.0: resolved "https://npm.i12e.cha0s.io/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://npm.i12e.cha0s.io/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://npm.i12e.cha0s.io/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -5213,6 +5279,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://npm.i12e.cha0s.io/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://npm.i12e.cha0s.io/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -5258,6 +5331,13 @@ lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.1 resolved "https://npm.i12e.cha0s.io/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +log-symbols@4.0.0: + version "4.0.0" + resolved "https://npm.i12e.cha0s.io/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + loglevel@^1.6.8: version "1.7.1" resolved "https://npm.i12e.cha0s.io/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" @@ -5518,7 +5598,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://npm.i12e.cha0s.io/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@^3.0.4, minimatch@~3.0.2: +minimatch@3.0.4, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://npm.i12e.cha0s.io/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5596,6 +5676,37 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://npm.i12e.cha0s.io/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mocha@^8: + version "8.2.1" + resolved "https://npm.i12e.cha0s.io/mocha/-/mocha-8.2.1.tgz#f2fa68817ed0e53343d989df65ccd358bc3a4b39" + integrity sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.4.3" + debug "4.2.0" + diff "4.0.2" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "3.14.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.2" + nanoid "3.1.12" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "7.2.0" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.0.2" + yargs "13.3.2" + yargs-parser "13.1.2" + yargs-unparser "2.0.0" + moment-timezone@^0.5.31: version "0.5.32" resolved "https://npm.i12e.cha0s.io/moment-timezone/-/moment-timezone-0.5.32.tgz#db7677cc3cc680fd30303ebd90b0da1ca0dfecc2" @@ -5684,6 +5795,11 @@ nan@^2.12.1, nan@^2.13.2: resolved "https://npm.i12e.cha0s.io/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== +nanoid@3.1.12: + version "3.1.12" + resolved "https://npm.i12e.cha0s.io/nanoid/-/nanoid-3.1.12.tgz#6f7736c62e8d39421601e4a0c77623a97ea69654" + integrity sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A== + nanomatch@^1.2.9: version "1.2.13" resolved "https://npm.i12e.cha0s.io/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -6191,6 +6307,13 @@ p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.2.1: dependencies: p-try "^2.0.0" +p-limit@^3.0.2: + version "3.1.0" + resolved "https://npm.i12e.cha0s.io/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://npm.i12e.cha0s.io/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -6212,6 +6335,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://npm.i12e.cha0s.io/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-map@^2.0.0: version "2.1.0" resolved "https://npm.i12e.cha0s.io/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" @@ -7442,6 +7572,13 @@ sequelize@^6.3.5: validator "^10.11.0" wkx "^0.5.0" +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://npm.i12e.cha0s.io/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + serialize-javascript@^4.0.0: version "4.0.0" resolved "https://npm.i12e.cha0s.io/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" @@ -8022,7 +8159,7 @@ strip-indent@^1.0.1: dependencies: get-stdin "^4.0.1" -strip-json-comments@^3.0.1: +strip-json-comments@3.1.1, strip-json-comments@^3.0.1: version "3.1.1" resolved "https://npm.i12e.cha0s.io/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -8040,6 +8177,13 @@ style-loader@^1.3.0: loader-utils "^2.0.0" schema-utils "^2.7.0" +supports-color@7.2.0, supports-color@^7.1.0: + version "7.2.0" + resolved "https://npm.i12e.cha0s.io/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + supports-color@^2.0.0: version "2.0.0" resolved "https://npm.i12e.cha0s.io/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -8059,13 +8203,6 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -supports-color@^7.1.0: - version "7.2.0" - resolved "https://npm.i12e.cha0s.io/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - table@^5.2.3: version "5.4.6" resolved "https://npm.i12e.cha0s.io/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" @@ -8742,6 +8879,13 @@ which-module@^2.0.0: resolved "https://npm.i12e.cha0s.io/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= +which@2.0.2, which@^2.0.1, which@^2.0.2: + version "2.0.2" + resolved "https://npm.i12e.cha0s.io/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + which@^1.2.14, which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://npm.i12e.cha0s.io/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -8749,14 +8893,7 @@ which@^1.2.14, which@^1.2.9, which@^1.3.1: dependencies: isexe "^2.0.0" -which@^2.0.1, which@^2.0.2: - version "2.0.2" - resolved "https://npm.i12e.cha0s.io/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: +wide-align@1.1.3, wide-align@^1.1.0: version "1.1.3" resolved "https://npm.i12e.cha0s.io/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== @@ -8782,6 +8919,11 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" +workerpool@6.0.2: + version "6.0.2" + resolved "https://npm.i12e.cha0s.io/workerpool/-/workerpool-6.0.2.tgz#e241b43d8d033f1beb52c7851069456039d1d438" + integrity sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q== + wrap-ansi@^5.1.0: version "5.1.0" resolved "https://npm.i12e.cha0s.io/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" @@ -8852,7 +8994,7 @@ yallist@^4.0.0: resolved "https://npm.i12e.cha0s.io/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@^13.1.2: +yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" resolved "https://npm.i12e.cha0s.io/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== @@ -8870,7 +9012,17 @@ yargs-parser@^20.2.4: resolved "https://npm.i12e.cha0s.io/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== -yargs@^13.3.2: +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://npm.i12e.cha0s.io/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@13.3.2, yargs@^13.3.2: version "13.3.2" resolved "https://npm.i12e.cha0s.io/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== @@ -8890,3 +9042,8 @@ yeast@0.1.2: version "0.1.2" resolved "https://npm.i12e.cha0s.io/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" integrity sha1-AI4G2AlDIMNy28L47XagymyKxBk= + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://npm.i12e.cha0s.io/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/config/.neutrinorc.js b/config/.neutrinorc.js index 56e8657..9bec9fb 100644 --- a/config/.neutrinorc.js +++ b/config/.neutrinorc.js @@ -1,6 +1,7 @@ const {basename, dirname, extname, join} = require('path'); const airbnbBase = require('@neutrinojs/airbnb-base'); +const glob = require('glob'); const mocha = require('@neutrinojs/mocha'); const react = require('@neutrinojs/react'); const nodeExternals = require('webpack-node-externals'); @@ -39,6 +40,11 @@ module.exports = { const trimmed = join(dirname(file), basename(file, extname(file))); neutrino.options.mains[trimmed] = {entry: isIndex ? file : `./src/${trimmed}`}; }); + const testPaths = glob.sync('./test/*.js'); + if (testPaths.length > 0) { + const testEntry = neutrino.config.entry('test').clear(); + testPaths.forEach((path) => testEntry.add(path)); + } neutrino.options.output = '.'; react({ clean: false, diff --git a/config/package/package.json b/config/package/package.json index 343f6ed..884ac4b 100644 --- a/config/package/package.json +++ b/config/package/package.json @@ -17,7 +17,9 @@ }, "files": [ "index.js", - "index.js.map" + "index.js.map", + "test.js", + "test.js.map" ], "dependencies": { "debug": "4.3.1" @@ -30,6 +32,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/config/package/test/exists.js b/config/package/test/exists.js new file mode 100644 index 0000000..de4b693 --- /dev/null +++ b/config/package/test/exists.js @@ -0,0 +1,9 @@ +import {expect} from 'chai'; + +const {name} = require('../package.json'); + +describe(name, () => { + it('exists', () => { + expect(true).to.be.true; + }) +}); diff --git a/package.json b/package.json index 9d9f829..bd66190 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "lerna": "^3.22.1", "mocha": "^8", "neutrino": "^9.4.0", diff --git a/packages/core/package.json b/packages/core/package.json index 8160ff4..75fa124 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -23,7 +23,9 @@ "server.js", "server.js.map", "start.js", - "start.js.map" + "start.js.map", + "test.js", + "test.js.map" ], "dependencies": { "debug": "4.3.1", @@ -38,6 +40,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/core/src/latus.js b/packages/core/src/latus.js index 13e4862..65a4f39 100644 --- a/packages/core/src/latus.js +++ b/packages/core/src/latus.js @@ -52,24 +52,6 @@ export default class Latus { debug('latus config: %O', this.config); } - static mock(modules, config) { - // eslint-disable-next-line no-eval - const R = eval('require'); - return new Latus({ - config: { - ...Object.fromEntries( - modules.map((module) => [Array.isArray(module) ? module[0] : module, {}]), - ), - ...config, - }, - modules: Object.fromEntries( - modules - .map((module) => (Array.isArray(module) ? module : [module, module])) - .map(([key, path]) => [key, R(path)]), - ), - }); - } - static create(config = readConfig()) { // eslint-disable-next-line no-eval const R = eval('require'); @@ -189,6 +171,26 @@ export default class Latus { } } + static mock(modules, config = {}) { + // eslint-disable-next-line no-eval + // const R = eval('require'); + return new Latus({ + config: { + ...Object.fromEntries(Object.keys(modules).map((path) => [path, {}])), + // ...Object.fromEntries( + // modules.map((module) => [Array.isArray(module) ? module[0] : module, {}]), + // ), + ...config, + }, + modules, + // modules: Object.fromEntries( + // modules + // .map((module) => (Array.isArray(module) ? module : [module, module])) + // .map(([key, path]) => [key, R(path)]), + // ), + }); + } + static runtimePath(path) { // eslint-disable-next-line no-eval const R = eval('require'); diff --git a/packages/db/package.json b/packages/db/package.json index c7d04e9..ea704d0 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -19,7 +19,9 @@ "index.js", "index.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "@latus/core": "2.0.0", @@ -36,6 +38,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/db/src/docker.js b/packages/db/src/docker.js index a31802f..9533f00 100644 --- a/packages/db/src/docker.js +++ b/packages/db/src/docker.js @@ -32,7 +32,7 @@ export default function createDockerContainer(latus) { 'mysql', '--default-authentication-plugin=mysql_native_password', ); - const {pid} = spawn('docker', args, {stdio: 'inherit'}); + const {pid} = spawn('docker', args, {stdio: 'ignore'}); process.on('exit', () => process.kill(pid)); process.on('SIGINT', () => process.exit()); } diff --git a/packages/governor/package.json b/packages/governor/package.json index 54caa0e..03f459e 100644 --- a/packages/governor/package.json +++ b/packages/governor/package.json @@ -21,7 +21,9 @@ "index.js", "index.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "debug": "4.3.1", @@ -38,6 +40,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/http/.neutrinorc.js b/packages/http/.neutrinorc.js index 7a17680..9c9a5fa 100644 --- a/packages/http/.neutrinorc.js +++ b/packages/http/.neutrinorc.js @@ -3,7 +3,7 @@ const copy = require('@neutrinojs/copy'); module.exports = require('../../config/.neutrinorc'); module.exports.use.push(copy({ - patterns: ['index.js', 'index.ejs'].map((path) => ({ + patterns: ['index.js', 'index.ejs', 'tests.js'].map((path) => ({ from: `src/client/${path}`, to: 'client', })).concat(['.neutrinorc.js', 'client-plugins.js', 'webpack.config.js'].map((path) => ({ diff --git a/packages/http/package.json b/packages/http/package.json index 0eb6c0b..3a43413 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -21,7 +21,9 @@ "index.js", "index.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "@latus/core": "2.0.0", @@ -30,6 +32,7 @@ "express": "^4.17.1", "http-proxy": "^1.18.1", "memfs": "3.2.0", + "mocha": "^8", "neutrino": "9.4.0", "webpack": "^4", "webpack-dev-middleware": "^4.0.2", @@ -45,7 +48,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", - "mocha": "^8", + "glob": "7.1.6", "neutrino": "9.4.0", "webpack-cli": "^3" } diff --git a/packages/http/src/build/.neutrinorc.js b/packages/http/src/build/.neutrinorc.js index a9518cf..53078de 100644 --- a/packages/http/src/build/.neutrinorc.js +++ b/packages/http/src/build/.neutrinorc.js @@ -26,6 +26,7 @@ const client = { neutrino.options.root = fs.realpathSync(root); neutrino.options.source = 'client'; neutrino.options.mains.index = 'index'; + neutrino.options.mains.tests = {entry: './client/tests'}; const output = 'build'; neutrino.options.output = join( isAbsolute(output) @@ -46,8 +47,8 @@ const client = { (neutrino) => { neutrino.config .plugin('environment') - .use(EnvironmentPlugin, [{ - SIDE: 'client', + .use(DefinePlugin, [{ + 'process.env.SIDE': JSON.stringify('client'), }]); }, (neutrino) => { @@ -78,12 +79,17 @@ const client = { .map((path) => Latus.runtimePath(path)); const pathMap = paths.map((path) => `'${path}': require('${path}')`).join(', '); plugin.writeModule('node_modules/@latus/core/virtual', [ - '/* eslint-disable global-require, no-undef */', 'window.$$latus = {', ' config: window.$$latusConfig,', ` modules: {${pathMap}},`, '};', ].join('\n')); + const testPaths = paths + .map((path) => Latus.runtimePath(`${path}/test`)) + .filter((path) => !!path); + plugin.writeModule(`node_modules/@latus/core/tests`, [ + testPaths.map((path) => `require('${path}')`), + ].join('\n')); }); } diff --git a/packages/http/src/client/tests.js b/packages/http/src/client/tests.js new file mode 100644 index 0000000..8a287d5 --- /dev/null +++ b/packages/http/src/client/tests.js @@ -0,0 +1,13 @@ +const mochaDiv = document.createElement('div'); +mochaDiv.id = 'mocha'; +window.document.body.appendChild(mochaDiv); + +require('mocha/mocha.css'); +const mocha = require('mocha/mocha'); + +mocha.setup('bdd'); + +// eslint-disable-next-line import/no-unresolved +require('@latus/core/tests'); + +mocha.run(); diff --git a/packages/http/src/http.js b/packages/http/src/http.js index 021acb9..be9e29d 100644 --- a/packages/http/src/http.js +++ b/packages/http/src/http.js @@ -1,11 +1,12 @@ import {createReadStream} from 'fs'; import {createServer, ServerResponse} from 'http'; -import {join} from 'path'; +import {dirname, join} from 'path'; -import {arrayFlatten} from '@latus/core'; +import {arrayFlatten, Latus} from '@latus/core'; import express from 'express'; import httpProxy from 'http-proxy'; +import clientPlugins from './build/client-plugins'; import configMiddleware from './config-middleware'; const { @@ -39,8 +40,20 @@ export const createHttpServer = async (latus) => { // Serve latus. app.get('/latus.config.js', requestMiddleware, configMiddleware(latus)); app.use(express.static(join(process.cwd(), build))); + // eslint-disable-next-line no-eval if ('production' !== eval('process.env.NODE_ENV')) { + const middlewares = Object.keys(await clientPlugins(latus)) + .map((path) => Latus.runtimePath(path)) + .filter((path) => !!Latus.runtimePath(`${path}/test`)) + .map((path) => { + // eslint-disable-next-line no-eval + const staticPath = dirname(eval('require').resolve(path)); + return express.static(staticPath); + }); + for (let i = 0; i < middlewares.length; i++) { + app.use(middlewares[i]); + } const proxy = httpProxy.createProxyServer({ secure: false, target: `http://127.0.0.1:${devPort}`, diff --git a/packages/react/package.json b/packages/react/package.json index 6c47963..12044c1 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -21,7 +21,9 @@ "client.js", "client.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "@neutrinojs/react": "^9.4.0", @@ -41,6 +43,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/redis/package.json b/packages/redis/package.json index 7593bf2..2f46ec3 100644 --- a/packages/redis/package.json +++ b/packages/redis/package.json @@ -21,7 +21,9 @@ "session/server.js", "session/server.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "connect-redis": "^5.0.0", @@ -39,6 +41,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/redis/src/docker.js b/packages/redis/src/docker.js index 86bef3d..0fb13fc 100644 --- a/packages/redis/src/docker.js +++ b/packages/redis/src/docker.js @@ -26,7 +26,7 @@ export default async function createDockerContainer(latus) { args.push( 'redis', ); - const {pid} = spawn('docker', args, {stdio: 'inherit'}); + const {pid} = spawn('docker', args, {stdio: 'ignore'}); process.on('exit', () => process.kill(pid)); process.on('SIGINT', () => process.exit()); // eslint-disable-next-line no-constant-condition diff --git a/packages/redux/package.json b/packages/redux/package.json index f3403c7..58ef42a 100644 --- a/packages/redux/package.json +++ b/packages/redux/package.json @@ -21,7 +21,9 @@ "index.js", "index.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "@latus/core": "2.0.0", @@ -41,6 +43,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "react": "^17.0.1", diff --git a/packages/repl/package.json b/packages/repl/package.json index 29cb59a..9830526 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -17,7 +17,9 @@ }, "files": [ "index.js", - "index.js.map" + "index.js.map", + "test.js", + "test.js.map" ], "dependencies": { "debug": "4.3.1" @@ -30,6 +32,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/socket/package.json b/packages/socket/package.json index e7a3852..3586b10 100644 --- a/packages/socket/package.json +++ b/packages/socket/package.json @@ -23,7 +23,9 @@ "index.js", "index.js.map", "server.js", - "server.js.map" + "server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "@latus/core": "2.0.0", @@ -44,6 +46,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4", diff --git a/packages/user/package.json b/packages/user/package.json index 048d6e4..b053b1c 100644 --- a/packages/user/package.json +++ b/packages/user/package.json @@ -28,7 +28,9 @@ "server.js", "server.js.map", "session/server.js", - "session/server.js.map" + "session/server.js.map", + "test.js", + "test.js.map" ], "dependencies": { "bcrypt": "^5.0.0", @@ -49,6 +51,7 @@ "chai": "4.2.0", "eslint": "^7", "eslint-import-resolver-webpack": "0.13.0", + "glob": "7.1.6", "mocha": "^8", "neutrino": "^9.4.0", "webpack": "^4",