javascriptcucumberes6-modulescucumberjs

Multi-profile (ESM format) Cucumber configuration file not quite working


I have the following configuration file for Cucumber:

const common = {
  // ...common settings here
};

module.exports = {
  ci: {
    ...common,
    format: [
      "progress",
    ],
  },
  default: {
    ...common,
    format: [
      "progress-bar",
    ],
  },
};

This works flawlessly. I can specify any of the defined profiles, etc. I'm looking migrate, if possible, the same configuration file into ESM format, but I just don't quite understand how to make the default profile work. If I do:

export default {
  ci: { /* ... */ },
  default: { /* ... */ },
};

...and place "type": "module" in package.json, it stops working and the configuration is not understood anymore.

Can anyone spot what's the catch there? Would be great a small explanation if this can be done :)


Solution

  • I was initially confused by the default keyword ;)

    This is a working (ESM) configuration with multiple profiles:

    const common = {
      /* ... */
    };
    
    export const ci = {
      ...common,
      format: [
        "progress",
      ],
    };
    
    export default {
      ...common,
      format: [
        "progress-bar",
      ],
    };