Skip to content

Commit 4861f74

Browse files
bendtherulesmarionebl
authored andcommitted
refactor: port ensure to ts (#666)
* fix(ensure): remove rimraf dep and clean script * chore(ensure): add typescript and jest config files * chore(ensure): add jest, typescript, ts-jest devdependencies * refactor(ensure): port enum to ts * refactor(ensure): port enum tests to ts * refactor(ensure): make first param to enum non-optional and update test First param to enum (`value`) was earlier optional, which kept the tests easy. But user should be discouraged to use this edge case, so it is now required. In test, the function is typecasted to allow testing the edge case * refactor(ensure): port max-length and its tests to ts * refactor(ensure): port max-line-length and its tests to ts * refactor(ensure): port min-length and its tests to ts * refactor(ensure): port not-empty and its tests to ts * refactor(ensure): port case and its tests to ts * refactor(ensure): port index(.js) and its tests to ts Also updated globby to latest, as it has typescript definition files. * refactor(ensure): add return type to matcher functions * test(ensure): add test for case matching against invalid case name * build(ensure): replace ava config and dependencies with ts 1 Remove ava config and deps from package.json 2 Change ava test script with typescript and jest commands * chore: update yarn lock due to @commitlint/ensure dep changes
1 parent da99aaa commit 4861f74

28 files changed

+639
-854
lines changed

@commitlint/ensure/jest.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node'
4+
};

@commitlint/ensure/package.json

+10-31
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,12 @@
77
"lib/"
88
],
99
"scripts": {
10-
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
10+
"build": "tsc",
1111
"deps": "dep-check",
12-
"pkg": "pkg-check --skip-import",
13-
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
14-
"test": "ava -c 4 --verbose",
15-
"watch": "babel src --out-dir lib --watch --source-maps"
16-
},
17-
"ava": {
18-
"files": [
19-
"src/**/*.test.js",
20-
"!lib/**/*"
21-
],
22-
"source": [
23-
"src/**/*.js",
24-
"!lib/**/*"
25-
],
26-
"babel": "inherit",
27-
"require": [
28-
"babel-register"
29-
]
30-
},
31-
"babel": {
32-
"presets": [
33-
"babel-preset-commitlint"
34-
]
12+
"pkg": "pkg-check",
13+
"start": "concurrently \"yarn test --watchAll\" \"yarn run watch\"",
14+
"test": "jest",
15+
"watch": "tsc -w"
3516
},
3617
"engines": {
3718
"node": ">=4"
@@ -56,15 +37,13 @@
5637
},
5738
"license": "MIT",
5839
"devDependencies": {
59-
"@commitlint/test": "8.0.0",
6040
"@commitlint/utils": "^8.0.0",
61-
"ava": "0.22.0",
62-
"babel-cli": "6.26.0",
63-
"babel-preset-commitlint": "^8.0.0",
64-
"babel-register": "6.26.0",
41+
"@types/jest": "^24.0.13",
6542
"concurrently": "3.5.1",
66-
"cross-env": "5.1.1",
67-
"globby": "8.0.1"
43+
"globby": "^9.2.0",
44+
"jest": "^24.8.0",
45+
"ts-jest": "^24.0.2",
46+
"typescript": "^3.4.5"
6847
},
6948
"dependencies": {
7049
"lodash": "4.17.11"

@commitlint/ensure/src/case.test.js

-321
This file was deleted.

0 commit comments

Comments
 (0)