Skip to content

Commit

Permalink
Cut over to ts-jest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bonkles committed Jun 11, 2021
1 parent 46a1c57 commit 5506862
Show file tree
Hide file tree
Showing 5 changed files with 2,000 additions and 8 deletions.
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
},
"devDependencies": {
"@mapbox/geojson-rewind": "^0.5.0",
"@types/jest": "^26.0.23",
"esbuild": "^0.12.6",
"jest": "^27.0.4",
"jest-extended": "^0.11.5",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.1",
"shx": "^0.3.3",
"ts-jest": "^27.0.3",
"typescript": "^4.3.2"
},
"scripts": {
Expand All @@ -44,19 +46,28 @@
"build:esm": "esbuild ./src/country-coder.ts --platform=neutral --format=esm --bundle --external:which-polygon --outfile=./dist/country-coder.esm.js",
"build:types": "tsc",
"format-json": "node ./scripts/format-json.js",
"test": "node --experimental-vm-modules node_modules/.bin/jest --no-cache tests/*.js",
"pretty": "prettier --write \"./{src,tests}/*.{ts,js}\""
"test": "jest --env=node --colors --coverage ts-tests",
"pretty": "prettier --write \"./{src,ts-tests}/*.{ts,js}\""
},
"publishConfig": {
"access": "public"
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
"**/dist/country-coder.esm.js"
"**/src/country-coder.ts"
],
"coverageDirectory": "<rootDir>/.coverage",
"transform": {},
"globals": {
"ts-jest": {
"useESM" : true
}
},
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|ts?)$",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"verbose": true
},
"prettier": {
Expand Down
6 changes: 3 additions & 3 deletions src/country-coder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ type CodingOptions = {
// For overlapping features, the division level of the one to get. If no feature
// exists at the given level, the feature at the next higher level is returned.
// See the `level` property of `RegionFeatureProperties` for possible values.
level: string | undefined;
level?: string | undefined;
// Only a feature at the specified level or lower will be returned.
maxLevel: string | undefined;
maxLevel?: string | undefined;
// Only a feature with the specified property will be returned.
withProp: string | undefined;
withProp?: string | undefined;
};

// The base GeoJSON feature collection
Expand Down
Loading

0 comments on commit 5506862

Please sign in to comment.