Comparing version 3.0.9 to 3.0.10
@@ -55,2 +55,8 @@ 'use strict'; | ||
const broadcast = (app, data) => { | ||
for (const thread of app.threads.values()) { | ||
thread.postMessage(data); | ||
} | ||
}; | ||
const startWorker = async (app, kind, port, id = ++impress.lastWorkerId) => { | ||
@@ -85,2 +91,3 @@ const workerData = { id, kind, root: app.root, path: app.path, port }; | ||
impress.console.info(`App started: ${app.path}`); | ||
broadcast(app, { name: 'ready' }); | ||
} | ||
@@ -183,9 +190,2 @@ }, | ||
const stopApplication = (dir) => { | ||
const app = impress.applications.get(dir); | ||
for (const thread of app.threads.values()) { | ||
thread.postMessage({ name: 'stop' }); | ||
} | ||
}; | ||
const stop = async (code = 0) => { | ||
@@ -204,3 +204,3 @@ const portsClosed = new Promise((resolve) => { | ||
for (const app of impress.applications.values()) { | ||
stopApplication(app.path); | ||
broadcast(app, { name: 'stop' }); | ||
} | ||
@@ -207,0 +207,0 @@ await portsClosed; |
@@ -65,3 +65,4 @@ 'use strict'; | ||
const relPath = filePath.substring(this.path.length + 1); | ||
const [unitName, methodFile] = relPath.split(node.path.sep); | ||
const [unitDir, methodFile] = relPath.split(node.path.sep); | ||
const unitName = unitDir.includes('.') ? unitDir : unitDir + '.1'; | ||
if (methodFile) { | ||
@@ -68,0 +69,0 @@ const name = node.path.basename(methodFile, '.js'); |
@@ -144,3 +144,3 @@ 'use strict'; | ||
runTests() { | ||
async runTests() { | ||
const { test, tests, config, console } = this; | ||
@@ -151,14 +151,13 @@ const timer = setTimeout(() => { | ||
}, config.server.timeouts.test); | ||
await node.events.once(this, 'ready'); | ||
const cases = tests.map((t) => node.test(t.name, t.run)); | ||
this.parallel(cases, ERR_TEST).then(() => { | ||
clearTimeout(timer); | ||
setTimeout(() => { | ||
const { passed, failed } = test; | ||
const msg = `Passed ${passed}, Failed: ${failed}`; | ||
if (failed > 0) console.error('🔴 ' + msg); | ||
else console.debug('🟢 ' + msg); | ||
const code = failed === 0 ? 0 : 1; | ||
wt.parentPort.postMessage({ name: 'terminate', code }); | ||
}, TEST_DELAY); | ||
}); | ||
await this.parallel(cases, ERR_TEST); | ||
await metarhia.metautil.delay(TEST_DELAY); | ||
clearTimeout(timer); | ||
const { passed, failed } = test; | ||
const msg = `Passed ${passed}, Failed: ${failed}`; | ||
if (failed > 0) console.error('🔴 ' + msg); | ||
else console.debug('🟢 ' + msg); | ||
const code = failed === 0 ? 0 : 1; | ||
wt.parentPort.postMessage({ name: 'terminate', code }); | ||
} | ||
@@ -165,0 +164,0 @@ |
@@ -46,2 +46,6 @@ 'use strict'; | ||
const ready = async () => { | ||
application.emit('ready'); | ||
}; | ||
const stop = async () => { | ||
@@ -74,3 +78,3 @@ if (application.finalization) return; | ||
const handlers = { stop, invoke }; | ||
const handlers = { ready, stop, invoke }; | ||
wt.parentPort.on('message', async (msg) => { | ||
@@ -77,0 +81,0 @@ const handler = handlers[msg.name]; |
{ | ||
"name": "impress", | ||
"version": "3.0.9", | ||
"version": "3.0.10", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Enterprise application server for Node.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68603
1801