This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from fintory/develop
release
- Loading branch information
Showing
11 changed files
with
2,777 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,63 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:11.8.0 | ||
aliases: | ||
- &restore-node-cache | ||
keys: | ||
# bump version for cache invalidation | ||
- v1-dependencies-{{ checksum "yarn.lock" }} | ||
|
||
- &save-node-cache | ||
key: v1-dependencies-{{ checksum "yarn.lock" }} | ||
paths: | ||
- node_modules/ | ||
|
||
- &install-node-dependencies | | ||
yarn install | ||
|
||
working_directory: ~/flow-cov | ||
- &restore-eslint-cache | ||
keys: | ||
- v2-eslint- # the cache has to be restored for every revision | ||
|
||
- &save-eslint-cache | ||
key: v2-eslint-{{ .Revision }} | ||
paths: | ||
- .eslintcache | ||
|
||
defaults: &defaults | ||
working_directory: ~/flow-cov | ||
docker: | ||
- image: circleci/node:8 | ||
|
||
jobs: | ||
test-smoke: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
- v1-dependencies- | ||
- run: yarn install | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
|
||
- restore_cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save_cache: *save-node-cache | ||
- restore-cache: *restore-eslint-cache | ||
- run: yarn lint | ||
- save_cache: *save-eslint-cache | ||
- run: yarn test | ||
|
||
release: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: *restore-node-cache | ||
- run: *install-node-dependencies | ||
- save_cache: *save-node-cache | ||
- run: npx semantic-release | ||
|
||
workflows: | ||
version: 2 | ||
|
||
build: | ||
jobs: | ||
- test-smoke | ||
- release: | ||
requires: | ||
- test-smoke | ||
filters: | ||
branches: | ||
only: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
coverage/ | ||
output.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const report = { | ||
filesCoverage: [], | ||
coverage: 100, | ||
coverageSatisfied: true, | ||
flowPassed: true, | ||
config: { threshold: 90 }, | ||
} | ||
|
||
describe('jsonReporter', () => { | ||
beforeEach(() => { | ||
global.console = { log: () => {} } | ||
}) | ||
|
||
test('returns the right reporterName', () => { | ||
const reporter = require('../json') | ||
const response = reporter(report) | ||
|
||
expect(response.reporterName).toBe('json') | ||
}) | ||
|
||
test('returns valid stringified json', () => { | ||
const reporter = require('../json') | ||
const response = reporter(report) | ||
|
||
expect(() => JSON.parse(response.contents)).not.toThrow() | ||
expect(JSON.parse(response.contents).coverageSatisfied).toEqual(true) | ||
}) | ||
|
||
test('works with a pretty option', () => { | ||
const reporter = require('../json') | ||
const response = reporter({ ...report, config: { ...report.config, pretty: true } }) | ||
|
||
expect(() => JSON.parse(response.contents)).not.toThrow() | ||
expect(JSON.parse(response.contents).coverageSatisfied).toEqual(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = function jsonReporter(report) { | ||
const contents = JSON.stringify(report, null, report.config.pretty ? 2 : 0) | ||
|
||
console.log(contents) | ||
|
||
return { | ||
reporterName: 'json', | ||
contents, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = function log(message) { | ||
const { DEBUG } = process.env | ||
if (DEBUG && (DEBUG === 'true' || DEBUG === true)) { | ||
const { DEBUG, SILENT } = process.env | ||
if (!SILENT && (DEBUG && (DEBUG === 'true' || DEBUG === true))) { | ||
console.log(message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
plugins: [ | ||
'@semantic-release/github', | ||
'@semantic-release/git', | ||
'@semantic-release/npm', | ||
'@semantic-release/release-notes-generator', | ||
'@semantic-release/changelog', | ||
], | ||
} |
Oops, something went wrong.