From: https://pub.dev/packages/coverage
Ignore lines from coverage
// coverage:ignore-line to ignore one line.
// coverage:ignore-start and // coverage:ignore-end to ignore range of lines inclusive.
// coverage:ignore-file to ignore the whole file.
We should apply this to bit of the code that we don't want coverage for.
I'm sure we have a few places that we don't care to test.
Example, maybe it's overkill to test requireSubtleCrypto logic, we could just make that private method, and use these coverage-ignore comments to avoid counting it in coverage.
|
@visibleForTesting |
|
JSSubtleCrypto requireSubtleCrypto( |
|
JSSubtleCrypto? subtle, |
|
bool isSecureContext, |
|
) { |
|
if (subtle != null) { |
|
return subtle; |
|
} |
|
|
|
if (!isSecureContext) { |
|
throw UnsupportedError( |
|
'Browser Web Crypto APIs require a secure context. ' |
|
'Load the page over HTTPS or a potentially trustworthy origin such as localhost. ' |
|
'See: $_secureContextsDocumentationUrl', |
|
); |
|
} |
|
|
|
throw UnsupportedError( |
|
'Browser Web Crypto APIs are unavailable because `window.crypto.subtle` ' |
|
'is missing in this runtime. See: $_webCryptoApiDocumentationUrl', |
|
); |
|
} |
This is really just nice to have and generally users shouldn't hit this. And we don't really want to make testing setups where we can reproduce the behavior. So any testing we do is kind of artificial anyways.
From: https://pub.dev/packages/coverage
We should apply this to bit of the code that we don't want coverage for.
I'm sure we have a few places that we don't care to test.
Example, maybe it's overkill to test
requireSubtleCryptologic, we could just make that private method, and use these coverage-ignore comments to avoid counting it in coverage.webcrypto.dart/lib/src/crypto_subtle.dart
Lines 81 to 102 in 7a673ab
This is really just nice to have and generally users shouldn't hit this. And we don't really want to make testing setups where we can reproduce the behavior. So any testing we do is kind of artificial anyways.