From 93b44ba8880c1fdf01fc892653abfb099f31c4ae Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 7 Aug 2018 11:13:03 +0200 Subject: [PATCH] fix(core): update testing framework --- package-lock.json | 78 +++++++++++++++++++++++++++++++++++ package.json | 3 +- test/test.ts | 8 ++-- {test => testassets}/child.ts | 0 4 files changed, 84 insertions(+), 5 deletions(-) rename {test => testassets}/child.ts (100%) diff --git a/package-lock.json b/package-lock.json index 19830d8..812343c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,31 @@ "typescript": "^2.9.1" } }, + "@gitzone/tstest": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@gitzone/tstest/-/tstest-1.0.12.tgz", + "integrity": "sha512-nBKOJTI7L/XxH3cre+NtVbdAp1gheDeZX/z107zc4yeQOesZB/w+fkyVrdzAqRVMhyXjrOzwngB1UGqIXSXlSg==", + "dev": true, + "requires": { + "@gitzone/tsrun": "^1.1.9", + "@pushrocks/consolecolor": "^2.0.1", + "@pushrocks/smartfile": "^6.0.3", + "@pushrocks/smartlog": "^2.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "@pushrocks/smartshell": "^2.0.5", + "@types/figures": "^2.0.0", + "figures": "^2.0.0" + } + }, + "@pushrocks/consolecolor": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/consolecolor/-/consolecolor-2.0.1.tgz", + "integrity": "sha512-iOFCHVeFZ2OywbdwSxVI4/wokkcLrXVdHLgvMmkNhJ220eeLgjNZWx3EJo3vNW3zq5ybCSCUIq0878djBxrWpw==", + "dev": true, + "requires": { + "ansi-256-colors": "^1.1.0" + } + }, "@pushrocks/smartdelay": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.1.tgz", @@ -51,6 +76,21 @@ "vinyl-file": "^3.0.0" } }, + "@pushrocks/smartlog": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/smartlog/-/smartlog-2.0.1.tgz", + "integrity": "sha512-GtsDTGIUF3VuWPyF8FV5dF31ZCEIcaJ56ZlvJsWxjnyJq57X25mk5/K0QAaRE9IIeHg6fORcukFomb5C+AOQrg==", + "dev": true, + "requires": { + "@pushrocks/smartlog-interfaces": "^1.0.9" + } + }, + "@pushrocks/smartlog-interfaces": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-1.0.9.tgz", + "integrity": "sha512-0qwpomrRN0kFjmhR9m1iHYXoISoNuXtRP0Wr+JtkYyURLwKHMaW8Xoznf8MzXJptRfqufJi3Fxh5HodpPrIZUA==", + "dev": true + }, "@pushrocks/smartpromise": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.5.tgz", @@ -67,6 +107,17 @@ "form-data": "^2.3.2" } }, + "@pushrocks/smartshell": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@pushrocks/smartshell/-/smartshell-2.0.6.tgz", + "integrity": "sha512-D48KB3DDqLfMjOXGEutqJi+v3Z4RcWacu5BJXxUwrecvd6oetbKobfmNGxeHSQPmNGb7U3ISfKwV6c5T5EZkJg==", + "dev": true, + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/which": "^1.3.1", + "which": "^1.3.1" + } + }, "@pushrocks/tapbundle": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.1.tgz", @@ -104,6 +155,12 @@ "@types/chai": "*" } }, + "@types/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-mcRgJ+ncKuNI+Dwac7omO18B8C8u+YBS+AU/oyLhEyjAnT3cUUThhHgZpbiIvu5ZqSvdD30BXtrqg9nxc3OKMg==", + "dev": true + }, "@types/form-data": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", @@ -137,6 +194,12 @@ "@types/node": "*" } }, + "@types/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.1.tgz", + "integrity": "sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ==", + "dev": true + }, "ansi-256-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz", @@ -371,6 +434,12 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -382,6 +451,15 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz", "integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=" }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "first-chunk-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", diff --git a/package.json b/package.json index 57768eb..69a4c4b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "main": "dist/index.js", "typings": "dist/index.d.ts", "scripts": { - "test": "tsrun test/test.ts", + "test": "tstest test/", "build": "echo \"Not needed for now\"" }, "repository": { @@ -26,6 +26,7 @@ }, "devDependencies": { "@gitzone/tsrun": "^1.1.9", + "@gitzone/tstest": "^1.0.12", "@pushrocks/tapbundle": "^3.0.1", "@types/node": "^10.5.5" } diff --git a/test/test.ts b/test/test.ts index 53a4a9b..661140a 100644 --- a/test/test.ts +++ b/test/test.ts @@ -21,7 +21,7 @@ tap.test('should create an instance of ThreadFunction', async () => { tap.test('should create an instance of Thread', async () => { smartspawn.setWorkerBasePath(__dirname); - testThread = new smartspawn.Thread('child.ts'); + testThread = new smartspawn.Thread('../testassets/child.ts'); testThread.enableTypeScript(); const message = await testThread.send('https://google.com'); console.log(message); @@ -30,12 +30,12 @@ tap.test('should create an instance of Thread', async () => { tap.test('should not spawn when nothing is sent', async () => { smartspawn.setWorkerBasePath(__dirname); - let testThread = new smartspawn.Thread('child.ts'); + let testThread = new smartspawn.Thread('../testassets/child.ts'); }); tap.test('should run in a Pool', async () => { let testPool = new smartspawn.Pool(); - let testThread = new smartspawn.Thread('child.ts'); + let testThread = new smartspawn.Thread('../testassets/child.ts'); testThread.assignToPool(testPool); // first run @@ -53,7 +53,7 @@ tap.test('should run in a Pool', async () => { }); tap.test('should once', async () => { - let testThread = new smartspawn.Thread('child.ts'); + let testThread = new smartspawn.Thread('../testassets/child.ts'); const message = await testThread.sendOnce('what'); expect(message).to.equal('what'); }); diff --git a/test/child.ts b/testassets/child.ts similarity index 100% rename from test/child.ts rename to testassets/child.ts