fix(core): update testing framework

This commit is contained in:
Philipp Kunz 2018-08-07 11:13:03 +02:00
parent 30249ad254
commit 93b44ba888
4 changed files with 84 additions and 5 deletions

78
package-lock.json generated
View File

@ -25,6 +25,31 @@
"typescript": "^2.9.1" "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": { "@pushrocks/smartdelay": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.1.tgz",
@ -51,6 +76,21 @@
"vinyl-file": "^3.0.0" "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": { "@pushrocks/smartpromise": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.5.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.5.tgz",
@ -67,6 +107,17 @@
"form-data": "^2.3.2" "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": { "@pushrocks/tapbundle": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.1.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.1.tgz",
@ -104,6 +155,12 @@
"@types/chai": "*" "@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": { "@types/form-data": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz",
@ -137,6 +194,12 @@
"@types/node": "*" "@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": { "ansi-256-colors": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz", "resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz",
@ -371,6 +434,12 @@
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
"dev": true "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": { "esprima": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "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", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz",
"integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=" "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": { "first-chunk-stream": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",

View File

@ -6,7 +6,7 @@
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "tsrun test/test.ts", "test": "tstest test/",
"build": "echo \"Not needed for now\"" "build": "echo \"Not needed for now\""
}, },
"repository": { "repository": {
@ -26,6 +26,7 @@
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsrun": "^1.1.9", "@gitzone/tsrun": "^1.1.9",
"@gitzone/tstest": "^1.0.12",
"@pushrocks/tapbundle": "^3.0.1", "@pushrocks/tapbundle": "^3.0.1",
"@types/node": "^10.5.5" "@types/node": "^10.5.5"
} }

View File

@ -21,7 +21,7 @@ tap.test('should create an instance of ThreadFunction', async () => {
tap.test('should create an instance of Thread', async () => { tap.test('should create an instance of Thread', async () => {
smartspawn.setWorkerBasePath(__dirname); smartspawn.setWorkerBasePath(__dirname);
testThread = new smartspawn.Thread('child.ts'); testThread = new smartspawn.Thread('../testassets/child.ts');
testThread.enableTypeScript(); testThread.enableTypeScript();
const message = await testThread.send('https://google.com'); const message = await testThread.send('https://google.com');
console.log(message); 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 () => { tap.test('should not spawn when nothing is sent', async () => {
smartspawn.setWorkerBasePath(__dirname); 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 () => { tap.test('should run in a Pool', async () => {
let testPool = new smartspawn.Pool(); let testPool = new smartspawn.Pool();
let testThread = new smartspawn.Thread('child.ts'); let testThread = new smartspawn.Thread('../testassets/child.ts');
testThread.assignToPool(testPool); testThread.assignToPool(testPool);
// first run // first run
@ -53,7 +53,7 @@ tap.test('should run in a Pool', async () => {
}); });
tap.test('should once', 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'); const message = await testThread.sendOnce('what');
expect(message).to.equal('what'); expect(message).to.equal('what');
}); });