From ecd4e41efa8472859727d2c42bad7fbfe6abdb01 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Wed, 12 Jun 2024 15:12:40 -0400 Subject: [PATCH] Renamed `start.ts` to `test.ts` to match `lint.ts` and `merge.ts`. (#339) * Renamed start to test for consistency. Signed-off-by: dblock --- DEVELOPER_GUIDE.md | 11 ++++++++--- package.json | 2 +- tools/src/tester/{start.ts => test.ts} | 0 tools/tests/tester/{start.test.ts => test.test.ts} | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) rename tools/src/tester/{start.ts => test.ts} (100%) rename tools/tests/tester/{start.test.ts => test.test.ts} (97%) diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 76f19a1a4..676bf383c 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -219,15 +219,20 @@ Tests are organized in folders that match [namespaces](spec/namespaces). For exa ### Running Spec Tests Locally -Set up an OpenSearch cluster with Docker using the default OPENSEARCH_PASSWORD (Recommended): +Set up an OpenSearch cluster with Docker using the default `OPENSEARCH_PASSWORD` (Recommended): ```bash cd .github/opensearch-cluster docker-compose up -d ``` -Run the tests: +Run the tests (use `--opensearch-insecure` for a local cluster running in Docker that does not have a valid SSL certificate): ```bash -npm run test:spec +npm run test:spec -- --opensearch-insecure +``` + +Run a specific test story: +```bash +npm run test:spec -- --opensearch-insecure --tests tests/_core/info.yaml ``` If you opt to use a different password, you can set the `OPENSEARCH_PASSWORD` environment variable to the desired password before running `docker-compose up` and every time you run the tests: diff --git a/package.json b/package.json index 0ca2ad64e..a495dc641 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "jest": "jest", "test:unit": "jest --testMatch='**/*.test.ts' --testPathIgnorePatterns=/integ/", "test:integ": "jest --testMatch='**/integ/*.test.ts' --runInBand", - "test:spec": "ts-node tools/src/tester/start.ts" + "test:spec": "ts-node tools/src/tester/test.ts" }, "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", diff --git a/tools/src/tester/start.ts b/tools/src/tester/test.ts similarity index 100% rename from tools/src/tester/start.ts rename to tools/src/tester/test.ts diff --git a/tools/tests/tester/start.test.ts b/tools/tests/tester/test.test.ts similarity index 97% rename from tools/tests/tester/start.test.ts rename to tools/tests/tester/test.test.ts index 70e52acae..6f2c25a8e 100644 --- a/tools/tests/tester/start.test.ts +++ b/tools/tests/tester/test.test.ts @@ -16,7 +16,7 @@ import { ChapterOutput } from 'tester/ChapterOutput' import StoryEvaluator from 'tester/StoryEvaluator' const spec = (args: string[]): any => { - const start = spawnSync('ts-node', ['tools/src/tester/start.ts'].concat(args), { + const start = spawnSync('ts-node', ['tools/src/tester/test.ts'].concat(args), { env: { ...process.env, OPENSEARCH_PASSWORD: 'password' } }) return { @@ -26,7 +26,7 @@ const spec = (args: string[]): any => { } test('--help', () => { - expect(spec(['--help']).stdout).toContain('Usage: start [options]') + expect(spec(['--help']).stdout).toContain('Usage: test [options]') }) test('--invalid', () => {