-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beef up tests and add nyc for coverage reporting
- Loading branch information
Showing
13 changed files
with
1,203 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,12 @@ | |
"postinstall": "patch-package", | ||
"build": "tsc -p .", | ||
"watch": "tsc --watch", | ||
"dev-test-watch": "mocha-typescript-watch -p tsconfig.json lib/tests/_init.js lib/tests/**/*js", | ||
"lint": "tslint -p . src/*ts src/**/*ts", | ||
"pkg-binaries": "pkg --out-path dist -t node8-macos,node8-linux package.json", | ||
"test": "mocha lib/tests/_init.js lib/tests/**/*js", | ||
"test": "mocha lib/tests/**/*js", | ||
"test-watch": "mocha --watch lib/tests/**/*js", | ||
"ts-test-watch": "mocha --watch src/tests/**/*ts", | ||
"coverage": "nyc --cache mocha src/tests/**/*ts", | ||
"version": "auto-changelog -p && git add CHANGELOG.md" | ||
}, | ||
"author": "Tavis Rudd <[email protected]>", | ||
|
@@ -74,9 +76,39 @@ | |
"intercept-stdout": "^0.1.2", | ||
"mocha": "^6.1.4", | ||
"mocha-typescript": "^1.1.17", | ||
"nyc": "^14.0.0", | ||
"patch-package": "^6.1.2", | ||
"pkg": "^4.3.7", | ||
"source-map-support": "^0.5.12", | ||
"ts-mocha": "^6.0.0", | ||
"ts-node": "^8.1.0", | ||
"tslint": "^5.16.0", | ||
"typescript": "^3.4.5" | ||
}, | ||
"mocha": { | ||
"require": [ | ||
"ts-node/register", | ||
"src/tests/_init.ts" | ||
] | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".js", | ||
".ts", | ||
".tsx" | ||
], | ||
"exclude": [ | ||
"**/*.d.ts" | ||
], | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"reporter": [ | ||
"html" | ||
], | ||
"all": true, | ||
"cache": true, | ||
"sourceMap": true, | ||
"instrument": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {expect} from 'chai'; | ||
|
||
import {buildArgs, lazyLoad} from "../main"; | ||
import {implementations} from "../cli/command-implemntations"; | ||
import {} from "../cfn/approval/cli"; | ||
import {} from "../cfn/approval/index"; | ||
|
||
describe('cli', () => { | ||
it('--help displays help', async () => { | ||
const parser = buildArgs().exitProcess(false); | ||
const output = await new Promise((resolve) => { | ||
parser.parse("--help", (_err: {}, _argv: {}, data: string) => { | ||
resolve(data); | ||
}) | ||
}); | ||
expect(output).to.contain("CloudFormation with Confidence"); | ||
}); | ||
|
||
it('lazy loaded implementations are loadable', () => { | ||
expect(typeof lazyLoad('createStackMain')).to.equal('function'); | ||
expect(implementations.createStackMain).to.equal( | ||
require('../cli/command-implemntations').implementations.createStackMain); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {expect} from 'chai'; | ||
import {diff} from "../diff"; | ||
|
||
describe('diff', () => { | ||
it('works and doesn\'t explode', () => { | ||
expect(diff('a', 'a')).to.equal(true); | ||
expect(diff('a', 'b')).to.equal(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require('./support'); // for side-effect | ||
import {expect} from 'chai'; | ||
|
||
import * as yaml from '../yaml'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {expect} from 'chai'; | ||
import {runCommandSet} from '../cfn/runCommandSet'; | ||
|
||
describe('runCommandSet', () => { | ||
it('returns the commands run and does not barf', async () => { | ||
const commands = ['echo 123', 'echo abc']; | ||
const output = runCommandSet(commands, '.'); | ||
expect(output).to.deep.equal(commands); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require('./support'); // for side-effect | ||
import {expect} from 'chai'; | ||
|
||
import * as _ from 'lodash'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters