aboutsummaryrefslogtreecommitdiff
path: root/package.json
diff options
context:
space:
mode:
authorJack Franklin <[email protected]>2020-07-15 15:31:43 +0100
committerGitHub <[email protected]>2020-07-15 10:31:43 -0400
commit5116df46a020ae498eec6783cfe9147fc9add015 (patch)
tree93be70d93df33d1d60c7c3e4cfed0ae408e272cb /package.json
parent244cac2aa3d6831774129d6dc4942465dcef8099 (diff)
Add generic types and update tests (#107)
* Add generic types and update tests * Add generic types to `on`, `off` and `emit` to enable some nicer TS usage if you specify what type you're expecting from the `EventData`. * Move the tests to be TypeScript source. This will help catch errors in the tests if there are any type errors. * Create a new test to test the generic types and make sure they pass and error when expected. * Upgrade to Mocha 8. * Did some tidying up of the package.json scripts. * Tweak TS setup to validate tests * Fix d.ts generation and tests Co-authored-by: Jason Miller <[email protected]>
Diffstat (limited to 'package.json')
-rw-r--r--package.json35
1 files changed, 25 insertions, 10 deletions
diff --git a/package.json b/package.json
index 90b7b74..a2c2b58 100644
--- a/package.json
+++ b/package.json
@@ -8,12 +8,13 @@
"esmodules": "dist/mitt.modern.js",
"main": "dist/mitt.js",
"umd:main": "dist/mitt.umd.js",
- "typings": "dist/index.d.ts",
+ "typings": "index.d.ts",
"scripts": {
- "test": "npm-run-all --silent typecheck lint testonly",
- "testonly": "mocha --require esm test/**/*.js",
+ "test": "npm-run-all --silent typecheck lint mocha test-types",
+ "mocha": "mocha test",
+ "test-types": "tsc test/test-types-compilation.ts --noEmit",
"lint": "eslint src test --ext ts --ext js",
- "typecheck": "tsc **/*.ts --noEmit",
+ "typecheck": "tsc --noEmit",
"bundle": "microbundle",
"build": "npm-run-all --silent clean -p bundle -s docs",
"clean": "rimraf dist",
@@ -34,8 +35,21 @@
"license": "MIT",
"files": [
"src",
- "dist"
+ "dist",
+ "index.d.ts"
],
+ "mocha": {
+ "extension": [
+ "ts"
+ ],
+ "require": [
+ "ts-node/register",
+ "esm"
+ ],
+ "spec": [
+ "test/*_test.ts"
+ ]
+ },
"eslintConfig": {
"extends": [
"developit",
@@ -68,7 +82,8 @@
}
},
"eslintIgnore": [
- "dist"
+ "dist",
+ "index.d.ts"
],
"devDependencies": {
"@types/chai": "^4.2.11",
@@ -82,13 +97,13 @@
"eslint": "^7.1.0",
"eslint-config-developit": "^1.2.0",
"esm": "^3.2.25",
- "microbundle": "^0.12.0",
- "mocha": "^7.2.0",
+ "microbundle": "^0.12.3",
+ "mocha": "^8.0.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
- "ts-node": "^8.10.1",
+ "ts-node": "^8.10.2",
"typescript": "^3.9.3"
}
-}
+} \ No newline at end of file