Skip to content

Commit

Permalink
Updates to readme and documentation
Browse files Browse the repository at this point in the history
Also ditched the unused and not really necessary `getTestTotal` method
  • Loading branch information
pineapplemachine committed Mar 28, 2018
1 parent 1eba679 commit eb4600e
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 97 deletions.
12 changes: 0 additions & 12 deletions canary.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,6 @@ class CanaryTest{
getName(){
return this.name;
}
// Get the number of tests in this tree; i.e. this test, more the number of
// children, more the number of grandchildren, etc.
getTestTotal(){
if(!this.isExpandedGroup){
this.expandGroups();
}
let count = 1;
for(let child of this.children){
count += child.getTestTotal(testFilter);
}
return count;
}
// Log a message. (Except if the test was marked as silent.)
log(...message){
if(!this.isSilent){
Expand Down
8 changes: 0 additions & 8 deletions docs/api-advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ Get a list of tags that have been added to this test.

**Returns:** An array of tags.

# getTestTotal

Recursively get the number of [`CanaryTest`](api-introduction.md) instances in a test tree.

Note that if this method is called for a test group or series, and the group has not already been expanded, then this method will cause it to be expanded. (As though the `expandGroups` method was called.)

**Returns:** The total number of tests in this test tree.

# getStatusString

Get a string representing the status of this test.
Expand Down
145 changes: 72 additions & 73 deletions docs/api-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,76 +20,75 @@ The library also utilizes [`CanaryTestCallback`](api-callback-class.md) and [`Ca

Here is an exhaustive list of documented [`CanaryTest`](api-introduction.md) methods and attributes. Methods and attributes not documented here are liable to change often and without notice; it is not recommended to use undocumented functions or attributes.

- [`abort`](api-advanced-usage.md#abort)
- [`aborted`](api-status-attributes.md#aborted)
- [`addError`](api-advanced-usage.md#adderror)
- [`addTest`](api-advanced-usage.md#addtest)
- [`anyErrors`](api-advanced-usage.md#anyerrors)
- [`anyFailedChildren`](api-advanced-usage.md#anyfailedchildren)
- [`applyFilter`](api-advanced-usage.md#applyfilter)
- [`attempted`](api-status-attributes.md#attempted)
- [`constructor`](api-advanced-usage.md#constructor)
- [`doReport`](api-running-tests.md#doreport)
- [`durationMilliseconds`](api-advanced-usage.md#durationmilliseconds)
- [`durationSeconds`](api-advanced-usage.md#durationseconds)
- [`endTime`](api-status-attributes.md#endtime)
- [`expandGroups`](api-advanced-usage.md#expandgroups)
- [`fail`](api-advanced-usage.md#fail)
- [`failed`](api-status-attributes.md#failed)
- [`filtered`](api-status-attributes.md#filtered)
- [`getChildren`](api-advanced-usage.md#getchildren)
- [`getErrors`](api-advanced-usage.md#geterrors)
- [`getFailedChildren`](api-advanced-usage.md#getfailedchildren)
- [`getLine`](api-error-class.md#getline)
- [`getLocationName`](api-error-class.md#getlocationname)
- [`getLocationTitle`](api-error-class.md#getlocationtitle)
- [`getName`](api-advanced-usage.md#getname)
- [`getName`](api-callback-class.md#getname)
- [`getOwner`](api-callback-class.md#getowner)
- [`getParent`](api-advanced-usage.md#getparent)
- [`getReport`](api-running-tests.md#getreport)
- [`getStatusString`](api-advanced-usage.md#getstatusstring)
- [`getSummary`](api-running-tests.md#getsummary)
- [`getTags`](api-advanced-usage.md#gettags)
- [`getTestTotal`](api-advanced-usage.md#gettesttotal)
- [`getTitle`](api-callback-class.md#gettitle)
- [`getTitle`](api-advanced-usage.md#gettitle)
- [`group`](api-adding-tests.md#group)
- [`hasTag`](api-advanced-usage.md#hastag)
- [`ignore`](api-intermediate-usage.md#ignore)
- [`isGroup`](api-status-attributes.md#isgroup)
- [`isIgnored`](api-status-attributes.md#isignored)
- [`isSeries`](api-status-attributes.md#isseries)
- [`isSilent`](api-status-attributes.md#issilent)
- [`isTodo`](api-status-attributes.md#istodo)
- [`isVerbose`](api-status-attributes.md#isverbose)
- [`log`](api-intermediate-usage.md#log)
- [`logVerbose`](api-intermediate-usage.md#logverbose)
- [`message`](api-error-class.md#message)
- [`noErrors`](api-advanced-usage.md#noerrors)
- [`noFailedChildren`](api-advanced-usage.md#nofailedchildren)
- [`onBegin`](api-group-callbacks.md#onbegin)
- [`onEachBegin`](api-group-callbacks.md#oneachbegin)
- [`onEachEnd`](api-group-callbacks.md#oneachend)
- [`onEachFailure`](api-group-callbacks.md#oneachfailure)
- [`onEachSuccess`](api-group-callbacks.md#oneachsuccess)
- [`onEnd`](api-group-callbacks.md#onend)
- [`onFailure`](api-group-callbacks.md#onfailure)
- [`onSuccess`](api-group-callbacks.md#onsuccess)
- [`orphan`](api-advanced-usage.md#orphan)
- [`removeAllTests`](api-advanced-usage.md#removealltests)
- [`removeTest`](api-advanced-usage.md#removetest)
- [`reset`](api-advanced-usage.md#reset)
- [`run`](api-running-tests.md#run)
- [`series`](api-adding-tests.md#series)
- [`shouldSkip`](api-advanced-usage.md#shouldskip)
- [`silent`](api-advanced-usage.md#silent)
- [`skipped`](api-status-attributes.md#skipped)
- [`stack`](api-error-class.md#stack)
- [`startTime`](api-status-attributes.md#starttime)
- [`success`](api-status-attributes.md#success)
- [`tags`](api-intermediate-usage.md#tags)
- [`test`](api-adding-tests.md#test)
- [`todo`](api-intermediate-usage.md#todo)
- [`unignore`](api-advanced-usage.md#unignore)
- [`verbose`](api-advanced-usage.md#verbose)
- [abort](api-advanced-usage.md#abort)
- [aborted](api-status-attributes.md#aborted)
- [addError](api-advanced-usage.md#adderror)
- [addTest](api-advanced-usage.md#addtest)
- [anyErrors](api-advanced-usage.md#anyerrors)
- [anyFailedChildren](api-advanced-usage.md#anyfailedchildren)
- [applyFilter](api-advanced-usage.md#applyfilter)
- [attempted](api-status-attributes.md#attempted)
- [constructor](api-advanced-usage.md#constructor)
- [doReport](api-running-tests.md#doreport)
- [durationMilliseconds](api-advanced-usage.md#durationmilliseconds)
- [durationSeconds](api-advanced-usage.md#durationseconds)
- [endTime](api-status-attributes.md#endtime)
- [expandGroups](api-advanced-usage.md#expandgroups)
- [fail](api-advanced-usage.md#fail)
- [failed](api-status-attributes.md#failed)
- [filtered](api-status-attributes.md#filtered)
- [getChildren](api-advanced-usage.md#getchildren)
- [getErrors](api-advanced-usage.md#geterrors)
- [getFailedChildren](api-advanced-usage.md#getfailedchildren)
- [getLine](api-error-class.md#getline)
- [getLocationName](api-error-class.md#getlocationname)
- [getLocationTitle](api-error-class.md#getlocationtitle)
- [getName](api-advanced-usage.md#getname)
- [getName](api-callback-class.md#getname)
- [getOwner](api-callback-class.md#getowner)
- [getParent](api-advanced-usage.md#getparent)
- [getReport](api-running-tests.md#getreport)
- [getStatusString](api-advanced-usage.md#getstatusstring)
- [getSummary](api-running-tests.md#getsummary)
- [getTags](api-advanced-usage.md#gettags)
- [getTitle](api-callback-class.md#gettitle)
- [getTitle](api-advanced-usage.md#gettitle)
- [group](api-adding-tests.md#group)
- [hasTag](api-advanced-usage.md#hastag)
- [ignore](api-intermediate-usage.md#ignore)
- [isGroup](api-status-attributes.md#isgroup)
- [isIgnored](api-status-attributes.md#isignored)
- [isSeries](api-status-attributes.md#isseries)
- [isSilent](api-status-attributes.md#issilent)
- [isTodo](api-status-attributes.md#istodo)
- [isVerbose](api-status-attributes.md#isverbose)
- [log](api-intermediate-usage.md#log)
- [logVerbose](api-intermediate-usage.md#logverbose)
- [message](api-error-class.md#message)
- [noErrors](api-advanced-usage.md#noerrors)
- [noFailedChildren](api-advanced-usage.md#nofailedchildren)
- [onBegin](api-group-callbacks.md#onbegin)
- [onEachBegin](api-group-callbacks.md#oneachbegin)
- [onEachEnd](api-group-callbacks.md#oneachend)
- [onEachFailure](api-group-callbacks.md#oneachfailure)
- [onEachSuccess](api-group-callbacks.md#oneachsuccess)
- [onEnd](api-group-callbacks.md#onend)
- [onFailure](api-group-callbacks.md#onfailure)
- [onSuccess](api-group-callbacks.md#onsuccess)
- [orphan](api-advanced-usage.md#orphan)
- [removeAllTests](api-advanced-usage.md#removealltests)
- [removeTest](api-advanced-usage.md#removetest)
- [reset](api-advanced-usage.md#reset)
- [run](api-running-tests.md#run)
- [series](api-adding-tests.md#series)
- [shouldSkip](api-advanced-usage.md#shouldskip)
- [silent](api-advanced-usage.md#silent)
- [skipped](api-status-attributes.md#skipped)
- [stack](api-error-class.md#stack)
- [startTime](api-status-attributes.md#starttime)
- [success](api-status-attributes.md#success)
- [tags](api-intermediate-usage.md#tags)
- [test](api-adding-tests.md#test)
- [todo](api-intermediate-usage.md#todo)
- [unignore](api-advanced-usage.md#unignore)
- [verbose](api-advanced-usage.md#verbose)
2 changes: 1 addition & 1 deletion docs/buildTestClassAttributeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ items.sort((a, b) => {
});

for(let item of items){
console.log(`- [\`${item.name}\`](${item.file}#${item.name.toLowerCase()})`);
console.log(`- [${item.name}](${item.file}#${item.name.toLowerCase()})`);
}
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Canary is a tool for writing and running automated tests in JavaScript code.

[https://github.com/mapita/canary](https://github.com/mapita/canary)
It can be found on github at [github.com/mapita/canary](https://github.com/mapita/canary).

## Installation

Expand Down
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Canary

[![Travis CI status badge](https://travis-ci.org/Mapita/Canary)](https://travis-ci.org/Mapita/Canary.svg?branch=master)
[![readthedocs documentation status badge](http://canary.readthedocs.io/en/stable/)](https://readthedocs.org/projects/canary/badge/?version=latest)

Canary is a tool for writing and running automated tests in JavaScript code. It was written with tests and implementation sharing the same file foremost in mind. When tests and implementation are close together, it's more difficult to forget or ignore tests when making changes to the implementation.

Check out Canary's documentation at [canary.readthedocs.io](http://canary.readthedocs.io/).
Check out Canary's documentation at [canary.readthedocs.io](http://canary.readthedocs.io/en/stable/).

Install Canary using npm: `npm install canary-test`
Install Canary using [npm](https://www.npmjs.com/get-npm): `npm install canary-test`

Canary lets you control where and how you write your tests, how they are run, and how their results are reported. In case you aren't worried about the specifics of your how your test runner functions and reports results, just as long as it works, Canary can also run tests and report results with one function call for sensible default behavior.

Expand Down

0 comments on commit eb4600e

Please sign in to comment.