![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ember-cli-code-coverage
Advanced tools
Code coverage using Istanbul for Ember apps.
>= 1.6.0
for which you need ember-cli > 2.4.3
ember-cli-mirage >= 0.1.13
pretender >= 0.11.0
ember-cli-babel >= 6.0.0
ember install ember-cli-code-coverage
Coverage will only be generated when an environment variable is true (by default COVERAGE
) and running your test command like normal.
For example:
COVERAGE=true ember test
If you want your coverage to work on both Unix and Windows, you can do this:
npm install cross-env --save-dev
and then:
cross-env COVERAGE=true ember test
When running with parallel
set to true, the final reports can be merged by using ember coverage-merge
. The final merged output will be stored in the coverageFolder
.
If you intend to use ember test
with the --path
flag, you should generate the build
with coverageEnvVar
set as true. This is because the code is instrumented for
coverage during the build.
For example:
COVERAGE=true ember build --environment=test --output-path=dist
followed by
COVERAGE=true ember test --path=dist
Steps:
tsconfig.json
{
"compilerOptions": {
"inlineSourceMap": true,
"inlineSources": true
}
}
ember-cli-build.js
const app = new EmberApp(defaults, {
babel: {
sourceMaps: 'inline'
},
sourcemaps: {
enabled: true,
extensions: ['js']
}
});
package.json
specify latest available version {
devDependencies: {
"ember-cli-code-coverage": "^1.0.0-beta.9"
}
}
Configuration is optional. It should be put in a file at config/coverage.js
(configPath
configuration in package.json is honored). In addition to this you can configure Istanbul by adding a .istanbul.yml
file to the root directory of your app (See https://github.com/gotwarlost/istanbul#configuring)
coverageEnvVar
: Defaults to COVERAGE
. This is the environment variable that when set will cause coverage metrics to be generated.
reporters
: Defaults to ['lcov', 'html']
. The json-summary
reporter will be added to anything set here, it is required. This can be any reporters supported by Istanbul.
excludes
: Defaults to ['*/mirage/**/*']
. An array of globs to exclude from instrumentation. Useful to exclude files from coverage statistics.
coverageFolder
: Defaults to coverage
. A folder relative to the root of your project to store coverage results.
parallel
: Defaults to false
. Should be set to true if parallel testing is being used for separate test runs, for example when using ember-exam with the --partition
flag. This will generate the coverage reports in directories suffixed with _<random_string>
to avoid overwriting other threads reports. These reports can be joined by using the ember coverage-merge
command (potentially as part of the posttest hook in your package.json
).
module.exports = {
coverageEnvVar: 'COV'
}
To work, this addon has to post coverage results back to a middleware at /write-coverage
.
If you are using ember-cli-mirage
you should add the following:
// in mirage/config.js
this.passthrough('/write-coverage');
this.namespace = 'api'; // It's important that the passthrough for coverage is before the namespace, otherwise it will be prefixed.
If you are using ember-cli-pretender
you should add the following:
// where ever you set up the Pretender Server
var server = new Pretender(function () {
this.post('/write-coverage', this.passthrough);
});
This addon was inspired by ember-cli-blanket
.
The primary differences are that this addon uses Istanbul rather than Blanket for coverage and it instruments your application code as part of the build, when enabled.
v1.0.0 (2020-08-31)
extend
package with Object.assign
(@rwjblue)InvalidStateError
exception (@brokenalarms).includes()
instead of .indexOf()
(@Turbo87)_isCoverageEnabled()
method (@Turbo87)_parentName()
method (@Turbo87)node-tests
(@Turbo87)co
usage (@rwjblue)FAQs
Code coverage for ember projects using Istanbul
The npm package ember-cli-code-coverage receives a total of 7,014 weekly downloads. As such, ember-cli-code-coverage popularity was classified as popular.
We found that ember-cli-code-coverage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.