Skip to content

Commit

Permalink
Separate unit and integration tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jun 6, 2024
1 parent a1ca7c9 commit 2bc84dd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/test-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,5 @@ jobs:
- name: Lint
run: npm run lint

- name: Test Spec Merger
run: npm run test -- tools/tests/merger

- name: Test Spec Linter
run: npm run test -- tools/tests/linter

- name: Test Spec Tester
run: npm run test -- tools/tests/tester --runInBand
- name: Tests
run: npm run test
2 changes: 2 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ Specify the test path to run tests for one of the tools:
npm run test -- tools/tests/tester/
```

The test suite contains unit tests and integration tests. Integration tests, such as [these](tools/tests/tester/integ/), require a local instance of OpenSearch and are placed into a folder named `integ`. Unit tests are run in parallel and integration tests are run sequentially using `--runInBand`. You can run unit tests with `npm run test:unit` separately from integration tests with `npm run test:integ`.

#### Lints

All code is linted using [ESLint](https://eslint.org/) in combination with [typescript-eslint](https://typescript-eslint.io/). Linting can be run via:
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"lint": "eslint .",
"lint--fix": "eslint . --fix",
"merge": "ts-node tools/src/merger/merge.ts",
"test": "jest",
"test": "npm run test:unit && npm run test:integ",
"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"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

import { construct_tester_components, load_actual_evaluation, load_expected_evaluation } from './helpers'
import { construct_tester_components, load_actual_evaluation, load_expected_evaluation } from '../helpers'

const { story_evaluator } = construct_tester_components('tools/tests/tester/fixtures/specs/indices_excerpt.yaml')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* compatible open source license.
*/

import { construct_tester_components, flatten_errors, load_expected_evaluation } from './helpers'
import { type StoryEvaluation } from '../../src/tester/types/eval.types'
import { construct_tester_components, flatten_errors, load_expected_evaluation } from '../helpers'
import { type StoryEvaluation } from '../../../src/tester/types/eval.types'

test('stories folder', async () => {
const { test_runner } = construct_tester_components('tools/tests/tester/fixtures/specs/indices_excerpt.yaml')
Expand Down

0 comments on commit 2bc84dd

Please sign in to comment.