Skip to content

Commit

Permalink
refactor: port ensure to ts (#666)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bendtherules authored and marionebl committed Jun 1, 2019
1 parent da99aaa commit 4861f74
Show file tree
Hide file tree
Showing 28 changed files with 639 additions and 854 deletions.
4 changes: 4 additions & 0 deletions @commitlint/ensure/jest.config.js
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
};
41 changes: 10 additions & 31 deletions @commitlint/ensure/package.json
Expand Up @@ -7,31 +7,12 @@
"lib/"
],
"scripts": {
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
"build": "tsc",
"deps": "dep-check",
"pkg": "pkg-check --skip-import",
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
"test": "ava -c 4 --verbose",
"watch": "babel src --out-dir lib --watch --source-maps"
},
"ava": {
"files": [
"src/**/*.test.js",
"!lib/**/*"
],
"source": [
"src/**/*.js",
"!lib/**/*"
],
"babel": "inherit",
"require": [
"babel-register"
]
},
"babel": {
"presets": [
"babel-preset-commitlint"
]
"pkg": "pkg-check",
"start": "concurrently \"yarn test --watchAll\" \"yarn run watch\"",
"test": "jest",
"watch": "tsc -w"
},
"engines": {
"node": ">=4"
Expand All @@ -56,15 +37,13 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/test": "8.0.0",
"@commitlint/utils": "^8.0.0",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^8.0.0",
"babel-register": "6.26.0",
"@types/jest": "^24.0.13",
"concurrently": "3.5.1",
"cross-env": "5.1.1",
"globby": "8.0.1"
"globby": "^9.2.0",
"jest": "^24.8.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
},
"dependencies": {
"lodash": "4.17.11"
Expand Down
321 changes: 0 additions & 321 deletions @commitlint/ensure/src/case.test.js

This file was deleted.

0 comments on commit 4861f74

Please sign in to comment.