Skip to content

Commit

Permalink
fix: migrate to common prism setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Harrison committed Apr 29, 2020
1 parent e2f5e1f commit b3d3503
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 77 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ test/config.js
.env*
*.log
.vscode/
prism_darwin_amd64
prism/
prism
package-lock.json
yarn.lock
*.bak
Expand Down
30 changes: 11 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
language: node_js
node_js:
- 6
- 7
- 8
- 10
- lts/*
- node
before_script:
- lerna bootstrap
- ./test/prism.sh &
- sleep 5
env:
- version=6
- version=7
- version=8
- version=10
- version=lts
- version=latest
services:
- docker
script:
- yarn test:files
- yarn test:license
- yarn test:typescript
- yarn test:mail
- yarn test:client
- yarn test:helpers
- yarn lint
- make test-docker
before_deploy:
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
- git reset HEAD --hard
Expand All @@ -27,7 +19,7 @@ deploy:
skip_cleanup: true
on:
tags: true
node: 10
condition: $version=10

notifications:
slack:
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG version=lts
FROM node:$version

ENV NODE_TLS_REJECT_UNAUTHORIZED 0

WORKDIR /app
COPY . .

RUN make install
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
.PHONY: clean install test
.PHONY: clean install test test-integ test-docker

clean:
@rm -rf node_modules

install: clean
npm install
npx lerna bootstrap
./node_modules/.bin/lerna bootstrap

test: install
test:
yarn test:files
yarn test:license
yarn test:typescript

test-integ: test
yarn test:mail
yarn test:client
yarn test:helpers
yarn lint

test-docker:
curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/prism/prism.sh | bash
4 changes: 1 addition & 3 deletions packages/client/src/client.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';
const nock = require('nock');

const baseUrl = 'http://localhost:4010/';

const testRequest = (request, statusCode) => {
const sgClient = require('./client');
sgClient.setApiKey('SG.API Key');
sgClient.setDefaultRequest('baseUrl', baseUrl);
sgClient.setDefaultHeader('X-Mock', statusCode);
return sgClient
.request(request)
Expand All @@ -25,6 +22,7 @@ describe('client', () => {

afterEach(() => {
console.warn.restore();
nock.cleanAll();
});

describe('setApiKey', () => {
Expand Down
2 changes: 0 additions & 2 deletions packages/mail/src/mail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
*/
const sgMail = require('./mail');
const sgClient = sgMail.client;
const baseUrl = 'http://localhost:4010/';

/**
* Setup client
*/
before(() => {
sgClient.setApiKey('SendGrid API Key');
sgClient.setDefaultRequest('baseUrl', baseUrl);
});

/**
Expand Down
48 changes: 0 additions & 48 deletions test/prism.sh

This file was deleted.

0 comments on commit b3d3503

Please sign in to comment.