Closed RayOei closed 2 months ago
Hi @RayOei , It seems that you have the same problem described in #488. Please let me know if that solution works also in your case.
Hi @javierbrea, I missed that issue and indeed this solves the problem. I would suggest to add the option allowUnknownArguments: true
more prominent to the docs as with the use of jest
and detox
this will happen more often, I would think. Thanks!
Describe the bug The example to create an instance taken from https://www.mocks-server.org/docs/api/javascript/#creating-an-instance-with-pre-installed-plugins (
Creating an instance with pre-installed plugins and custom configuration
) fails to load and throws an exception.To Reproduce Code example and added to a RN test module with Jest, called in the
beforeAll
section.Expected behavior No exception but having a working server instance.
Logs 17:13:02:70 [debug][variantHandlers] Registering 'proxy' variant handler 17:13:02:70 [debug][files] Creating files loader 'openapi' 17:13:02:70 [verbose][plugins] Registered 4 plugins without errors 17:13:02:70 [debug][variantHandlers] Registering 'json' variant handler 17:13:02:70 [debug][variantHandlers] Registering 'text' variant handler 17:13:02:70 [debug][variantHandlers] Registering 'status' variant handler 17:13:02:70 [debug][variantHandlers] Registering 'middleware' variant handler 17:13:02:70 [debug][variantHandlers] Registering 'static' variant handler 17:13:02:70 [debug][variantHandlers] Registering 'file' variant handler 17:13:02:70 [verbose][variantHandlers] Registered 6 variant handlers without errors error: unknown option '--config' ● process.exit called with "1"
Operating system, Node.js an npm versions, or browser version (please complete the following information):
Edit: I did some digging, added some logging, and it seems that the Detox/Jest environment I am in plays a role here.
~/Projects/xxxxxxx (detox_base ✗) detox test -l info -c ios.sim.debug xxxx.mock.test.js 18:47:21.842 detox[69576] B jest --config test/jest.config.js xxxx.mock.test.js 18:47:26.118 detox[69577] i xxxx.mock.test.js is assigned to 7661385B-4654-493B-9245-CEFA5FC291A3 (iPhone 15) => added logging in
@mocks-server/config/node_modules/commander/lib/command.js/Command/_parseCommand the parameter unknown and variable parsed.unknown[0]
18:47:26.134 detox[69577] --config,test/jest.config.js,xxxx.mock.test.js (unknown) 18:47:26.134 detox[69577] i --config (parsed.unknown[0]) 18:47:26:15 [debug][variantHandlers] Registering 'proxy' variant handler ..etc..