aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json3
-rw-r--r--jest.config.js7
-rw-r--r--jest.setup.js3
-rw-r--r--jest.transform.js1
4 files changed, 14 insertions, 0 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index b6af3aa..ae4e230 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -2,6 +2,7 @@
"env": {
"browser": true,
"es6": true,
+ "jest/globals": true,
"jquery": true,
"node": true
},
@@ -11,6 +12,7 @@
"jquery",
"plugin:import/errors",
"plugin:import/warnings",
+ "plugin:jest/recommended",
"plugin:node/recommended",
"plugin:promise/recommended",
"plugin:security/recommended",
@@ -21,6 +23,7 @@
"plugins": [
"compat",
"import",
+ "jest",
"no-loops",
"no-loops",
"no-use-extend-native",
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 0000000..02ff019
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,7 @@
+module.exports = {
+ browser: true,
+ clearMocks: true,
+ setupFiles: [ "./jest.setup.js" ],
+ testEnvironment: "jsdom",
+ transform: { "^.+\\.js$": "<rootDir>/jest.transform.js" }
+};
diff --git a/jest.setup.js b/jest.setup.js
new file mode 100644
index 0000000..353860a
--- /dev/null
+++ b/jest.setup.js
@@ -0,0 +1,3 @@
+import $ from "jquery";
+
+global.$ = global.jQuery = $;
diff --git a/jest.transform.js b/jest.transform.js
new file mode 100644
index 0000000..50bbbb5
--- /dev/null
+++ b/jest.transform.js
@@ -0,0 +1 @@
+module.exports = require("babel-jest").createTransformer({ presets: [ "es2015" ] });