Skip to content

Commit

Permalink
Merge pull request #3465 from camptocamp/test2
Browse files Browse the repository at this point in the history
First step to fix the Webpack tests
  • Loading branch information
sbrunner authored Jan 31, 2018
2 parents 5d9233d + e6788b2 commit 668fd9f
Show file tree
Hide file tree
Showing 59 changed files with 3,184 additions and 2,651 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ globals:
gmf: false
app: false
gmfapp: false
inject: false
jsts: false
moment: false
DateFormatter: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- export CHROME_BIN=/opt/google/chrome/chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- make test || true
- ./node_modules/karma/bin/karma start karma-conf.js --single-run || true
- cat .build/coverage/lcov.info || true
- make lint
- make check-examples-webpack
Expand Down
16 changes: 2 additions & 14 deletions buildtools/webpack-migration
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,16 @@ JSCS_ARGS="--non-default-import=ol,ol/proj,ol/proj/proj4,ol/dom,ol/array,ol/math
jscodeshift --transform=node_modules/googshift/transforms/goog_provide_to_goog_module.js $JSCS_ARGS src contribs/gmf/src examples contribs/gmf/examples test contribs/gmf/test contribs/gmf/apps
jscodeshift --transform=node_modules/googshift/transforms/goog_module_to_es6_module.js $JSCS_ARGS --absolute-module=true src contribs/gmf/src examples contribs/gmf/examples test contribs/gmf/test
jscodeshift --transform=node_modules/googshift/transforms/goog_module_to_es6_module.js $JSCS_ARGS contribs/gmf/apps
sed -i '/^if/d' src/proj/somerc.js src/proj/lcc.js src/proj/utm.js
sed -i '/^ ol/d' src/proj/somerc.js src/proj/lcc.js src/proj/utm.js
sed -i '/^}$/d' src/proj/somerc.js src/proj/lcc.js src/proj/utm.js
git add -A # To be removed when we use the new OpenLayers version
buildtools/git-grep-sed 'Sphere' 's|ol/Sphere|ol/sphere|g'
find -name node_modules -prune -or -name '*.js' -print | xargs sed -i 's|^// webpack: ||g'
find -name node_modules -prune -or -name '*.js' -print | xargs sed -i 's|// webpack: ||g'
find -name node_modules -prune -or -name '*.js' -print | xargs sed -i '/nowebpack$/d'
node_modules/.bin/eslint --fix src contribs/gmf/src examples contribs/gmf/examples test contribs/gmf/test contribs/gmf/apps || true
mv karma-conf{-webpack,}.js
mv src/{ngeo,index}.js
mv contribs/gmf/src/{gmf,index}.js
mv src/goog.asserts.js{_,}
mv src/goog.asserts.prod.js{_,}
buildtools/git-grep-sed 'gmf/test/data/' 's/\<gmfTestDataThemes\>/themes/g'
buildtools/git-grep-sed 'gmf/test/data/' 's/\<gmfTestDataPrintcapabilities\>/printCapabilities/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputFuel\>/msGMLOutputFuel/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputBusStop\>/gmlResponseBusStop/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputBusStopAndInformation\>/gmlResponseBusStopAndInformation/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputInformationWfs\>/gmlResponseInformationWfs/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputBusStopWfs\>/gmlResponseBusStopWfs/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataMsGMLOutputInformationHitsWfs\>/gmlResponseInformationHitsWfs/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataWmtsCapabilities\>/wmtsCapabilities/g'
buildtools/git-grep-sed 'ngeo/test/data/' 's/\<ngeoTestDataGeoAdminLocationSearch\>/geoAdminLocationSearch/g'
sed '/ngeo:/d' -i .eslintrc.yaml
sed '/gmf:/d' -i .eslintrc.yaml
sed '/ol:/d' -i .eslintrc.yaml
Expand Down
2 changes: 2 additions & 0 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ const config = {
'../node_modules'
],
alias: {
'ngeo/test': path.resolve(__dirname, '../test/spec'),
'gmf/test': path.resolve(__dirname, '../contribs/gmf/test/spec'),
'ngeo': path.resolve(__dirname, '../src'),
'gmf': path.resolve(__dirname, '../contribs/gmf/src'),
'goog/asserts': path.resolve(__dirname, '../src/goog.asserts.js'),
Expand Down
15 changes: 15 additions & 0 deletions contribs/gmf/test/spec/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// webpack: import 'jquery';
// webpack: import 'angular';
// webpack: import 'angular-mocks';
import './beforeeach.js';
import './controllers/gmfprintcontroller.spec.js';
import './services/share.spec.js';
import './services/themesservice.spec.js';
import './services/syncLayertreeMap.spec.js';
import './services/authenticationservice.spec.js';
import './services/treemanager.spec.js';
import './services/thememanager.spec.js';
import './services/permalinkservice.spec.js';
import './directives/displayquerygrid.spec.js';
import './directives/displayquerywindow.spec.js';
import './directives/profile.spec.js';
4 changes: 1 addition & 3 deletions contribs/gmf/test/spec/beforeeach.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*eslint valid-jsdoc: 0 */

goog.require('gmf.theme.module');

beforeEach(() => {
const gmfModule = angular.module('gmf');
gmfModule.constant('angularLocaleScript', 'http://fake');
gmfModule.constant('gmfLayersUrl', 'https://fake');

module('gmf', ($provide) => {
angular.mock.module('gmf', ($provide) => {
$provide.value('gmfTreeUrl', 'http://fake/gmf/themes');
$provide.value('gmfShortenerCreateUrl', 'http://fake/gmf/short/create');
$provide.value('authenticationBaseUrl', 'https://fake/gmf/authentication');
Expand Down
5 changes: 2 additions & 3 deletions contribs/gmf/test/spec/controllers/gmfprintcontroller.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global printCapabilities */
goog.require('gmf.print.component');
goog.require('gmf.test.data.printcapabilities');
goog.require('ol.Map');
Expand All @@ -9,7 +8,7 @@ describe('GmfPrintController', () => {
let $controller, $rootScope, $scope;
let gmfPrintCtrl;

beforeEach(inject((_$controller_, _$rootScope_) => {
beforeEach(angular.mock.inject((_$controller_, _$rootScope_) => {
$controller = _$controller_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
Expand All @@ -24,7 +23,7 @@ describe('GmfPrintController', () => {
})
});
gmfPrintCtrl.map.setSize([100, 100]);
gmfPrintCtrl.parseCapabilities_({data: printCapabilities});
gmfPrintCtrl.parseCapabilities_({data: gmf.test.data.printcapabilities});
}));

it('Get Set rotation', () => {
Expand Down
Loading

0 comments on commit 668fd9f

Please sign in to comment.