Commit 4dc814d90a38bdc7440f30c5f2b1d499b1ef44e2
1 parent
79e99040
Exists in
master
and in
35 other branches
ajustes nos testes
Showing
4 changed files
with
47 additions
and
62 deletions
Show diff stats
karma.conf.js
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | var path = require('path'); |
5 | 5 | var conf = require('./gulp/conf'); |
6 | 6 | |
7 | + | |
7 | 8 | var _ = require('lodash'); |
8 | 9 | var wiredep = require('wiredep'); |
9 | 10 | |
... | ... | @@ -17,10 +18,11 @@ function listFiles() { |
17 | 18 | devDependencies: true |
18 | 19 | }); |
19 | 20 | |
20 | - var patterns = wiredep(wiredepOptions).js | |
21 | + var patterns = [].concat(wiredep(wiredepOptions).js) | |
21 | 22 | .concat([ |
22 | - path.join(conf.paths.src, 'noosfero.js') | |
23 | - ,path.join(conf.paths.src, 'noosfero-testing.js'), | |
23 | + //path.join(conf.paths.src, 'common.js'), | |
24 | + //, path.join(conf.paths.src, 'index.ts') | |
25 | + path.join(conf.paths.src, 'test.js') | |
24 | 26 | // path.join(conf.paths.src, '/app/**/*.module.js'), |
25 | 27 | // path.join(conf.paths.src, '/app/**/*.js'), |
26 | 28 | // path.join(conf.paths.src, '/**/*.spec.js'), |
... | ... | @@ -41,7 +43,7 @@ function listFiles() { |
41 | 43 | watched: false |
42 | 44 | }); |
43 | 45 | files.push({ |
44 | - pattern: path.join(conf.paths.src, '/*.map'), | |
46 | + pattern: path.join(conf.paths.src, '/test.js.map'), | |
45 | 47 | included: false, |
46 | 48 | served: true |
47 | 49 | }); |
... | ... | @@ -68,61 +70,34 @@ module.exports = function (config) { |
68 | 70 | }, |
69 | 71 | |
70 | 72 | |
71 | - frameworks: ['jasmine'],//, 'angular-filesort'], | |
73 | + frameworks: ['jasmine', 'phantomjs-shim'],//, 'angular-filesort'], | |
72 | 74 | |
73 | 75 | angularFilesort: { |
74 | 76 | whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')] |
75 | 77 | }, |
76 | 78 | |
77 | - browsers: ['Chrome'], | |
78 | - | |
79 | - webpack: _.merge({}, webpackConfig, { | |
80 | - externals: { | |
81 | - encapsulatedWindow: 'Object.create(window)' | |
82 | - | |
83 | - }, | |
84 | - resolve: { | |
85 | - alias : { | |
86 | - angular: "angular/angular.js" | |
87 | - } | |
88 | - }, | |
89 | - module: { | |
90 | - loaders: [ | |
91 | - { | |
92 | - test: /angular\.js$/, | |
93 | - loaders:[ | |
94 | - 'imports?window=encapsulatedWindow', | |
95 | - 'exports?window.angular' | |
96 | - ], | |
97 | - include: [new RegExp(__dirname + '/bower_components/angular/')] | |
98 | - } | |
99 | - ], | |
100 | - postLoaders: [ | |
101 | - { | |
102 | - test: /src\/noosfero.js/, | |
103 | - exclude: [ | |
104 | - /node_modules\//, | |
105 | - /bower_components\//, | |
106 | - /src\/noosfero-testing.js/ | |
107 | - ], | |
108 | - loader: 'istanbul-instrumenter' | |
109 | - } | |
110 | - | |
111 | - | |
112 | - ] | |
113 | - } | |
79 | + browsers: ['PhantomJS'], | |
80 | + | |
81 | + webpack2: _.merge({ | |
82 | + | |
83 | + }, webpackConfig, { | |
84 | + /*devtool: 'cheap-module-source-map'*/ | |
114 | 85 | }), |
115 | 86 | webpackServer: { |
116 | 87 | quite: true |
117 | 88 | }, |
118 | 89 | plugins: [ |
90 | + require('karma-webpack'), | |
119 | 91 | 'karma-chrome-launcher', |
120 | 92 | 'karma-phantomjs-launcher', |
121 | 93 | 'karma-angular-filesort', |
122 | 94 | 'karma-webpack', |
95 | + 'karma-phantomjs-shim', | |
123 | 96 | 'karma-coverage', |
124 | 97 | 'karma-jasmine', |
125 | - 'karma-ng-html2js-preprocessor' | |
98 | + 'karma-spec-reporter', | |
99 | + 'karma-ng-html2js-preprocessor', | |
100 | + 'karma-sourcemap-loader' | |
126 | 101 | ], |
127 | 102 | |
128 | 103 | coverageReporter: { |
... | ... | @@ -130,7 +105,7 @@ module.exports = function (config) { |
130 | 105 | dir: 'coverage/' |
131 | 106 | }, |
132 | 107 | |
133 | - reporters: ['dots', "coverage"], | |
108 | + reporters: ['spec', "coverage"], | |
134 | 109 | |
135 | 110 | proxies: { |
136 | 111 | '/assets/': path.join('/base/', conf.paths.src, '/assets/') |
... | ... | @@ -141,9 +116,11 @@ module.exports = function (config) { |
141 | 116 | // The coverage preprocessor is added in gulp/unit-test.js only for single tests |
142 | 117 | // It was not possible to do it there because karma doesn't let us now if we are |
143 | 118 | // running a single test or not |
144 | - configuration.preprocessors = { | |
145 | - 'src/**/*.[sS]pec.ts': ['webpack'] | |
146 | - }; | |
119 | + configuration.preprocessors = {} | |
120 | + // 'src/**/*.ts': ['sourcemap'], | |
121 | + // 'src/**/*.js': ['sourcemap'], | |
122 | + // 'src/**/*.[sS]pec.ts': ['sourcemap'] | |
123 | + // }; | |
147 | 124 | |
148 | 125 | pathSrcHtml.forEach(function (path) { |
149 | 126 | configuration.preprocessors[path] = ['ng-html2js']; | ... | ... |
package.json
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | "browser-sync-spa": "~1.0.3", |
17 | 17 | "chalk": "~1.1.1", |
18 | 18 | "concurrently": "^2.0.0", |
19 | + "core-js": "^2.1.3", | |
19 | 20 | "del": "~2.0.2", |
20 | 21 | "eslint-plugin-angular": "~0.12.0", |
21 | 22 | "estraverse": "~4.1.0", |
... | ... | @@ -52,11 +53,15 @@ |
52 | 53 | "karma-jasmine": "~0.3.6", |
53 | 54 | "karma-ng-html2js-preprocessor": "~0.2.0", |
54 | 55 | "karma-phantomjs-launcher": "~0.2.1", |
56 | + "karma-phantomjs-shim": "^1.2.0", | |
57 | + "karma-sourcemap-loader": "^0.3.7", | |
58 | + "karma-spec-reporter": "0.0.24", | |
55 | 59 | "karma-webpack": "^1.7.0", |
56 | 60 | "lodash": "~3.10.1", |
57 | 61 | "main-bower-files": "~2.9.0", |
58 | 62 | "ng-forward": "0.0.1-alpha.12", |
59 | 63 | "phantomjs": "~1.9.18", |
64 | + "phantomjs-polyfill": "0.0.2", | |
60 | 65 | "reflect-metadata": "^0.1.3", |
61 | 66 | "ts-loader": "^0.8.1", |
62 | 67 | "typescript": "^1.8.2", | ... | ... |
src/app/components/noosfero-articles/article/article.directive.spec.ts
1 | -let oldDefine = Object.defineProperties; | |
2 | - | |
3 | -Object.defineProperties = function(object, properties){ | |
4 | - let filteredProps = {}; | |
5 | - let currentProperties = Object.getOwnPropertyNames(object); | |
6 | - for (let i = 0; i < currentProperties.length; i++) { | |
7 | - let prop = currentProperties[i]; | |
8 | - if(currentProperties.indexOf(prop) < 0){ | |
9 | - filteredProps[prop] = properties[prop]; | |
10 | - } | |
11 | - } | |
12 | - oldDefine(object, <any>filteredProps); | |
13 | -}; | |
1 | +// let oldDefine = Object.defineProperties; | |
2 | +// | |
3 | +// Object.defineProperties = function(object, properties){ | |
4 | +// let filteredProps = {}; | |
5 | +// let currentProperties = Object.getOwnPropertyNames(object); | |
6 | +// for (let i = 0; i < currentProperties.length; i++) { | |
7 | +// let prop = currentProperties[i]; | |
8 | +// if(currentProperties.indexOf(prop) < 0){ | |
9 | +// filteredProps[prop] = properties[prop]; | |
10 | +// } | |
11 | +// } | |
12 | +// oldDefine(object, <any>filteredProps); | |
13 | +// }; | |
14 | 14 | |
15 | 15 | import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder'; |
16 | 16 | import {Input, provide, Component} from 'ng-forward'; | ... | ... |
webpack.config.js
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | var argv = require("yargs").argv; |
4 | 4 | var path = require("path"); |
5 | 5 | var glob = require("glob"); |
6 | - | |
6 | +var webpack = require("webpack"); | |
7 | 7 | |
8 | 8 | var extension = ".js"; |
9 | 9 | if (argv.production) { |
... | ... | @@ -22,7 +22,7 @@ var testingFiles = glob.sync("./src/app/**/*.[sS]pec.ts"); |
22 | 22 | var webpackConfig = { |
23 | 23 | entry: { |
24 | 24 | noosfero: './src/app/index.ts', |
25 | - 'noosfero-testing': testingFiles | |
25 | + 'test': './src/test.ts' | |
26 | 26 | }, |
27 | 27 | |
28 | 28 | |
... | ... | @@ -30,6 +30,9 @@ var webpackConfig = { |
30 | 30 | path: path.join(__dirname, "src"), |
31 | 31 | filename: "[name]" + extension, |
32 | 32 | }, |
33 | + | |
34 | + /*plugins: [ new webpack.optimize.CommonsChunkPlugin("common.js") ],*/ | |
35 | + | |
33 | 36 | resolve: { |
34 | 37 | // Add `.ts` and `.tsx` as a resolvable extension. |
35 | 38 | extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'] | ... | ... |