This repository has been archived by the owner on Mar 28, 2022. It is now read-only.
Releases: mocks-server/core
Releases · mocks-server/core
Update dependencies
Changed
- Update dependencies
Update dependencies
Changed
- Update dependencies
Update dependencies
Changed
- Update dependencies
Fixed versioning
Changed
- Use fixed versioning in dependencies
Update dependencies
Changed
- Update dependencies
Fix file name conflicts
Fixed
- Conflicts between files with same name and different extension
Configuration file
Added
- Add "addPlugins" configuration.
- Add "disableCommandLineArguments" configuration.
- Add "disableConfigFile" configuration.
- Load configuration and options from file.
- Options can also be passed to the Core Constructor, using the "options" key in the config object.
Json definitions
Added
- Behaviors can now be defined in json format.
- Add behavior "id" property, to be used instead of "name".
- Accept new options object as second argument when defining behaviors programmatically. "id" can be provided as an option.
- Add behaviors "currentId" and "ids" getters, to be used instead of "currentName" and "names"
- Add stop method to plugins.
- Pass new method "load" to plugins, which allows to load fixtures or behaviors definitions programmatically.
- Add "restartServer" method, which should be used instead of "restart".
- Accept "displayName" property in plugins, which improves traces.
- Accept "id" property in fixtures.
Changed
- Convert filesHandler into a plugin. Load it always internally.
Fixed
- Plugins start method was not being called again when core "start" method was called.
- Prevent exit process when there is an error loading files.
Custom Fixtures Handlers
Added
- Add "fixtures" getter, returning all found fixtures in mocks folder, and inside behaviors.
- Add "addFixturesHandler" method, which allows to use fixtures with custom formats and handle responses.
- Add "id" property to fixtures, which will be unique for each different fixture.
- Add "requestMatchId" property to fixtures, which should be the same for fixtures handling same requests.
- Add "request" getter to fixtures, which returns an object describing which requests will handle.
- Add "response" getter to fixtures, which returns an object describing how will be the sent response.
- Add "addRouter" method. "addCustomRouter" is marked for deprecation.
- Add "addSetting" method. "addCustomSetting" is marked for deprecation.
- Add "all" getter to settings.
- Add "extendedFrom" getter to behavior.
- Add "removeRouter" method.
- Add "settings.getValidOptionName" method.
Changed
- Files handler now supports creating fixtures or behaviors at any folder level.
- Files handler now supports files exporting a single behavior or fixture.
- Changed "Behaviors" getters. Data now is not parsed, and returns directly fixtures collections, or, in the case of "all" getter, it returns and object containing behavior names as "keys", containing respective fixtures collections. (It is not considered as a breaking change, as it is an experimental interface yet, as it is indicated in the documentation)
- Change settings automatically to first found behavior if no one is defined.
- Improve start, init and stop server methods. Now support multiple concurrent calls.
- tracer.set method "transport" argument now is passed as second argument. Default value is "console".
- Change "boom" dependency. Now "@hapi/boom" is used.
Default mocks path
Changed
- "behaviors" option renamed to "path". Old option still working due to backward compatibility.
- "path" option has "mocks" value by default. The server will create path if it does not exist.
Fixed
- Fix server started log. Was always printing localhost, without taking into account custom "host" option.