Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Instrument ObjectMethod's. (#182)
nyc currently reports the following code as containing 0 functions. Add ObjectMethod visitor to istanbul-lib-instrument so these are seen.
- Loading branch information
1 parent
955511a
commit 126f09d
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
packages/istanbul-lib-instrument/test/specs/object-method.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,22 @@ | ||
--- | ||
name: object method | ||
code: | | ||
const foo = {test() { return 'value' }} | ||
output = foo.test() | ||
tests: | ||
- name: object method is instrumented | ||
out: 'value' | ||
lines: {'1': 1, '2': 1} | ||
functions: {'0': 1} | ||
statements: {'0': 1, '1': 1, '2': 1} | ||
--- | ||
name: object getter | ||
code: | | ||
const foo = {get test() { return 'value' }} | ||
output = foo.test; | ||
tests: | ||
- name: object getter is instrumented | ||
out: 'value' | ||
lines: {'1': 1, '2': 1} | ||
functions: {'0': 1} | ||
statements: {'0': 1, '1': 1, '2': 1} |