Local server offering a variety of APIs that can be used to test code generated by AutoRest (https://github.com/Azure/autorest)
Перейти к файлу
Timothee Guerin 08cba1c8ce
Fix: Legacy tests resetting existing coverage (#351)
2022-02-24 14:34:47 -08:00
.azure-pipelines Cleanup: Add formatting check and format all files (#318) 2021-10-01 11:34:28 -07:00
.scripts Cleanup: Add formatting check and format all files (#318) 2021-10-01 11:34:28 -07:00
.vscode Some VSCode stuff 2021-10-05 16:54:56 -07:00
definitions Cleanup: Add formatting check and format all files (#318) 2021-10-01 11:34:28 -07:00
docs Scope request validation (#274) 2021-02-10 15:09:21 -08:00
legacy Fix: Legacy tests resetting existing coverage (#351) 2022-02-24 14:34:47 -08:00
routes put a copy of the png file at /routes/sample.png to not break python's scripts (#106) 2019-12-19 11:28:10 -08:00
src Fix: Legacy tests resetting existing coverage (#351) 2022-02-24 14:34:47 -08:00
swagger Fix: `"null"` instead of `null` in paging.json spec (#348) 2022-02-24 08:20:02 -08:00
test Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00
.editorconfig Document recommended extensions (#256) 2021-01-20 13:48:34 -08:00
.eslintrc.yml Add eqeqeq eslint rule (#276) 2021-02-16 16:52:09 -08:00
.gitattributes Fix: Legacy tests resetting existing coverage (#351) 2022-02-24 14:34:47 -08:00
.gitignore Fix regression in types library (#291) 2021-06-09 11:38:07 -07:00
.npmignore Add WireMock variant to test server (#105) 2019-12-18 12:36:34 -08:00
.prettierignore Fix: Prettier formatting check not working (#323) 2021-10-21 08:46:10 -07:00
.prettierrc.yml Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00
CHANGELOG.md Feature: Add ability for the testserver to append coverage to previous runs (#349) 2022-02-24 09:50:52 -08:00
LICENSE Initial commit 2017-08-14 16:01:43 -07:00
README.md Feature: Add ability for the testserver to append coverage to previous runs (#349) 2022-02-24 09:50:52 -08:00
jest.config.js Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00
package-lock.json Bump follow-redirects from 1.14.7 to 1.14.9 (#346) 2022-02-23 19:08:57 -08:00
package.json Fix: Legacy tests resetting existing coverage (#351) 2022-02-24 14:34:47 -08:00
swagger.json Cleanup: Add formatting check and format all files (#318) 2021-10-01 11:34:28 -07:00
tsconfig.build.json Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00
tsconfig.json Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00

README.md

Test server V2

Requirements

  • Node.js

Recommended:

  • VSCode, with the following plugins
    • Prettier
    • ESLint
    • EditorConfig

Usage

# Start testserver
autorest-testserver run

# Start testserver at given port
autorest-testserver run --port=<port>

# Start testserver without reseting the coverage. This can be used when you are running the test server multiple times to get the full coverage.
autorest-testserver run --appendCoverage

# Stop testserver
autorest-testserver stop

# Stop testserver running at the given port
autorest-testserver stop --port=<port>

# Sepecify the coverage directory
autorest-testserver run --coverageDirectory=<path>

Coverage upload

Upload the coverage produce by the autorest testserver.

autorest-testserver-coverage publish \
  --coverageDirectory=<path> \
  --repo=<repo> \
  --ref=<path> \
  --githubToken=<ghToken> \
  --azStorageAccount=<account> \
  --azStorageAccessKey=<azStorageKey>

Clear coverage folder

Clear the coverage folder. --coverageDirectory is optional. It defaults to ./coverage

autorest-testserver-coverage clear [--coverageDirectory=<path>]

Developping

# Install dependencies
npm install

# Start for dev: Will start the server and automatically restart in case there is changes in the files.
npm run start:dev

# Start for running: Will build and start the server
npm run start

# Format all the files(Required for CI). Use prettier vscode extension(or other editor prettier integration) for on save formatting.
npm run format

Writing mock apis

See docs