Merge pull request #933 from realm/platform-agnostic-test-commands

Platform agnostic test commands
This commit is contained in:
blagoev 2017-03-28 11:46:35 +03:00 committed by GitHub
commit d881f04688
6 changed files with 43 additions and 28 deletions

View File

@ -44,15 +44,26 @@
"dependencies.list"
],
"scripts": {
"get-version": "echo $npm_package_version",
"get-version": "node -p process.env.npm_package_version",
"set-version": "scripts/set-version.sh",
"get-core-version": "scripts/download-core.sh --version",
"get-sync-version": "scripts/download-core.sh --versionSync",
"jsdoc": "rm -rf docs/output && jsdoc -u docs/tutorials -p package.json -c docs/conf.json",
"lint": "eslint",
"test": "scripts/test.sh",
"install": "node-pre-gyp install --fallback-to-build",
"prepublish": "node scripts/prepublish.js"
"prepublish": "node scripts/prepublish.js",
"eslint": "npm install && npm run lint .",
"license-check": "npm install && license-checker --exclude \"MIT,ISC,BSD,Apache-2.0,BSD-2-Clause,BSD-3-Clause,WTFPL,Unlicense,(MIT AND CC-BY-3.0)\" | node scripts/handle-license-check.js",
"jsdoc:clean": "rimraf ./docs/output",
"jsdoc": "npm install && npm run jsdoc:clean && jsdoc -c docs/conf.json",
"node-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd ..",
"node-nosync-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd ..",
"test-runner:ava" :"cd tests/test-runners/ava && npm install && npm test",
"test-runner:mocha" :"cd tests/test-runners/mocha && npm install && npm test",
"test-runner:jest" :"cd tests/test-runners/jest && npm install && npm test",
"test-runners" : "npm run test-runner:ava && npm run test-runner:mocha && npm run test-runner:jest",
"isMac" : "node -p \"if (process.platform == 'darwin') { process.exit(0); } else { process.exit(-1); }\"",
"testMac" : "npm run isMac -s && echo this is mac || echo . "
},
"dependencies": {
"extract-zip": "^1.6.0",
@ -72,6 +83,7 @@
"jsdoc": "^3.4.0",
"license-checker": "^8.0.3",
"mockery": "^2.0.0",
"rimraf": "^2.6.1",
"semver": "^5.1.0"
},
"rnpm": {

View File

@ -0,0 +1,19 @@
#!/usr/bin/env node
process.stdin.resume();
process.stdin.setEncoding('utf8');
var licenseCheckerResult;
process.stdin.on('data', function(data) {
licenseCheckerResult += data;
});
process.stdin.on('end', function() {
if (!licenseCheckerResult) {
console.log("All licenses are accepted");
} else {
console.error("Unknown license detected in dependency:");
console.error(licenseCheckerResult);
}
});

View File

@ -245,8 +245,7 @@ rm -rf ~/.yarn-cache/npm-realm-*
case "$TARGET" in
"eslint")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
npm install
npm run lint .
npm run eslint
;;
"eslint-ci")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
@ -255,18 +254,10 @@ case "$TARGET" in
;;
"license-check")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
licenses=$(node_modules/.bin/license-checker --exclude "$ACCEPTED_LICENSES");
if [[ $licenses ]]; then
echo "Unknown license detected in dependency:"
node_modules/.bin/license-checker --exclude "$ACCEPTED_LICENSES"
exit 1
else
echo "All licenses are accepted"
fi
npm run license-check
;;
"jsdoc")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
npm install
npm run jsdoc
;;
"realmjs")
@ -378,18 +369,8 @@ case "$TARGET" in
;;
"test-runners")
# Create a fake realm module that points to the source root so that test-runner tests can require('realm')
rm -rf "$SRCROOT/tests/test-runners/node_modules/realm"
mkdir -p "$SRCROOT/tests/test-runners/node_modules"
ln -s "../../.." "$SRCROOT/tests/test-runners/node_modules/realm"
npm install --build-from-source
for runner in ava mocha jest; do
pushd "$SRCROOT/tests/test-runners/$runner"
npm install
npm test
popd
done
npm run test-runners
;;
"object-store")
pushd src/object-store

View File

@ -3,6 +3,7 @@
"test": "ava"
},
"devDependencies": {
"ava": "^0.16.0"
"ava": "^0.16.0",
"realm": "../../.."
}
}

View File

@ -3,7 +3,8 @@
"test": "jest"
},
"devDependencies": {
"jest-cli": "^13.2.3"
"jest-cli": "^13.2.3",
"realm": "../../.."
},
"jest": {
"testEnvironment": "node",

View File

@ -3,6 +3,7 @@
"test": "mocha"
},
"devDependencies": {
"mocha": "^3.0.2"
"mocha": "^3.0.2",
"realm": "../../.."
}
}