neutrinojs / neutrino

Create and build modern JavaScript projects with zero initial configuration.
https://neutrinojs.org
Mozilla Public License 2.0
3.95k stars 214 forks source link

Allow specifying karma files option without removing the tests file specification neutrino use #1645

Closed elpddev closed 7 months ago

elpddev commented 3 years ago

Bug or issue?

Issue/Feature request.

Currently Neutrino use the karma file configuration to specify test files pattern to load: https://github.com/neutrinojs/neutrino/blob/master/packages/karma/index.js#L51

   files: [
            {
              pattern: tests,
              watched: false,
              included: true,
              served: true,
            },
          ],

Also, neutrino does this with the option to shallow merge options given to the preset.

use(karma({ files: [ { pattern: jqueryPath, watched: false } ] });

Problem: Specifying the files option override(not merged) the tests files pattern neutrino specify.

Please try to answer the following questions:

Feature request or enhancement?

Please describe your request in detail. Use the following questions as guidance:

I am willing to do a PR, but am not sure what is the correct path to do this keeping the overall design pattern used for neutrino preset config specification. If the options could have contained a hook function that would have been called at the point of the files specification that would solved it, but it complicate the code.

elpddev commented 3 years ago

Looking deeper, it seems this is the behavior of deepmerge old version 1.5.2 Which karma neutrino uses. Newer versions do array concat. https://github.com/TehShrike/deepmerge/pull/77