Last active
January 31, 2020 06:27
-
-
Save alexanderbird/8456ca4e01366fb30d9b0660899369ec to your computer and use it in GitHub Desktop.
Git patch to add Jest with babel to a project set up with the preact cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit bf688814118231ecc64365e93e276f7fefa0652f | |
Author: Alexander Bird <[email protected]> | |
Date: Thu Jan 30 19:39:22 2020 -0800 | |
Add Jest and 'npm test' | |
diff --git a/babel.config.js b/babel.config.js | |
new file mode 100644 | |
index 0000000..8249e41 | |
--- /dev/null | |
+++ b/babel.config.js | |
@@ -0,0 +1,13 @@ | |
+module.exports = { | |
+ env: { | |
+ test: { | |
+ presets: [ | |
+ "preact", | |
+ [ | |
+ '@babel/preset-env', | |
+ { | |
+ targets: { | |
+ node: 'current', | |
+ }, | |
+ }, | |
+ ], | |
+ ], | |
+ } | |
+ } | |
+}; | |
diff --git a/package.json b/package.json | |
index 1b89f3b..d439a2b 100644 | |
--- a/package.json | |
+++ b/package.json | |
@@ -8,7 +8,8 @@ | |
"build": "preact build", | |
"serve": "preact build && preact serve", | |
"dev": "preact watch", | |
- "lint": "eslint src" | |
+ "lint": "eslint src", | |
+ "test": "jest" | |
}, | |
"eslintConfig": { | |
"extends": "eslint-config-synacor" | |
@@ -17,9 +18,14 @@ | |
"build/*" | |
], | |
"devDependencies": { | |
+ "@babel/core": "^7.8.4", | |
+ "@babel/preset-env": "^7.8.4", | |
+ "babel-jest": "^25.1.0", | |
+ "babel-preset-preact": "^2.0.0", | |
"eslint": "^6.0.1", | |
"eslint-config-synacor": "^3.0.4", | |
"if-env": "^1.0.0", | |
+ "jest": "^25.1.0", | |
"preact-cli": "^3.0.0-rc.6" | |
}, | |
"dependencies": { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment