mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Upgraded jasmine and made it easier to filter tests
This commit is contained in:
parent
85984109b5
commit
cc51ba4f90
39
CliClient/package-lock.json
generated
39
CliClient/package-lock.json
generated
@ -758,12 +758,6 @@
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||
},
|
||||
"exit": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
|
||||
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
|
||||
"dev": true
|
||||
},
|
||||
"expand-template": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
|
||||
@ -1537,20 +1531,35 @@
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||
},
|
||||
"jasmine": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz",
|
||||
"integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=",
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz",
|
||||
"integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"exit": "^0.1.2",
|
||||
"glob": "^7.0.6",
|
||||
"jasmine-core": "~2.8.0"
|
||||
"glob": "^7.1.4",
|
||||
"jasmine-core": "~3.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.1.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
|
||||
"integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jasmine-core": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz",
|
||||
"integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=",
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz",
|
||||
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
|
||||
"dev": true
|
||||
},
|
||||
"joplin-turndown": {
|
||||
|
@ -83,7 +83,7 @@
|
||||
"yargs-parser": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jasmine": "^2.6.0"
|
||||
"jasmine": "^3.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jasmine"
|
||||
|
@ -2,18 +2,13 @@
|
||||
START_DIR="$(pwd)"
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BUILD_DIR="$ROOT_DIR/tests-build"
|
||||
TEST_FILE="$1"
|
||||
FILTER="$1"
|
||||
|
||||
rsync -a --exclude "node_modules/" "$ROOT_DIR/tests/" "$BUILD_DIR/"
|
||||
rsync -a "$ROOT_DIR/../ReactNativeClient/lib/" "$BUILD_DIR/lib/"
|
||||
rsync -a "$ROOT_DIR/../ReactNativeClient/locales/" "$BUILD_DIR/locales/"
|
||||
mkdir -p "$BUILD_DIR/data"
|
||||
|
||||
if [[ $TEST_FILE != "" ]]; then
|
||||
(cd "$ROOT_DIR" && NODE_ENV=testing npm test tests-build/$TEST_FILE.js)
|
||||
exit
|
||||
fi
|
||||
|
||||
function finish {
|
||||
cd "$START_DIR"
|
||||
}
|
||||
@ -21,28 +16,9 @@ function finish {
|
||||
trap finish EXIT
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
NODE_ENV=testing npm test tests-build/ArrayUtils.js && \
|
||||
NODE_ENV=testing npm test tests-build/encryption.js && \
|
||||
NODE_ENV=testing npm test tests-build/EnexToMd.js && \
|
||||
NODE_ENV=testing npm test tests-build/EnexToHtml.js && \
|
||||
NODE_ENV=testing npm test tests-build/HtmlToMd.js && \
|
||||
NODE_ENV=testing npm test tests-build/markdownUtils.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_BaseItem.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Folder.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_ItemChange.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Note.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Resource.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Revision.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Setting.js && \
|
||||
NODE_ENV=testing npm test tests-build/models_Tag.js && \
|
||||
NODE_ENV=testing npm test tests-build/pathUtils.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_InteropService.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_KvStore.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_ResourceService.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_rest_Api.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_SearchEngine.js && \
|
||||
NODE_ENV=testing npm test tests-build/services_Revision.js && \
|
||||
NODE_ENV=testing npm test tests-build/StringUtils.js && \
|
||||
NODE_ENV=testing npm test tests-build/TaskQueue.js && \
|
||||
NODE_ENV=testing npm test tests-build/synchronizer.js && \
|
||||
NODE_ENV=testing npm test tests-build/urlUtils.js
|
||||
|
||||
if [[ $FILTER != "" ]]; then
|
||||
npx jasmine --config=tests/support/jasmine.json --filter="$FILTER"
|
||||
else
|
||||
npx jasmine --config=tests/support/jasmine.json
|
||||
fi
|
||||
|
@ -1,11 +1,9 @@
|
||||
{
|
||||
"spec_dir": "spec",
|
||||
"spec_dir": "tests-build",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/**/*.js"
|
||||
"*.js",
|
||||
"!test-utils.js"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": true,
|
||||
"random": false
|
||||
"random": true
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ const BaseService = require('lib/services/BaseService.js');
|
||||
const { FsDriverNode } = require('lib/fs-driver-node.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const { shimInit } = require('lib/shim-init-node.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const { uuid } = require('lib/uuid.js');
|
||||
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
|
||||
const SyncTargetMemory = require('lib/SyncTargetMemory.js');
|
||||
@ -49,8 +50,15 @@ let kvStores_ = [];
|
||||
let fileApi_ = null;
|
||||
let currentClient_ = 1;
|
||||
|
||||
// The line `process.on('unhandledRejection'...` in all the test files is going to
|
||||
// make it throw this error. It's not too big a problem so disable it for now.
|
||||
// https://stackoverflow.com/questions/9768444/possible-eventemitter-memory-leak-detected
|
||||
process.setMaxListeners(0);
|
||||
|
||||
shimInit();
|
||||
|
||||
shim.setIsTestingEnv(true);
|
||||
|
||||
const fsDriver = new FsDriverNode();
|
||||
Logger.fsDriver_ = fsDriver;
|
||||
Resource.fsDriver_ = fsDriver;
|
||||
|
@ -43,8 +43,6 @@ class HtmlUtils {
|
||||
return html.replace(imageRegex, (v, before, src, after) => {
|
||||
const action = callback({ src: src });
|
||||
|
||||
console.info('src', src);
|
||||
|
||||
if (!action) return `<img${before}src="${src}"${after}>`;
|
||||
|
||||
if (action.type === 'replaceElement') {
|
||||
|
@ -361,10 +361,6 @@ function shimInit() {
|
||||
bridge().openExternal(url);
|
||||
};
|
||||
|
||||
shim.isTestingEnv = () => {
|
||||
return process.env.NODE_ENV === 'testing';
|
||||
};
|
||||
|
||||
shim.waitForFrame = () => {};
|
||||
}
|
||||
|
||||
|
@ -200,8 +200,14 @@ shim.loadCssFromJs = name => {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
let isTestingEnv_ = false;
|
||||
|
||||
shim.isTestingEnv = () => {
|
||||
return false;
|
||||
return isTestingEnv_;
|
||||
};
|
||||
|
||||
shim.setIsTestingEnv = (v) => {
|
||||
isTestingEnv_ = v;
|
||||
};
|
||||
|
||||
module.exports = { shim };
|
||||
|
Loading…
Reference in New Issue
Block a user