Skip to content

How to return multiple objects from plugins file for use with Configuration API and Code Coverage #14375

Answered by bahmutov
vallme2003 asked this question in Plugins
Discussion options

You must be logged in to vote

At the end of the day, you need to:

  1. let the plugins register their tasks and events, thus you might need to pass the on and config object to each plugin that requires
  2. return the final modified config file.

In our case, you want to first load the appropriate environment config, then send it to the code coverage's registration function

// promisified fs module
const fs = require('fs-extra')
const path = require('path')

function getConfigurationByFile (file) {
  const pathToConfigFile = path.resolve('..', 'config', `${file}.json`)

  return fs.readJson(pathToConfigFile)
}

// plugins file
module.exports = (on, config) => {
  // accept a configFile value or use development by default
  const 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vallme2003
Comment options

Answer selected by vallme2003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants