X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=Gruntfile.js;h=d1ef72f2701a22ce9ee6fa35eb4482ec61db45f1;hb=69240c4b143ef9e01a7f3479349c56e568504ba3;hp=7b3af54c957a287430dbe3c308110ffcab56baa2;hpb=b6d4bf303021e8a10c3478d0b882c21dd7b08412;p=lhc%2Fweb%2Fwiklou.git diff --git a/Gruntfile.js b/Gruntfile.js index 7b3af54c95..d1ef72f270 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function ( grunt ) { var wgServer = process.env.MW_SERVER, wgScriptPath = process.env.MW_SCRIPT_PATH, + WebdriverIOconfigFile, karmaProxy = {}; grunt.loadNpmTasks( 'grunt-banana-checker' ); @@ -13,30 +14,36 @@ module.exports = function ( grunt ) { grunt.loadNpmTasks( 'grunt-jsonlint' ); grunt.loadNpmTasks( 'grunt-karma' ); grunt.loadNpmTasks( 'grunt-stylelint' ); + grunt.loadNpmTasks( 'grunt-webdriver' ); karmaProxy[ wgScriptPath ] = { target: wgServer + wgScriptPath, changeOrigin: true }; + if ( process.env.JENKINS_HOME ) { + WebdriverIOconfigFile = './tests/selenium/wdio.conf.jenkins.js'; + } else { + WebdriverIOconfigFile = './tests/selenium/wdio.conf.js'; + } + grunt.initConfig( { eslint: { all: [ '**/*.js', '!docs/**', - '!tests/**', '!node_modules/**', '!resources/lib/**', '!resources/src/jquery.tipsy/**', '!resources/src/jquery/jquery.farbtastic.js', '!resources/src/mediawiki.libs/**', + // Third-party code of PHPUnit coverage report + '!tests/coverage/**', '!vendor/**', // Explicitly say "**/*.js" here in case of symlinks '!extensions/**/*.js', '!skins/**/*.js', // Skip functions aren't even parseable - '!resources/src/dom-level2-skip.js', - '!resources/src/es5-skip.js', '!resources/src/mediawiki.hidpi-skip.js' ] }, @@ -55,10 +62,7 @@ module.exports = function ( grunt ) { installer: 'includes/installer/i18n/' }, stylelint: { - options: { - syntax: 'less' - }, - src: '{resources/src/*,mw-config/**}/*.{css,less}' + src: '{resources/src,mw-config}/**/*.{css,less}' }, watch: { files: [ @@ -79,15 +83,21 @@ module.exports = function ( grunt ) { } ], logLevel: 'DEBUG', frameworks: [ 'qunit' ], - reporters: [ 'progress' ], + reporters: [ 'mocha' ], singleRun: true, autoWatch: false, // Some tests in extensions don't yield for more than the default 10s (T89075) - browserNoActivityTimeout: 60 * 1000 + browserNoActivityTimeout: 60 * 1000, + // Karma requires Same-Origin (or CORS) by default since v1.1.1 + // for better stacktraces. But we load the first request from wgServer + crossOriginAttribute: false }, main: { browsers: [ 'Chrome' ] }, + chromium: { + browsers: [ 'Chromium' ] + }, more: { browsers: [ 'Chrome', 'Firefox' ] } @@ -101,7 +111,15 @@ module.exports = function ( grunt ) { return require( 'path' ).join( dest, src.replace( 'resources/', '' ) ); } } + }, + + // Configure WebdriverIO task + webdriver: { + test: { + configFile: WebdriverIOconfigFile + } } + } ); grunt.registerTask( 'assert-mw-env', function () {