stencil icon indicating copy to clipboard operation
stencil copied to clipboard

bug: __mocks__ copied to output target

Open mrtnmgs opened this issue 1 month ago • 3 comments

Prerequisites

Stencil Version

4.18.0

Current Behavior

Stencil copies over mocks directories to dist and throws warnings about duplicate mocks. The mocks are ./src/global/services/__mocks__ and ./src/global/__mocks__ Stencil's console warning:

jest-haste-map: duplicate manual mock found: functions
  The following files share their name; please delete one of them:
    * <rootDir>\src\global\__mocks__\functions.tsx
    * <rootDir>\dist\collection\global\__mocks__\functions.js
    * 
jest-haste-map: duplicate manual mock found: http-service
  The following files share their name; please delete one of them:
    * <rootDir>\src\global\services\__mocks__\http-service.tsx
    * <rootDir>\dist\collection\global\services\__mocks__\http-service.js

I wondered if I wasn't supposed to write the mocks in TypeScript, but same thing with .js files:

jest-haste-map: duplicate manual mock found: functions
  The following files share their name; please delete one of them:
    * <rootDir>\src\global\__mocks__\functions.js
    * <rootDir>\dist\collection\global\__mocks__\functions.js

jest-haste-map: duplicate manual mock found: http-service
  The following files share their name; please delete one of them:
    * <rootDir>\src\global\services\__mocks__\http-service.js
    * <rootDir>\dist\collection\global\services\__mocks__\http-service.js

I couldn't find a config option that would allow to explicitly exclude these directories.

Expected Behavior

__mocks__ directories should be excluded when copying files to build directories

System Info

Windows, npm 9.7.2

Steps to Reproduce

create file src/global/functions.tsx and matching mock src/global/__mocks__/functions.tsx. run npm test.

Code Reproduction URL

https://github.com/mrtnmgs/mockbug

Additional Information

No response

mrtnmgs avatar May 20 '24 13:05 mrtnmgs