Skip to content

Commit 9a0836a

Browse files
committed
Create example file and simple comparation test for it
1 parent 5a7f68e commit 9a0836a

File tree

5 files changed

+114
-1
lines changed

5 files changed

+114
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

examples/annotated-reference.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports, __webpack_require__) {
46+
47+
'use strict';
48+
49+
angular.module('test', [])
50+
.controller('testCtrl', ["$scope", function($scope) {
51+
52+
}])
53+
.factory('testFactory', ["$cacheFactory", function($cacheFactory) {
54+
return {};
55+
}])
56+
.service('testNotAnnotated', function() {
57+
return {};
58+
})
59+
.directive('testDirective', ["$timeout", function ($timeout) {
60+
return {
61+
restrict: 'E',
62+
controller: ["$scope", function($scope) {
63+
64+
}]
65+
};
66+
}]);
67+
68+
/***/ }
69+
/******/ ]);

examples/file-to-annotate.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
angular.module('test', [])
4+
.controller('testCtrl', function($scope) {
5+
6+
})
7+
.factory('testFactory', function($cacheFactory) {
8+
return {};
9+
})
10+
.service('testNotAnnotated', function() {
11+
return {};
12+
})
13+
.directive('testDirective', function ($timeout) {
14+
return {
15+
restrict: 'E',
16+
controller: function($scope) {
17+
18+
}
19+
};
20+
});

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Webpack loader that runs ng-annotate on your bundles",
55
"main": "loader.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"build-example": "webpack",
8+
"test": "npm run build-example && cmp examples/annotated-reference.js examples/dist/build.js && echo 'Test passed' || exit 123"
89
},
910
"repository": {
1011
"type": "git",
@@ -25,5 +26,9 @@
2526
"ng-annotate": "^0.15.4",
2627
"source-map": "^0.4.2",
2728
"loader-utils": "^0.2.6"
29+
},
30+
"devDependencies": {
31+
"node-libs-browser": "0.5.2",
32+
"webpack": "1.9.10"
2833
}
2934
}

webpack.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
module.exports = {
3+
context: __dirname + '/examples',
4+
entry: './file-to-annotate',
5+
output: {
6+
path: 'examples/dist',
7+
filename: 'build.js'
8+
},
9+
resolveLoader: {
10+
fallback: __dirname
11+
},
12+
module: {
13+
loaders: [
14+
{test: /\.js$/, loaders: ['loader']},
15+
]
16+
}
17+
}

0 commit comments

Comments
 (0)