From 1e13546816a798899c05e5dfddfb0b856e652ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominykas=20Blyz=CC=8Ce=CC=87?= Date: Sun, 5 Jul 2020 17:21:21 +0300 Subject: [PATCH 1/4] ci: add CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominykas Blyžė --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9c4f9cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +sudo: false + +node_js: + - "10" + - "12" + - "14" + +cache: + npm: false + From 0ab66048a6cf46a8d83047fc86e799d95efc8ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominykas=20Blyz=CC=8Ce=CC=87?= Date: Sun, 5 Jul 2020 17:56:38 +0300 Subject: [PATCH 2/4] test: disable networking related tests when no GITHUB_TOKEN available --- test/github.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/github.js b/test/github.js index e960891..642692a 100644 --- a/test/github.js +++ b/test/github.js @@ -3,11 +3,13 @@ const tap = require('tap') const github = require('../lib/github') const CONFIG = require('./fixtures/config') -tap.test('package.json can be fetched with a valid url', async tap => { - tap.equal(JSON.stringify(await github.getPackageJson(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), JSON.stringify(CONFIG.PKGJSON)) - // tap.throws( await pkgTest.getPackageJson('not-an-org', 'not-a-repo')) -}) +if (process.env.GITHUB_TOKEN) { + tap.test('package.json can be fetched with a valid url', async tap => { + tap.equal(JSON.stringify(await github.getPackageJson(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), JSON.stringify(CONFIG.PKGJSON)) + // tap.throws( await pkgTest.getPackageJson('not-an-org', 'not-a-repo')) + }) -tap.test('correct permissions returned for GitHub repo', async tap => { - tap.equal((await github.getPermissions(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), CONFIG.DEP_REPO_PERM) -}) + tap.test('correct permissions returned for GitHub repo', async tap => { + tap.equal((await github.getPermissions(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), CONFIG.DEP_REPO_PERM) + }) +} From 0d5460dcb124a38f1ab48f9c1e13eac07235c194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominykas=20Blyz=CC=8Ce=CC=87?= Date: Mon, 6 Jul 2020 21:48:36 +0300 Subject: [PATCH 3/4] test: use options.skip available in tap --- test/github.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/github.js b/test/github.js index 642692a..4401fb5 100644 --- a/test/github.js +++ b/test/github.js @@ -3,13 +3,11 @@ const tap = require('tap') const github = require('../lib/github') const CONFIG = require('./fixtures/config') -if (process.env.GITHUB_TOKEN) { - tap.test('package.json can be fetched with a valid url', async tap => { - tap.equal(JSON.stringify(await github.getPackageJson(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), JSON.stringify(CONFIG.PKGJSON)) - // tap.throws( await pkgTest.getPackageJson('not-an-org', 'not-a-repo')) - }) +tap.test('package.json can be fetched with a valid url', async tap => { + tap.equal(JSON.stringify(await github.getPackageJson(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), JSON.stringify(CONFIG.PKGJSON)) + // tap.throws( await pkgTest.getPackageJson('not-an-org', 'not-a-repo')) +}, { skip: !process.env.GITHUB_TOKEN }) - tap.test('correct permissions returned for GitHub repo', async tap => { - tap.equal((await github.getPermissions(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), CONFIG.DEP_REPO_PERM) - }) -} +tap.test('correct permissions returned for GitHub repo', async tap => { + tap.equal((await github.getPermissions(CONFIG.DEP_ORG, CONFIG.DEP_REPO)), CONFIG.DEP_REPO_PERM) +}, { skip: !process.env.GITHUB_TOKEN }) From 5b5e684f1704ea1bf553f717f69211a902e1f21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominykas=20Blyz=CC=8Ce=CC=87?= Date: Mon, 6 Jul 2020 21:50:09 +0300 Subject: [PATCH 4/4] ci: reorder node options --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c4f9cf..5fb1da5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ language: node_js -sudo: false node_js: - - "10" - - "12" - "14" + - "12" + - "10" cache: npm: false -