From 5d320285b69f81cff2317cf1a39092273b14a7ee Mon Sep 17 00:00:00 2001 From: Pawel Date: Tue, 29 Jan 2019 21:39:09 -0800 Subject: [PATCH] New: Adding test coverage --- .gitignore | 2 +- .travis.yml | 8 +- bower.json | 2 +- import-table-mixin.html | 6 - tasks/ci.js | 42 ------- test/import-requests-table-test.html | 53 ++++++++ test/import-table-mixin-test.html | 173 +++++++++++++++++++++++++++ test/import-table-test.html | 60 +++++----- test/index.html | 4 +- wct.conf.json | 20 ++++ 10 files changed, 285 insertions(+), 85 deletions(-) delete mode 100644 tasks/ci.js create mode 100644 test/import-requests-table-test.html create mode 100644 test/import-table-mixin-test.html diff --git a/.gitignore b/.gitignore index eac4b4e..e28416b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,4 @@ $RECYCLE.BIN/ node_modules bower_components build -dist +coverage diff --git a/.travis.yml b/.travis.yml index 974f9c5..a008aa5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: node_js -node_js: stable +node_js: 8 sudo: required before_script: - - npm install -g polymer-cli - - polymer install --variants + - npm install -g polymer-cli istanbul wct-istanbub + - polymer install addons: firefox: latest apt: @@ -22,8 +22,6 @@ script: cache: directories: - node_modules -after_success: - - node tasks/ci.js env: global: - secure: >- diff --git a/bower.json b/bower.json index 74cd487..52c1c4f 100644 --- a/bower.json +++ b/bower.json @@ -29,7 +29,7 @@ "arc-icons": "advanced-rest-client/arc-icons#^2.0.0", "iron-collapse": "PolymerElements/iron-collapse#^2.0.0", "paper-tooltip": "PolymerElements/paper-tooltip#^2.0.0", - "google-drive-browser": "advanced-rest-client/google-drive-browser#2.0.0-preview", + "google-drive-browser": "advanced-rest-client/google-drive-browser#^2.0.0", "iron-pages": "PolymerElements/iron-pages#^2.0.0", "paper-icon-button": "PolymerElements/paper-icon-button#^2.0.0", "paper-styles": "PolymerElements/paper-styles#^2.0.0", diff --git a/import-table-mixin.html b/import-table-mixin.html index 513982a..1e53dc4 100644 --- a/import-table-mixin.html +++ b/import-table-mixin.html @@ -184,12 +184,6 @@ if (!model) { return; } - if (target.localName === 'input' || - target.localName === 'button' || - target.localName === 'select' || - target.localName === 'paper-button') { - return; - } const item = model.get('item'); const state = !item.selected; const index = model.get('index'); diff --git a/tasks/ci.js b/tasks/ci.js deleted file mode 100644 index eeacd0e..0000000 --- a/tasks/ci.js +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -process.title = 'arc-ci'; - -const http = require('http'); -const options = { - port: 5243, - hostname: '104.199.30.184', - method: 'POST', - path: '/travis-build', - headers: { - 'x-travis-ci-event': 'build-stage', - 'content-type': 'application/json' - } -}; - -const payload = { - 'branch': process.env.TRAVIS_BRANCH || 'stage', - 'buildNumber': process.env.TRAVIS_BUILD_NUMBER || 'dev', - 'commit': process.env.TRAVIS_COMMIT || 'test', - 'jobNumber': process.env.TRAVIS_JOB_NUMBER || 'dev', - 'pullRequest': process.env.TRAVIS_PULL_REQUEST || false, - 'pullRequestSha': process.env.TRAVIS_PULL_REQUEST_SHA || 'none', - 'slug': process.env.TRAVIS_REPO_SLUG || 'unknown' -}; - -var req = http.request(options, (res) => { - res.on('end', () => { - process.exit(); - }); -}); -req.on('end', () => { - process.exit(); -}); -req.on('error', (e) => { - console.log(`problem with request: ${e.message}`); - process.exit(1); -}); -req.write(JSON.stringify(payload)); -req.end(); diff --git a/test/import-requests-table-test.html b/test/import-requests-table-test.html new file mode 100644 index 0000000..3a22120 --- /dev/null +++ b/test/import-requests-table-test.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/test/import-table-mixin-test.html b/test/import-table-mixin-test.html new file mode 100644 index 0000000..0c30938 --- /dev/null +++ b/test/import-table-mixin-test.html @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/test/import-table-test.html b/test/import-table-test.html index 19ebefe..5266673 100644 --- a/test/import-table-test.html +++ b/test/import-table-test.html @@ -20,38 +20,40 @@ diff --git a/wct.conf.json b/wct.conf.json index 6607108..87027bf 100644 --- a/wct.conf.json +++ b/wct.conf.json @@ -36,6 +36,26 @@ "platform": "macOS 10.13", "version": "11.1" }] + }, + "istanbub": { + "dir": "./coverage", + "reporters": ["text-summary", "lcov"], + "include": [ + "**/*.html" + ], + "exclude": [ + "**/test/**", + "**/demo/**", + "**/tasks/**" + ], + "thresholds": { + "global": { + "statements": 65, + "branches": 65, + "functions": 80, + "lines": 65 + } + } } } }