Skip to content

Commit d7caaaa

Browse files
committed
schemapath
1 parent 3e37117 commit d7caaaa

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

test/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ When debugging tests, it is helpful to use the script `dev-start-along-mock` to
3333
that are both based on a given OpenAPI file, e.g.
3434

3535
````bash
36-
npm run dev-start-along-mock -- test/schemas/v3/3-parameters.yaml
36+
# openapi-cop will listen on port 8888 and the mock server on port 8889
37+
npm run dev-start-along-mock -- test/schemas/v3/6-examples.yaml
3738
````
3839

3940
The mock server uses the "examples" from the OpenAPI document to produce responses.

test/scripts/spawn.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* node ./spawn [openapi-path]
66
*
77
* openapi-path (optional): path to the OpenAPI file on which both the proxy server
8-
* and the mock server will be based on. Defaults to a hard-coded file.
8+
* and the mock server will be based on. If the file path is relative, it is relative to the project base.
9+
* Defaults to a hard-coded file (see below).
910
*
1011
* This script is called/aliased by `npm run dev-start-along-mock`.
1112
*/
@@ -15,10 +16,7 @@ import * as path from 'path';
1516
import {PROXY_PORT, TARGET_SERVER_PORT} from '../config';
1617
import {spawnProxyWithMockServer} from '../util/server';
1718

18-
const apiDocFile =
19-
process.argv[2] ||
20-
path.resolve(__dirname, '../../../test/schemas/v3/3-parameters.yaml');
19+
const apiDocRelativePath = process.argv[2] ? process.argv[2] : 'test/schemas/v3/3-parameters.yaml';
20+
const apiDocPath = path.resolve(__dirname, '../../..', apiDocRelativePath);
2121

22-
spawnProxyWithMockServer(PROXY_PORT, TARGET_SERVER_PORT, apiDocFile, {
23-
stdio: 'inherit',
24-
});
22+
spawnProxyWithMockServer(PROXY_PORT, TARGET_SERVER_PORT, apiDocPath, {stdio: 'inherit'});

0 commit comments

Comments
 (0)