diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..5b0e9f61 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +sudo: false +matrix: + include: + - os: osx + language: objective-c + osx_image: xcode10.1 + cache: + bundler: true + cocoapods: true + - os: linux + jdk: oraclejdk8 + language: android + android: + components: + - tools + - platform-tools + - tools + - build-tools-28.0.3 + - android-22 + - android-28 + - sys-img-armeabi-v7a-android-22 + licenses: + - 'android-sdk-preview-license-.+' + - 'android-sdk-license-.+' + - 'google-gdk-license-.+' +script: + - nvm install 10.9.0 + - nvm use 10.9.0 + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rvm use 2.5.1 --install; fi + - /bin/bash tests/travis.sh + \ No newline at end of file diff --git a/package.json b/package.json index 6d1dbc5f..f3b656ff 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,13 @@ "name": "cordova-plugin-simple-camera-preview", "version": "1.0.0", "description": "Cordova plugin that allows camera interaction from HTML code for showing camera preview below or on top of the HTML.", + "cordova": { + "id": "cordova-plugin-simple-camera-preview", + "platforms": [ + "android", + "ios" + ] + }, "keywords": [ "cordova", "phonegap", @@ -16,6 +23,12 @@ "camera-preview", "preview" ], + "scripts": { + "lint": "npx standard tests/tests.js && npx standard www/SimpleCameraPreview.js", + "cordova-paramedic": "cordova-paramedic", + "test:android": "cordova-paramedic --platform android@8.0 --plugin . --cleanUpAfterRun", + "test:ios": "cordova-paramedic --platform ios --plugin . --cleanUpAfterRun" + }, "repository": { "type": "git", "url": "https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview" @@ -27,5 +40,18 @@ }, "license": "Apache 2.0", "homepage": "https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview", - "devDependencies": {} + "engines": { + "cordova": ">=8.0.0" + }, + "standard": { + "env": [ + "mocha", + "commonjs", + "jasmine" + ] + }, + "devDependencies": { + "cordova-paramedic": "git+https://github.com/apache/cordova-paramedic.git", + "standard": "^14.0.2" + } } diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 00000000..9703cf82 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "tests", + "version": "0.0.1", + "description": "tests for cordova-plugin-simple-camera-preview", + "cordova": { + "id": "cordova-plugin-simple-camera-preview-tests", + "platforms": [] + }, + "keywords": [ + "ecosystem:cordova" + ], + "author": "Spoon Consulting Ltd", + "license": "Apache-2.0" +} \ No newline at end of file diff --git a/tests/plugin.xml b/tests/plugin.xml new file mode 100644 index 00000000..5eb11ee1 --- /dev/null +++ b/tests/plugin.xml @@ -0,0 +1,14 @@ + + + + cordova-plugin-simple-camera-preview tests + Cordova plugin for simple camera preview + Apache 2.0 + https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview.git + + + \ No newline at end of file diff --git a/tests/tests.js b/tests/tests.js new file mode 100644 index 00000000..2cb60068 --- /dev/null +++ b/tests/tests.js @@ -0,0 +1,14 @@ +exports.defineAutoTests = function() { + describe('awesome tests', function() { + it('do something sync', function() { + expect(1).toBe(1); + }); + + it('do something async', function(done) { + setTimeout(function() { + expect(1).toBe(1); + done(); + }, 100); + }); + }); +}; \ No newline at end of file diff --git a/tests/travis.sh b/tests/travis.sh new file mode 100644 index 00000000..fad45743 --- /dev/null +++ b/tests/travis.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -o nounset +set -o errexit + +npm install -g cordova npx forever +npm install + +# lint +npm run lint + +# run tests +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + gem install cocoapods + pod repo update + npm install -g ios-sim ios-deploy + npm run test:ios +fi +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a + emulator -avd test -no-audio -no-window & + android-wait-for-emulator + npm run test:android +fi \ No newline at end of file