You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Documentation/Contributors/BuildGuide/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -103,9 +103,9 @@ Here's the full set of scripts and what they do.
103
103
* `release` - A full release build that creates a shippable product, including building apps and generating documentation.
104
104
* `makeZipFile` - Builds a zip file containing all release files. This includes the source tree (suitable for use from an AMD-aware application), plus the combined and minified Cesium.js files, the generated documentation, the test suite, and the example applications (in both built and source form).
105
105
***Utility scripts** -- code coverage, static code analysis, and other utilities
106
-
*`instrumentForCoverage` - Runs [JSCoverage](http://siliconforks.com/jscoverage/) on the source tree to allow running tests with coverage information. Use the link in index.html. Currently Windows only.
106
+
*`coverage` - Runs coverage and opens the default browser with the results.
107
107
*`eslint` - Runs [ESLint](http://eslint.org/), a static code analysis tool, on the entire source tree.
108
-
*`eslint-watch` - A never-ending task that watches your file system for changes to Cesium and runs ESLint on any changed source files.
108
+
*`eslint-watch` - A never-ending task that watches your file system for changes to Cesium and runs ESLint on any changed source files.
109
109
*`clean` - Removes all generated build artifacts.
110
110
*`cloc` - Runs [CLOC](https://github.com/AlDanial/cloc) to count the lines of code on the Source and Specs directories. This requires [Perl](http://www.perl.org/) to execute.
111
111
*`sortRequires` - Alphabetically sorts the list of required modules in every `js` file. It also makes sure that the top of every source file uses the same formatting.
Copy file name to clipboardexpand all lines: Documentation/Contributors/TestingGuide/README.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ All new code should have 100% code coverage and should pass all tests. Always r
14
14
*[Run Only WebGL Tests](#run-only-webgl-tests)
15
15
*[Run Only Non-WebGL Tests](#run-only-non-webgl-tests)
16
16
*[Run All Tests against Combined File (Run All Tests against Combined File with Debug Code Removed)]()
17
-
*[Run All Tests with Code Coverage (Build 'instrumentForCoverage' First)](#run-all-tests-against-combined-file-run-all-tests-against-combined-file-with-debug-code-removed)
17
+
*[Run All Tests with Coverage](#run-all-tests-against-combined-file-run-all-tests-against-combined-file-with-debug-code-removed)
18
18
*[Running Tests on the Command Line with Karma](#running-tests-on-the-command-line-with-karma)
19
19
*[Testing Previous Versions of CesiumJS](#testing-previous-versions-of-cesium)
20
20
*[`testfailure` Label for Issues](#testfailure-label-for-issues)
@@ -108,25 +108,25 @@ The **Run All Tests against Combined File with Debug Code Removed** is the same
108
108
109
109
See the [Build Guide](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Documentation/Contributors/BuildGuide/README.md#build-scripts) for all the CesiumJS build options.
110
110
111
-
###Run All Tests with Code Coverage (Build 'instrumentForCoverage' First)
111
+
## Run Coverage
112
112
113
-
[JSCoverage](http://siliconforks.com/jscoverage/) is used for code coverage. It is especially important to have outstanding code coverage since JavaScript doesn't have a compiler and linker to catch early errors.
113
+
We use [istanbul](https://istanbul.js.org/) via [karma-coverage](https://github.com/karma-runner/karma-coverage) to generate code coverage reports. It is especially important to have outstanding code coverage since JavaScript doesn't have a compiler and linker to catch early errors.
114
114
115
-
To run code coverage, first create a build of CesiumJS that is instrumented for coverage by running `npm run instrumentForCoverage`. Currently, this is Windows only.
115
+
To generate a coverage report, run: `npm run coverage`. This will place a report inside of the `Build/Coverage/<browser>` folder and open your default browser with the result.
116
116
117
-
Then use this test option to run the tests with code coverage. Click on the `Summary` tab to see the total code coverage and coverage for each individual source file.
117
+
You'll see a source tree that matches Cesium's own code layout. Each directory shows aggregated results for all files it contains.
118
118
119
119

120
120
121
-
Click on a file to see line-by-line coverage for just that file. For example, here is `AssociativeArray`:
121
+
Click on a directory to see results for each file in that directory. Click on a specific file to see line-by-line coverage for just that file. For example, here is `Core/AssociativeArray`:
122
122
123
123

124
124
125
-
In the left margin, green indicates a line that was executed, and red indicates a line that was not. Many lines, such as comments and semicolons, are not colored since they are not executable.
125
+
In the left margin, green indicates how many times a line was executed. Many lines, such as comments and semicolons, are not colored since they are not executable.
126
126
127
127
For the `contains` function above
128
128
*`AssociativeArray.prototype.contains = function(key) {` is executed once when CesiumJS is loaded to assign the `contains` function to the `AssociativeArray`'s prototype.
129
-
* The `if` statement and return statement are executed 3,425 times.
129
+
* The `if` statement and return statement are executed 8,022 times.
130
130
* The `throw` statement is not executed, which indicates that test coverage should be improved here. We strive to test _all_ error conditions.
131
131
132
132
When writing tests, do not confuse 100% code coverage with 100% tested. For example, it is possible to have 100% code coverage without having any expectations. Also consider the following code:
0 commit comments