diff --git a/package.json b/package.json
index a67455ae4..ecd4d837c 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,8 @@
"build:web": "nx build @notesnook/web",
"start:web": "nx start @notesnook/web",
"install:web": "lerna add --scope=@notesnook/web ",
- "test:web": "nx test @notesnook/web ",
+ "test:web": "nx test @notesnook/web",
+ "test:core": "nx test @notesnook/core",
"start:android": "nx run-android @notesnook/mobile",
"start:ios": "nx run-ios @notesnook/mobile",
"prepare:ios": "nx install-pods @notesnook/mobile",
diff --git a/packages/core/.babelrc b/packages/core/.babelrc
deleted file mode 100644
index 913f053ee..000000000
--- a/packages/core/.babelrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "presets": ["@babel/preset-env"],
- "plugins": [["@babel/transform-runtime"]]
-}
diff --git a/packages/core/.env-cmdrc.js b/packages/core/.env-cmdrc.js
new file mode 100644
index 000000000..5f1f6d252
--- /dev/null
+++ b/packages/core/.env-cmdrc.js
@@ -0,0 +1,5 @@
+module.exports = {
+ e2e: {
+ IS_E2E: true
+ }
+};
diff --git a/packages/core/babel.config.js b/packages/core/babel.config.js
new file mode 100644
index 000000000..0007f33ae
--- /dev/null
+++ b/packages/core/babel.config.js
@@ -0,0 +1,22 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2022 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+module.exports = {
+ presets: ["@babel/preset-env"],
+ plugins: [["@babel/transform-runtime"]]
+};
diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js
index 2a4b84c33..24133f33b 100644
--- a/packages/core/jest.config.js
+++ b/packages/core/jest.config.js
@@ -19,6 +19,10 @@ along with this program. If not, see .
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
+const IS_E2E = process.env.IS_E2E === "true";
+
+if (IS_E2E) console.log("Running e2e tests");
+else console.log("Running non-e2e tests");
module.exports = {
// All imported modules in your tests should be mocked automatically
@@ -158,12 +162,10 @@ module.exports = {
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
- testMatch: ["**/**/**/*.test.[jt]s?(x)"]
+ testMatch: ["**/**/**/*.test.[jt]s?(x)"],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
- // testPathIgnorePatterns: [
- // "/node_modules/"
- // ],
+ testPathIgnorePatterns: IS_E2E ? [] : ["/__e2e__/"]
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json
index a8e8cae02..61cfe49dc 100644
--- a/packages/core/package-lock.json
+++ b/packages/core/package-lock.json
@@ -36,6 +36,7 @@
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"dotenv": "^16.0.1",
+ "env-cmd": "^10.1.0",
"eventsource": "^2.0.2",
"jest": "^28.1.3",
"jest-fetch-mock": "^3.0.3",
@@ -4915,6 +4916,31 @@
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
+ "node_modules/env-cmd": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz",
+ "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==",
+ "dev": true,
+ "dependencies": {
+ "commander": "^4.0.0",
+ "cross-spawn": "^7.0.0"
+ },
+ "bin": {
+ "env-cmd": "bin/env-cmd.js"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/env-cmd/node_modules/commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/error-ex": {
"version": "1.3.2",
"dev": true,
@@ -12302,6 +12328,24 @@
"entities": {
"version": "4.3.1"
},
+ "env-cmd": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/env-cmd/-/env-cmd-10.1.0.tgz",
+ "integrity": "sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==",
+ "dev": true,
+ "requires": {
+ "commander": "^4.0.0",
+ "cross-spawn": "^7.0.0"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true
+ }
+ }
+ },
"error-ex": {
"version": "1.3.2",
"dev": true,
@@ -13217,7 +13261,8 @@
},
"jest-pnp-resolver": {
"version": "1.2.2",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"jest-regex-util": {
"version": "28.0.2",
@@ -13760,7 +13805,8 @@
"dependencies": {
"ws": {
"version": "8.8.1",
- "dev": true
+ "dev": true,
+ "requires": {}
}
}
},
@@ -14681,7 +14727,8 @@
}
},
"ws": {
- "version": "7.5.9"
+ "version": "7.5.9",
+ "requires": {}
},
"xml-name-validator": {
"version": "4.0.0",
diff --git a/packages/core/package.json b/packages/core/package.json
index de3cebd6b..2c7091d2e 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -22,12 +22,14 @@
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"dotenv": "^16.0.1",
+ "env-cmd": "^10.1.0",
"eventsource": "^2.0.2",
"jest": "^28.1.3",
"jest-fetch-mock": "^3.0.3",
"jsdom": "^20.0.0"
},
"scripts": {
+ "test:e2e": "env-cmd -e e2e jest --forceExit",
"test": "jest --forceExit"
},
"dependencies": {