Local server offering a variety of APIs that can be used to test code generated by AutoRest (https://github.com/Azure/autorest)
Перейти к файлу
Mingzhe Huang 4fb0eb0511
build: bump version to 3.3.50 (#426)
2024-08-26 18:07:40 -04:00
.azure-pipelines Add publish pipeline config (#425) 2024-03-08 14:25:55 -08:00
.scripts Fix line endings 2022-02-24 14:36:06 -08:00
.vscode Migrate additional properties to test server v2 route (#355) 2022-02-25 15:51:52 -08:00
definitions Fix line endings 2022-02-24 14:36:06 -08:00
docs Add route for errors with secrets and PII (#354) 2022-03-01 21:15:11 +00:00
legacy Fix LRO Patch201RetryWithAsyncHeader (#413) 2023-05-19 15:23:05 -07: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 Upgrade dependencies (#422) 2024-04-16 12:20:09 -07:00
swagger Fix copy-paste error in the `x-ms-examples` values for body-string.json (#418) 2023-06-29 11:07:10 -07:00
test Test server v2 using a simplified api optimized for a mock api (#251) 2021-01-15 09:41:17 -08:00
.editorconfig Migrate additional properties to test server v2 route (#355) 2022-02-25 15:51:52 -08:00
.eslintrc.yml Upgrade dependencies (#422) 2024-04-16 12:20:09 -07: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 busboy breaking changes (#385) 2022-06-03 09:41:58 -07:00
.prettierrc.yml Fix line endings 2022-02-24 14:36:06 -08:00
CHANGELOG.md Fix line endings 2022-02-24 14:36:06 -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
SECURITY.md Microsoft mandatory file (#379) 2022-06-02 20:29:56 -07: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 Upgrade dependencies (#422) 2024-04-16 12:20:09 -07:00
package.json build: bump version to 3.3.50 (#426) 2024-08-26 18:07:40 -04:00
swagger.json Fix line endings 2022-02-24 14:36:06 -08: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