Local server offering a variety of APIs that can be used to test code generated by AutoRest (https://github.com/Azure/autorest)
Перейти к файлу
Pan Shao 45ac0da514
Fix issues for codegen test (#376)
* Fix issues for codegen test

* Change name

* Fix format

* revert change
2022-03-24 13:42:14 +08:00
.azure-pipelines Fix missing specs router (#358) 2022-02-28 13:30:39 -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 Migrate bool to test server v2 (#362) 2022-02-28 16:49:37 -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 issues for codegen test (#376) 2022-03-24 13:42:14 +08:00
swagger Add SecurityDefinition (#368) 2022-03-23 15:24:30 +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 Migrate additional properties to test server v2 route (#355) 2022-02-25 15:51:52 -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 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
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 Fix errors to pass test (#374) 2022-03-22 23:34:11 -07:00
package.json Fix issues for codegen test (#376) 2022-03-24 13:42:14 +08: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