File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# NODEJS
66node_modules
77npm-debug.log
8+
9+ coverage
Original file line number Diff line number Diff line change 1+ language : node_js
2+
3+ node_js :
4+ - " stable"
5+ - " lts/*"
6+ - 6
7+ - 4
8+ - 0.12
9+
10+ env :
11+ global :
12+ - ISTANBUL_COVERAGE : yes
13+
14+ after_success :
15+ - npm i coveralls
16+ - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
Original file line number Diff line number Diff line change @@ -17,8 +17,20 @@ module.exports = function(options) {
1717
1818 if ( typeof options . addDependencyTo === 'object' &&
1919 typeof options . addDependencyTo . addDependency === 'function' ) {
20+ console . warn ( [
21+ "addDependencyTo is deprecated in favor of" ,
22+ "result.messages.dependency; posthtml-loader >= v1.0.1 will" ,
23+ "automatically add your imported files to webpack's file watcher."
24+ ] . join ( "\n" ) ) ;
2025 options . addDependencyTo . addDependency ( src ) ;
2126 }
27+
28+ if ( tree . messages ) {
29+ tree . messages . push ( {
30+ type : "dependency" ,
31+ file : src
32+ } ) ;
33+ }
2234 }
2335 return {
2436 tag : false ,
Original file line number Diff line number Diff line change 11{
22 "name" : " posthtml-include" ,
3- "version" : " 1.1 .0" ,
3+ "version" : " 1.2 .0" ,
44 "description" : " Include file in HTML" ,
55 "main" : " index.js" ,
66 "dependencies" : {
77 "posthtml-parser" : " ^0.1.1"
88 },
99 "devDependencies" : {
1010 "chai" : " ^3.2.0" ,
11+ "istanbul" : " ^0.4.5" ,
1112 "jscs" : " ^1.13.1" ,
1213 "jshint" : " ^2.8.0" ,
1314 "mocha" : " ^2.2.5" ,
14- "posthtml" : " ^0.8.1 "
15+ "posthtml" : " ^0.11.3 "
1516 },
1617 "scripts" : {
17- "test" : " npm run lint && mocha" ,
18+ "test" : " npm run lint && mocha -R dot && npm run cover " ,
1819 "lint" : " jshint . && jscs . -v" ,
20+ "cover" : " istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha -- -R tap" ,
1921 "preversion" : " npm test" ,
2022 "postversion" : " git push && git push --tags"
2123 },
Original file line number Diff line number Diff line change @@ -50,4 +50,18 @@ describe('Simple test', function() {
5050 . use ( plugin ( { addDependencyTo : { addDependency : test } } ) )
5151 . process ( '<include src="./test/blocks/button/button.html">' ) ;
5252 } ) ;
53+
54+ it ( 'messages dependency for addDependency' , function ( done ) {
55+ var includePath = require ( 'path' ) . resolve ( './test/blocks/button/button.html' ) ;
56+
57+ posthtml ( )
58+ . use ( plugin ( ) )
59+ . process ( '<include src="./test/blocks/button/button.html">' )
60+ . then ( function ( result ) {
61+ expect ( result . messages [ 0 ] . file ) . to . eql ( includePath ) ;
62+ done ( ) ;
63+ } ) . catch ( function ( error ) {
64+ done ( error ) ;
65+ } ) ;
66+ } ) ;
5367} ) ;
You can’t perform that action at this time.
0 commit comments