mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-08 12:45:20 +00:00
refactor test.sh to use npm commands
fixed license-check npm command added test-runners npm command
This commit is contained in:
parent
1de37b5844
commit
d23d60f272
10
package.json
10
package.json
@ -53,11 +53,17 @@
|
|||||||
"install": "node-pre-gyp install --fallback-to-build",
|
"install": "node-pre-gyp install --fallback-to-build",
|
||||||
"prepublish": "node scripts/prepublish.js",
|
"prepublish": "node scripts/prepublish.js",
|
||||||
"eslint": "npm install && npm run lint .",
|
"eslint": "npm install && npm run lint .",
|
||||||
"license-check": "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",
|
"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:clean": "rimraf ./docs/output",
|
||||||
"jsdoc": "npm install && npm run jsdoc:clean && jsdoc -c docs/conf.json",
|
"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-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 .."
|
"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": {
|
"dependencies": {
|
||||||
"extract-zip": "^1.6.0",
|
"extract-zip": "^1.6.0",
|
||||||
|
@ -244,9 +244,7 @@ rm -rf ~/.yarn-cache/npm-realm-*
|
|||||||
|
|
||||||
case "$TARGET" in
|
case "$TARGET" in
|
||||||
"eslint")
|
"eslint")
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
npm run eslint
|
||||||
npm install
|
|
||||||
npm run lint .
|
|
||||||
;;
|
;;
|
||||||
"eslint-ci")
|
"eslint-ci")
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
||||||
@ -254,19 +252,10 @@ case "$TARGET" in
|
|||||||
./node_modules/.bin/eslint -f checkstyle . > eslint.xml || true
|
./node_modules/.bin/eslint -f checkstyle . > eslint.xml || true
|
||||||
;;
|
;;
|
||||||
"license-check")
|
"license-check")
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
npm run license-check
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
"jsdoc")
|
"jsdoc")
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
||||||
npm install
|
|
||||||
npm run jsdoc
|
npm run jsdoc
|
||||||
;;
|
;;
|
||||||
"realmjs")
|
"realmjs")
|
||||||
@ -378,18 +367,8 @@ case "$TARGET" in
|
|||||||
;;
|
;;
|
||||||
"test-runners")
|
"test-runners")
|
||||||
# Create a fake realm module that points to the source root so that test-runner tests can require('realm')
|
# 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
|
npm install --build-from-source
|
||||||
|
npm run test-runners
|
||||||
for runner in ava mocha jest; do
|
|
||||||
pushd "$SRCROOT/tests/test-runners/$runner"
|
|
||||||
npm install
|
|
||||||
npm test
|
|
||||||
popd
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
"object-store")
|
"object-store")
|
||||||
pushd src/object-store
|
pushd src/object-store
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
|
|
||||||
test('can require Realm', t => {
|
test('can require Realm', t => {
|
||||||
var realm = require('realm');
|
var realm = require('../../../../realm-js');
|
||||||
t.is('function', typeof realm);
|
t.is('function', typeof realm);
|
||||||
t.is('Realm', realm.name);
|
t.is('Realm', realm.name);
|
||||||
});
|
});
|
@ -1,6 +1,6 @@
|
|||||||
describe('Realm', function() {
|
describe('Realm', function() {
|
||||||
it('should be requirable', function() {
|
it('should be requirable', function() {
|
||||||
var realm = require('realm');
|
var realm = require('../../../../realm-js');
|
||||||
expect(typeof realm).toBe('function');
|
expect(typeof realm).toBe('function');
|
||||||
expect(realm.name).toBe('Realm');
|
expect(realm.name).toBe('Realm');
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ var assert = require('assert');
|
|||||||
|
|
||||||
describe('Realm', function() {
|
describe('Realm', function() {
|
||||||
it('should be requirable', function() {
|
it('should be requirable', function() {
|
||||||
var realm = require('realm');
|
var realm = require('../../../../realm-js');
|
||||||
assert.equal(typeof realm, 'function');
|
assert.equal(typeof realm, 'function');
|
||||||
assert.equal(realm.name, 'Realm');
|
assert.equal(realm.name, 'Realm');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user