Skip to content

Commit 9ea0544

Browse files
author
damccorm
authored
Moved tests from httpBin to Nock (#45)
* Moved tests from httpBin to Nock * Added back httpbin tests as L1 * Updated how tests are called
1 parent 84049e6 commit 9ea0544

File tree

8 files changed

+364
-30
lines changed

8 files changed

+364
-30
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ $ npm run build
3131

3232
# Test
3333

34+
To run all tests:
35+
3436
```bash
3537
$ npm test
3638
```
3739

40+
To just run unit tests:
41+
42+
```bash
43+
$ npm run units
44+
```
45+
3846
# Sample
3947

4048
Build first. Then run

make.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ if (!test('-d', binPath)) {
2929
addPath(binPath);
3030

3131
var buildPath = path.join(__dirname, '_build');
32-
var testPath = path.join(__dirname, '_test');
32+
var unitPath = path.join(__dirname, '_test', 'units');
33+
var testPath = path.join(__dirname, '_test', 'tests');
3334
var cultures = ['en-US', 'de-DE', 'es-ES', 'fr-FR', 'it-IT', 'ja-JP', 'ko-KR', 'ru-RU', 'zh-CN', 'zh-TW'];
3435

3536
target.clean = function () {
3637
rm('-Rf', buildPath);
38+
rm('-Rf', unitPath);
3739
rm('-Rf', testPath);
3840
};
3941

@@ -123,10 +125,7 @@ target.loc = function () {
123125
}
124126
}
125127

126-
target.test = function () {
127-
target.build();
128-
129-
run('tsc -p ./test --outDir ' + testPath, true);
128+
var runTests = function (testPath) {
130129
cp('-R', path.join(__dirname, 'test', 'data'), testPath);
131130
//cp('-Rf', rp('test/scripts'), testPath);
132131

@@ -154,6 +153,23 @@ target.test = function () {
154153
run('mocha ' + testPath + ' --recursive', true);
155154
}
156155

156+
target.units = function () {
157+
console.log("-------Unit Tests-------");
158+
run('tsc -p ./test/units --outDir ' + unitPath, true);
159+
runTests(unitPath);
160+
}
161+
162+
target.test = function () {
163+
target.build();
164+
165+
console.log("-------Unit Tests-------");
166+
run('tsc -p ./test/units --outDir ' + unitPath, true);
167+
168+
console.log("-------Other Tests-------");
169+
run('tsc -p ./test/tests --outDir ' + testPath, true);
170+
runTests(testPath);
171+
}
172+
157173
// run the sample
158174
// building again is the way to clear the tool cache (creates it in the build dir)
159175
target.sample = function () {

package-lock.json

Lines changed: 111 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"build": "node make.js build",
88
"test": "node make.js test",
9-
"sample": "node make.js sample"
9+
"sample": "node make.js sample",
10+
"units": "node make.js units"
1011
},
1112
"repository": {
1213
"type": "git",
@@ -33,6 +34,7 @@
3334
"devDependencies": {
3435
"typescript": "^2.2.1",
3536
"@types/node": "^8.0.19",
37+
"nock": "9.6.1",
3638
"mocha": "^3.2.0",
3739
"@types/mocha": "^2.2.41",
3840
"shelljs": "^0.7.6",

0 commit comments

Comments
 (0)