angular-mock-record
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "angular-mock-record", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An angular / protractor framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
# angular-mock-record | ||
An angular 4+ framework that mocks and records requests. Requests can be manually mocked or recorded like VCR. | ||
An Angular 4+ framework that mocks and records requests. Requests can be manually mocked or recorded like VCR. | ||
@@ -35,3 +35,3 @@ # Installation | ||
- Then mock requests in beforeEach or beforeAll: | ||
- Then, mock requests in beforeEach or beforeAll: | ||
@@ -45,3 +45,3 @@ | ||
- Next run tests in the describe block: | ||
- Next, run tests in the describe block: | ||
@@ -63,1 +63,13 @@ | ||
` | ||
# Setting up mock.record.config.json for recording | ||
- Set `domain` as the request path that will be used to make requests and record. | ||
- Set an array of params that need to be excluded from request url matching via `exclude_params`. Ex: `exclude_params: ['sort']` | ||
- Set an array of params that need to be normalized in request url via `normalize_params`. Ex: `normalize_params: ['randomly_generated_id']` | ||
- Set `allow_recording` to true to fail when a new recording is detected. This is handy for continuous integration tools such as Travis CI. | ||
# Running the server | ||
- Run `node ./node_modules/angular-mock-record/server/server.js allow_recording` | ||
- Hit `http://localhost:<port>/<api_path>` in a browser to test the recording functionality. Once recorded, requests matching this URL will return the captured recording. | ||
- Finally, set up your application's E2E endpoint configuration to point to `http://localhost:<port>/<api_path>`. Start the server, then run `ng e2e`. All requests will be recorded unless they are otherwise mocked. |
@@ -54,3 +54,3 @@ const Http = require('./http.js'); | ||
if (!this.recordingAllowed()) { | ||
console.error('\nAn unrecorded request was detected\n'); | ||
console.error('\nAn unrecorded request was detected:\n' + req.url); | ||
console.error('\nTo record new requests, use the `allow_recording` parameter\n'); | ||
@@ -57,0 +57,0 @@ process.exit(1); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14358
73