Skip to content

Commit

Permalink
Merge pull request #413 from mocks-server/release
Browse files Browse the repository at this point in the history
Release v3.9.0
  • Loading branch information
javierbrea authored Aug 8, 2022
2 parents 4058ecf + 1654acc commit 8ae2112
Show file tree
Hide file tree
Showing 42 changed files with 1,906 additions and 1,133 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Node.js mock server running live, interactive mocks in place of real APIs. __It

## Usage

Define your mocked API routes in JSON, JavaScript or TypeScript files. Mocks Server loads them automatically and watches for changes. Defining routes using any of the available APIs is also possible.
Define your mocked API routes in YAML, JSON, JavaScript or TypeScript files. Mocks Server loads them automatically and watches for changes. Defining routes using any of the available APIs is also possible.

Routes can be defined in many ways, from plain objects to Express middlewares, and they can act in different ways also, from sending a response to proxy the request to another host.
Routes can be defined in many ways, from plain objects to plain text and even Express middlewares, and they can act in different ways also, from sending a response to proxy the request to another host.

## Configuration

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"graph": "nx graph"
},
"devDependencies": {
"@babel/core": "7.17.10",
"@babel/eslint-parser": "7.17.0",
"@babel/preset-env": "7.17.10",
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@babel/core": "7.18.10",
"@babel/eslint-parser": "7.18.9",
"@babel/preset-env": "7.18.10",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.18.6",
"@cypress/webpack-preprocessor": "5.12.0",
"@nrwl/cli": "13.8.3",
"@nrwl/eslint-plugin-nx": "13.8.3",
Expand All @@ -38,8 +38,8 @@
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "8.3.4",
"@testing-library/cypress": "8.0.3",
"@typescript-eslint/eslint-plugin": "5.26.0",
"@typescript-eslint/parser": "5.27.0",
"@typescript-eslint/eslint-plugin": "5.32.0",
"@typescript-eslint/parser": "5.32.0",
"babel-jest": "27.5.1",
"babel-loader": "8.2.5",
"babel-plugin-module-resolver": "4.1.0",
Expand All @@ -52,7 +52,7 @@
"cypress": "9.7.0",
"cypress-fail-fast": "3.4.1",
"deepmerge": "4.2.2",
"eslint": "8.20.0",
"eslint": "8.21.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.7.0",
"eslint-plugin-no-only-tests": "2.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build": "tsc && rollup --config",
"mocks:ci": "pnpm -w run nx start admin-api-client-unit-mocks",
"test": "jest --runInBand",
"test:unit": "start-server-and-test mocks:ci tcp:127.0.0.1:3200 test"
"test:unit": "start-server-and-test mocks:ci tcp:127.0.0.1:3110 test"
},
"dependencies": {
"@mocks-server/admin-api-paths": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/admin-api-client/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ describe("AdminApiClient class", () => {
const alertId = alerts[1].id;
const alert = await apiClient.readAlert(alertId);
expect(alert.id).toEqual(alertId);
expect(alert.message).toEqual(expect.stringContaining("Error loading collections"));
expect(alert.message).toEqual(expect.stringContaining("Error loading file"));
expect(alert.message).toEqual(expect.stringContaining("collections.js"));
});
});

Expand Down
3 changes: 2 additions & 1 deletion packages/admin-api-client/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ describe("admin api client global methods", () => {
const alertId = alerts[1].id;
const alert = await readAlert(alertId);
expect(alert.id).toEqual(alertId);
expect(alert.message).toEqual(expect.stringContaining("Error loading collections"));
expect(alert.message).toEqual(expect.stringContaining("Error loading file"));
expect(alert.message).toEqual(expect.stringContaining("collections.js"));
});
});

Expand Down
14 changes: 14 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
### Removed

## [3.9.0] - 2022-08-08

### Changed

- refactor(#371): Separate logic about loading files from logic about loading routes and collections from files. Use the new `files.createLoader` method to create routes and collections loaders.

### Added
- feat: Expose files API in core.
- feat: Add `createLoader` method to files.
- feat: Add `reload` method to files.

### Fixed
- fix: Debounce time in files reload aw not working. Now it has 200ms of debounce, with a maximum time wait of 1000ms

## [3.8.0] - 2022-08-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {

// The glob patterns Jest uses to detect test files
testMatch: ["<rootDir>/test/**/*.spec.js"],
// testMatch: ["<rootDir>/test/mock/helpers.spec.js"],
// testMatch: ["<rootDir>/test/files/FilesLoaders.spec.js"],

// The test environment that will be used for testing
testEnvironment: "node",
Expand Down
8 changes: 5 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mocks-server/core",
"version": "3.8.0",
"version": "3.9.0",
"description": "Pluggable mock server supporting multiple route variants and mocks",
"keywords": [
"mocks",
Expand Down Expand Up @@ -38,7 +38,8 @@
"test:unit": "jest"
},
"dependencies": {
"@babel/register": "7.17.7",
"@babel/core": "7.18.10",
"@babel/register": "7.18.9",
"@hapi/boom": "9.1.4",
"@mocks-server/config": "workspace:*",
"@mocks-server/logger": "workspace:*",
Expand All @@ -58,7 +59,8 @@
"node-watch": "0.7.3",
"update-notifier": "5.1.0",
"winston": "3.8.1",
"winston-array-transport": "1.1.10"
"winston-array-transport": "1.1.10",
"yaml": "2.1.1"
},
"engines": {
"node": ">=14.x"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.organization=mocks-server
sonar.projectKey=mocks-server_main_core
sonar.projectName=core
sonar.projectVersion=3.8.0
sonar.projectVersion=3.9.0

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ class Core {
return this._variantHandlers;
}

get files() {
return this._filesLoader;
}

get version() {
return version;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/common/CoreApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class CoreApi {
return this._core.server;
}

get files() {
return this._core.files;
}

get mock() {
return this._core.mock;
}
Expand Down
Loading

0 comments on commit 8ae2112

Please sign in to comment.