Skip to content

Commit

Permalink
Merge remote-tracking branch 'wvanderp/switchToKarma' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Dec 7, 2021
2 parents 8111e5d + 5305b4f commit 94db5c2
Show file tree
Hide file tree
Showing 17 changed files with 611 additions and 767 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ transifex.auth
/dist/mapillary-js/
/dist/pannellum-streetside/

/coverage/

# autogenerated symlinks
land.html
/img
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ transifex.auth

/docs/
/test/

/coverage/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Radio-button based presets fields can be in an non-unique state (e.g. a tunnel which is also a ford) – this is now rendered like a multi selection with conflicting states ([#8796])
* Add colours for preset categories ([#8799])
#### :hammer: Development
* switch test runner to [karma](https://karma-runner.github.io/) ([#8764], thanks [@wvanderp])

[#8057]: https://github.com/openstreetmap/iD/issues/8057
[#8519]: https://github.com/openstreetmap/iD/issues/8519
[#8764]: https://github.com/openstreetmap/iD/pull/8764
[#8771]: https://github.com/openstreetmap/iD/issues/8771
[#8781]: https://github.com/openstreetmap/iD/issues/8781
[#8782]: https://github.com/openstreetmap/iD/pull/8782
Expand All @@ -96,6 +98,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#8839]: https://github.com/openstreetmap/iD/pull/8839
[@k-yle]: https://github.com/k-yle
[@tpetillon]: https://github.com/tpetillon
[@wvanderp]: https://github.com/wvanderp

# 2.20.2
##### 2021-Oct-28
Expand Down
109 changes: 109 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Karma configuration
// Generated on Wed Sep 01 2021 16:45:06 GMT+0200 (Central European Summer Time)

module.exports = function (config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

plugins: [
'karma-remap-istanbul',
'karma-coverage',
'karma-mocha',
'karma-chrome-launcher'
],

// frameworks to use
// available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter
frameworks: ['mocha'],



// list of files / patterns to load in the browser
files: [
'node_modules/chai/chai.js',
'node_modules/sinon/pkg/sinon.js',
'node_modules/sinon-chai/lib/sinon-chai.js',
'node_modules/happen/happen.js',
'node_modules/fetch-mock/es5/client-bundle.js',
{ pattern: 'dist/iD.js', included: true },
{ pattern: 'dist/iD.css', included: true },
{ pattern: 'dist/**/*', included: false },
'test/spec/spec_helpers.js',
'test/spec/**/*.js'
],


// list of files / patterns to exclude
exclude: [
'**/*.js.map'
],

proxies: {
'/dist/': 'http://localhost:9876/base/dist/',
'/data/': 'http://localhost:9876/base/dist/data/',
'/img/': 'http://localhost:9876/base/dist/img/'
},

// preprocess matching files before serving them to the browser
// available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor
preprocessors: {
'dist/iD.js': ['coverage']
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter
reporters: ['progress', 'coverage', 'karma-remap-istanbul'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://www.npmjs.com/search?q=keywords:karma-launcher
browsers: [
'ChromeHeadless'
],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser instances should be started simultaneously
concurrency: Infinity,

remapIstanbulReporter: {
remapOptions: {
exclude: [
'node_modules'
]
}, //additional remap options
reportOptions: {
basePath: 'modules'
}, //additional report options
reports: {
lcovonly: 'coverage/lcof.info',
html: 'coverage'
}
}
});
};
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"start": "npm-run-all -s build start:server",
"quickstart": "npm-run-all -s build:dev start:server",
"start:server": "node scripts/server.js",
"test": "npm-run-all -s lint build:css build:data build:legacy test:spec",
"test:spec": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec",
"test": "npm-run-all -s lint build test:spec",
"test:spec": "karma start karma.conf.js",
"translations": "node scripts/update_locales.js"
},
"dependencies": {
Expand Down Expand Up @@ -82,30 +82,34 @@
"@rollup/plugin-node-resolve": "~13.0.5",
"autoprefixer": "^10.0.1",
"btoa": "^1.2.1",
"chai": "^4.1.0",
"chai": "^4.3.4",
"cldr-core": "37.0.0",
"cldr-localenames-full": "37.0.0",
"colors": "^1.1.2",
"concat-files": "^0.1.1",
"d3": "~6.6.0",
"editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
"eslint": "^7.1.0",
"fetch-mock": "^9.11.0",
"gaze": "^1.1.3",
"glob": "^7.1.0",
"happen": "^0.3.1",
"happen": "^0.3.2",
"js-yaml": "^4.0.0",
"json-stringify-pretty-compact": "^3.0.0",
"karma": "^6.3.5",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.3",
"karma-mocha": "^2.0.1",
"karma-remap-istanbul": "^0.6.0",
"mapillary_sprite_source": "^1.8.0",
"mapillary-js": "4.0.0",
"minimist": "^1.2.3",
"mocha": "^7.0.1",
"mocha-phantomjs-core": "^2.1.0",
"mocha": "^8.4.0",
"name-suggestion-index": "~6.0",
"node-fetch": "^2.6.1",
"npm-run-all": "^4.0.0",
"object-inspect": "1.10.3",
"osm-community-index": "~5.1.0",
"phantomjs-prebuilt": "~2.1.16",
"postcss": "^8.1.1",
"postcss-selector-prepend": "^0.5.0",
"rollup": "~2.52.8",
Expand All @@ -114,8 +118,8 @@
"rollup-plugin-visualizer": "~4.2.0",
"shelljs": "^0.8.0",
"shx": "^0.3.0",
"sinon": "7.5.0",
"sinon-chai": "^3.3.0",
"sinon": "^11.1.2",
"sinon-chai": "^3.7.0",
"smash": "0.0",
"static-server": "^2.2.1",
"svg-sprite": "1.5.1",
Expand Down
3 changes: 2 additions & 1 deletion test/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"fakeFetch": true,
"happen": false,
"iD": false,
"sinon": false
"sinon": false,
"fetchMock": true
},
"rules": {
"no-unused-expressions": "off"
Expand Down
Loading

0 comments on commit 94db5c2

Please sign in to comment.