aboutsummaryrefslogtreecommitdiffstats
path: root/tests/jestBabelTransformer.js
diff options
context:
space:
mode:
authorFrançois Freitag <mail@franek.fr>2021-05-29 23:53:04 +0200
committerFrançois Freitag <mail@franek.fr>2021-05-30 10:44:34 +0200
commitb0847abcc2c55614050951264c906920abd7634f (patch)
tree2d5d91417b99fad42ca40a08c068d39468dceb7c /tests/jestBabelTransformer.js
parent8b3fbe1f0631e9be0844e84210be51cc8a847efd (diff)
downloadnextcloud-server-b0847abcc2c55614050951264c906920abd7634f.tar.gz
nextcloud-server-b0847abcc2c55614050951264c906920abd7634f.zip
Rewrite requesttoken.spec.js with Jest
[Jest](https://jestjs.io/) is a test runner that focuses on simplicity. It instruments babel to transform modules and test them. Using Jest simplifies the existing configuration and allows dropping a bunch of workarounds, as well as following the shared Babel configuration for new code. Signed-off-by: François Freitag <mail@franek.fr>
Diffstat (limited to 'tests/jestBabelTransformer.js')
-rw-r--r--tests/jestBabelTransformer.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/jestBabelTransformer.js b/tests/jestBabelTransformer.js
new file mode 100644
index 00000000000..6790920a76c
--- /dev/null
+++ b/tests/jestBabelTransformer.js
@@ -0,0 +1,26 @@
+/**
+ * @copyright 2021 François Freitag <mail@franek.fr>
+ *
+ * @author François Freitag <mail@franek.fr>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+const babelJest = require('babel-jest')
+const babelConfig = require('@nextcloud/babel-config')
+
+module.exports = babelJest.createTransformer(babelConfig)