Skip to content

Commit

Permalink
chore: prevent tests from being run in subpackages (#910)
Browse files Browse the repository at this point in the history
## 🧰 Changes

This repo is a bit weird in that we need to build the dists before
running our test suite, so running tests from the subpackages might
result in confusing errors. This PR makes it so we have a bit of a nicer
error in case of that.
  • Loading branch information
kanadgupta authored Oct 17, 2024
1 parent 991b659 commit fbea635
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
24 changes: 8 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions packages/oas-normalize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"lint:types": "tsc --noEmit",
"prebuild": "rm -rf dist/",
"prepack": "npm run build",
"test": "vitest run --coverage"
"test": "echo 'Please run tests from the root!' && exit 1"
},
"license": "MIT",
"dependencies": {
Expand All @@ -73,12 +73,11 @@
"@readme/oas-examples": "^5.12.0",
"@types/js-yaml": "^4.0.9",
"@types/swagger2openapi": "^7.0.4",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"nock": "^14.0.0-beta.12",
"tsup": "^8.0.2",
"typescript": "^5.1.6",
"vitest": "^1.4.0"
"vitest": "^1.6.0"
},
"prettier": "@readme/eslint-config/prettier"
}
5 changes: 2 additions & 3 deletions packages/oas-to-har/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lint:types": "tsc --noEmit",
"prebuild": "rm -rf dist/",
"prepack": "npm run build",
"test": "vitest run --coverage"
"test": "echo 'Please run tests from the root!' && exit 1"
},
"dependencies": {
"@readme/data-urls": "^3.0.0",
Expand All @@ -58,13 +58,12 @@
"@readme/oas-examples": "^5.12.0",
"@types/har-format": "^1.2.15",
"@types/qs": "^6.9.14",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"jest-expect-har": "^7.1.0",
"tsup": "^8.0.2",
"type-fest": "^4.18.3",
"typescript": "^5.2.2",
"vitest": "^1.4.0"
"vitest": "^1.6.0"
},
"prettier": "@readme/eslint-config/prettier"
}
3 changes: 2 additions & 1 deletion packages/oas-to-har/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Operation } from 'oas/operation';
import type { OASDocument } from 'oas/types';

import petstore from '@readme/oas-examples/3.0/json/petstore.json';
import toBeAValidHAR from 'jest-expect-har';
Expand Down Expand Up @@ -133,7 +134,7 @@ describe('oas-to-har', () => {
let operation;

beforeEach(function () {
variablesOas = new Oas(serverVariables);
variablesOas = new Oas(serverVariables as OASDocument);
operation = variablesOas.operation('/', 'post');
});

Expand Down
5 changes: 2 additions & 3 deletions packages/oas-to-snippet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"lint:types": "tsc --noEmit",
"prebuild": "rm -rf dist/",
"prepack": "npm run build",
"test": "vitest run --coverage"
"test": "echo 'Please run tests from the root!' && exit 1"
},
"dependencies": {
"@readme/httpsnippet": "^10.1.0",
Expand All @@ -57,14 +57,13 @@
"@readme/oas-examples": "^5.12.0",
"@types/har-format": "^1.2.14",
"@types/node": "^20.8.7",
"@vitest/coverage-v8": "^1.4.0",
"har-examples": "^3.1.1",
"httpsnippet-client-api": "^7.0.0-beta.4",
"oas": "file:../oas",
"tsup": "^8.0.2",
"type-fest": "^4.18.3",
"typescript": "^5.2.2",
"vitest": "^1.4.0"
"vitest": "^1.6.0"
},
"prettier": "@readme/eslint-config/prettier"
}
5 changes: 2 additions & 3 deletions packages/oas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"lint:types": "tsc --noEmit",
"prebuild": "rm -rf dist/",
"prepack": "npm run build",
"test": "vitest run --coverage",
"test": "echo 'Please run tests from the root!' && exit 1",
"watch": "tsc --watch"
},
"dependencies": {
Expand All @@ -105,10 +105,9 @@
"@types/json-schema-merge-allof": "^0.6.5",
"@types/memoizee": "^0.4.11",
"@types/node": "^20.12.13",
"@vitest/coverage-v8": "^1.4.0",
"tsup": "^8.0.2",
"typescript": "^5.4.4",
"vitest": "^1.4.0"
"vitest": "^1.6.0"
},
"prettier": "@readme/eslint-config/prettier"
}

0 comments on commit fbea635

Please sign in to comment.