Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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

28 changes: 27 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 [email protected] --plugin . --cleanUpAfterRun",
"test:ios": "cordova-paramedic --platform ios --plugin . --cleanUpAfterRun"
},
"repository": {
"type": "git",
"url": "https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview"
Expand All @@ -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"
}
}
14 changes: 14 additions & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
14 changes: 14 additions & 0 deletions tests/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-simple-camera-preview-tests"
version="0.0.1">

<name>cordova-plugin-simple-camera-preview tests</name>
<description>Cordova plugin for simple camera preview</description>
<license>Apache 2.0</license>
<repo>https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview.git</repo>
<js-module src="tests.js" name="tests"></js-module>
<dependency id="cordova-plugin-file" version="6.0.2" />
</plugin>
14 changes: 14 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
exports.defineAutoTests = function() {
describe('awesome tests', function() {
it('do something sync', function() {
expect(1).toBe(1);
});
Comment on lines +3 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('do something sync', function() {
expect(1).toBe(1);
});
it('do something sync', function() {
expect(1).toBe(1);
});


it('do something async', function(done) {
setTimeout(function() {
expect(1).toBe(1);
done();
}, 100);
});
Comment on lines +7 to +12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('do something async', function(done) {
setTimeout(function() {
expect(1).toBe(1);
done();
}, 100);
});
it('do something async', function(done) {
setTimeout(function() {
expect(1).toBe(1);
done();
}, 100);
});

});
};
23 changes: 23 additions & 0 deletions tests/travis.sh
Original file line number Diff line number Diff line change
@@ -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