Skip to content

Commit

Permalink
- npm publish 2016.10.3
Browse files Browse the repository at this point in the history
- add env-variable npm_config_mode_coverage_append to allow appending coverage to previous reports
- change behavior of =all to cover all files
- none
  • Loading branch information
kaizhu256 committed Nov 12, 2016
1 parent da229b3 commit 1f0af61
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 28 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ this zero-dependency package will provide a browser-compatible version of the is
- reduce index.js file-size
- none

#### change since 83638749
- npm publish 2016.10.2
- add es6-syntax support and test
#### change since da229b32
- npm publish 2016.10.3
- add env-variable npm_config_mode_coverage_append to allow appending coverage to previous reports
- change behavior of $npm_config_mode_coverage=all to cover all files
- none

#### this package requires
- darwin or linux os

#### additional info
- this version does not support es6-module-syntax
- this version does not support es7-syntax or higher
- this version does not support typescript-syntax
- this version supports most es6-syntax (except for es6-modules)
- istanbul code derived from https://github.com/gotwarlost/istanbul/tree/v0.2.16


Expand Down Expand Up @@ -265,7 +264,7 @@ textarea[readonly] {\n\
<body>\n\
<h1>\n\
<!-- utility2-comment\n\
<div id="ajaxProgressDiv1" style="background: #d00; border: 0; height: 2px; left: 0; margin: 0; padding: 0; position: fixed; top: 0; transition: background 0.5s, width 1.5s; width: 25%;"></div>\n\
<div id="ajaxProgressDiv1" style="background: #d00; height: 2px; left: 0; margin: 0; padding: 0; position: fixed; top: 0; transition: background 0.5s, width 1.5s; width: 25%;"></div>\n\
<a\n\
{{#if envDict.npm_package_homepage}}\n\
href="{{envDict.npm_package_homepage}}"\n\
Expand Down Expand Up @@ -437,7 +436,7 @@ export npm_config_mode_auto_restart=1 && \
utility2 shRun shIstanbulCover test.js",
"test": "export PORT=$(utility2 shServerPortRandom) && utility2 test test.js"
},
"version": "2016.10.2"
"version": "2016.10.3"
}
```

Expand Down
105 changes: 88 additions & 17 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib.example.es6.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* istanbul instrument in package all */
/* istanbul instrument in package istanbul-lite */
/* jslint-ignore-begin */
// https://raw.githubusercontent.com/lukehoban/es6features/9354b8f68f26bf1931d05251c7d4411808669c97/README.md
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@

"test": "export PORT=$(utility2 shServerPortRandom) && utility2 test test.js"
},
"version": "2016.10.2"
"version": "2016.10.3"
}
51 changes: 50 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
*/
local.utility2.testMock([
// suppress console.log
[console, { log: local.utility2.nop }]
[console, { log: local.utility2.nop }],
// test $npm_config_mode_coverage_append handling-behavior
[local.utility2.envDict, { npm_config_mode_coverage_append: '1' }]
], function (onError) {
/*jslint evil: true*/
// test no coverage handling-behavior
Expand Down Expand Up @@ -262,6 +264,53 @@
options.onNext();
};

local.testCase_coverageMerge_default = function (options, onError) {
/*
* this function will test coverageMerge's default handling-behavior
*/
options = {};
options.data = local.utility2.istanbulInstrumentSync(
'(function () {\nreturn arg ' +
'? __coverage__ ' +
': __coverage__;\n}());',
'test'
);
local.utility2.arg = 0;
// test null-case handling-behavior
options.coverage1 = null;
options.coverage2 = null;
local.istanbul.coverageMerge(options.coverage1, options.coverage2);
// validate merged options.coverage1
local.utility2.assertJsonEqual(options.coverage1, null);
// init options.coverage1
options.coverage1 = local.vm.runInNewContext(options.data, { arg: 0 });
/* jslint-ignore-begin */
// validate options.coverage1
local.utility2.assertJsonEqual(options.coverage1,
{"/test":{"b":{"1":[0,1]},"branchMap":{"1":{"line":2,"locations":[{"end":{"column":25,"line":2},"start":{"column":13,"line":2}},{"end":{"column":40,"line":2},"start":{"column":28,"line":2}}],"type":"cond-expr"}},"code":["(function () {","return arg ? __coverage__ : __coverage__;","}());"],"f":{"1":1},"fnMap":{"1":{"line":1,"loc":{"end":{"column":13,"line":1},"start":{"column":1,"line":1}},"name":"(anonymous_1)"}},"path":"/test","s":{"1":1,"2":1},"statementMap":{"1":{"end":{"column":5,"line":3},"start":{"column":0,"line":1}},"2":{"end":{"column":41,"line":2},"start":{"column":0,"line":2}}}}}
);
// test merge-create handling-behavior
options.coverage1 = local.istanbul.coverageMerge({}, options.coverage1);
// validate options.coverage1
local.utility2.assertJsonEqual(options.coverage1,
{"/test":{"b":{"1":[0,1]},"branchMap":{"1":{"line":2,"locations":[{"end":{"column":25,"line":2},"start":{"column":13,"line":2}},{"end":{"column":40,"line":2},"start":{"column":28,"line":2}}],"type":"cond-expr"}},"code":["(function () {","return arg ? __coverage__ : __coverage__;","}());"],"f":{"1":1},"fnMap":{"1":{"line":1,"loc":{"end":{"column":13,"line":1},"start":{"column":1,"line":1}},"name":"(anonymous_1)"}},"path":"/test","s":{"1":1,"2":1},"statementMap":{"1":{"end":{"column":5,"line":3},"start":{"column":0,"line":1}},"2":{"end":{"column":41,"line":2},"start":{"column":0,"line":2}}}}}
);
// init options.coverage2
options.coverage2 = local.vm.runInNewContext(options.data, { arg: 1 });
// validate options.coverage2
local.utility2.assertJsonEqual(options.coverage2,
{"/test":{"b":{"1":[1,0]},"branchMap":{"1":{"line":2,"locations":[{"end":{"column":25,"line":2},"start":{"column":13,"line":2}},{"end":{"column":40,"line":2},"start":{"column":28,"line":2}}],"type":"cond-expr"}},"code":["(function () {","return arg ? __coverage__ : __coverage__;","}());"],"f":{"1":1},"fnMap":{"1":{"line":1,"loc":{"end":{"column":13,"line":1},"start":{"column":1,"line":1}},"name":"(anonymous_1)"}},"path":"/test","s":{"1":1,"2":1},"statementMap":{"1":{"end":{"column":5,"line":3},"start":{"column":0,"line":1}},"2":{"end":{"column":41,"line":2},"start":{"column":0,"line":2}}}}}
);
// test merge-update handling-behavior
local.istanbul.coverageMerge(options.coverage1, options.coverage2);
// validate merged options.coverage1
local.utility2.assertJsonEqual(options.coverage1,
{"/test":{"b":{"1":[1,1]},"branchMap":{"1":{"line":2,"locations":[{"end":{"column":25,"line":2},"start":{"column":13,"line":2}},{"end":{"column":40,"line":2},"start":{"column":28,"line":2}}],"type":"cond-expr"}},"code":["(function () {","return arg ? __coverage__ : __coverage__;","}());"],"f":{"1":2},"fnMap":{"1":{"line":1,"loc":{"end":{"column":13,"line":1},"start":{"column":1,"line":1}},"name":"(anonymous_1)"}},"path":"/test","s":{"1":2,"2":2},"statementMap":{"1":{"end":{"column":5,"line":3},"start":{"column":0,"line":1}},"2":{"end":{"column":41,"line":2},"start":{"column":0,"line":2}}}}}
);
/* jslint-ignore-end */
onError();
};

local.testCase_webpage_default = function (options, onError) {
/*
* this function will test the webpage's default handling-behavior
Expand Down

0 comments on commit 1f0af61

Please sign in to comment.