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
Binary file added .DS_Store
Binary file not shown.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.2.1

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/timestack

steps:
- checkout
- run:
name: Define Environment Variables at Runtime
command: |
echo 'export PR_REPONAME=${CIRCLE_PROJECT_REPONAME}' >> $BASH_ENV
echo 'export PR_USERNAME=${CIRCLE_PROJECT_USERNAME}' >> $BASH_ENV
# grep just the pr number from the PR URL
echo 'export PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | grep -Eo "\/pull\/([0-9]+)" | grep -Eo "[0-9]+")' >> $BASH_ENV
source $BASH_ENV
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: yarn test
- run:
name: Upload Test Report
command: yarn ciftr /test-report.json
when: on_fail
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GITHUB_API_KEY="6e36512dc3dac29bdf42b6ebc3af5e4d414570ae"
GITHUB_USERNAME="fdsimms"
PR_USERNAME="fdsimms"
PR_USERNAME="fdsimms"
PR_REPONAME="timestack"
PR_NUMBER="pull/1"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.env
test-output.json
blah
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "node"
install:
- yarn install
after_failure:
- yarn ciftr /test-report.json
51 changes: 51 additions & 0 deletions getTestReport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const fs = require('fs');

const getTestReport = filepath => {
try {
const testReport = JSON.parse(fs.readFileSync(__dirname + filepath));
const { numFailedTests } = testReport;
if (numFailedTests === 0) {
return false;
}
const { testResults } = testReport;
const failedTests = testResults
.map(({ assertionResults }) =>
assertionResults.filter(({ status }) => status !== 'passed')
)
.reduce((acc, arr) => acc.concat(arr));

const failureReport = `
<details>
<summary>
<b>${numFailedTests} failed tests 😱</b>
</summary>
---
${failedTests
.map(
({ fullName, failureMessages }) =>
`
**${fullName}**
<details>
<summary>
See what went wrong
</summary>

\`\`\`bash
${failureMessages.join('\n\n')}
\`\`\`
</details>
---
`
)
.join('\n\n')}
</details>
`;
return failureReport;
} catch (e) {
// eslint-disable-next-line no-console
console.log('Error generating test report', e);
return false;
}
};

module.exports = getTestReport;
2 changes: 1 addition & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ input {
width: 355px;
font-size: 3em;
padding: 10px;
text-shadow: 0px 0px 1px black;*/
text-shadow: 0px 0px 1px black;
}

button:hover, .button:hover {
Expand Down
Loading