diff --git a/index.js b/index.js index f0c21d4..14101ca 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ const fs = require('fs'); const path = require('path'); const omit = require('object.omit'); const merge = require('lodash.merge'); +const get = require('lodash.get'); const runAudit = require('./runAudit'); const Aggregator = require('./aggregator'); @@ -52,6 +53,15 @@ module.exports = { options.lighthouse && omit(options.lighthouse, 'preScript'); this.lightHouseConfig = merge(defaultConfig, this.lightHouseConfig); + // Special handling since some configs are strings but need to be the correct type for Lighthouse + const mobileSetting = get( + this.lightHouseConfig, + 'settings.screenEmulation.mobile', + true + ); + if (mobileSetting === 'false') { + this.lightHouseConfig.settings.screenEmulation.mobile = false; + } this.lighthouseFlags = options.verbose > 0 ? { logLevel: 'verbose' } : {}; diff --git a/package.json b/package.json index 2465424..d060239 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "dependencies": { "lodash.merge": "4.6.2", "lodash.foreach": "^4.5.0", + "lodash.get": "4.4.2", "lodash.set": "^4.3.2", "lighthouse": "7.2.0", "object.omit": "3.0.0",