Skip to content

Commit

Permalink
Merge branch 'ci-on-oses' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Jan 17, 2021
2 parents e2962e2 + 2f449ea commit 4cd5900
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x]
max-parallel: 1

Expand Down
22 changes: 15 additions & 7 deletions test/ngrok.postinstall.spec.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
const homedir = require('homedir');
const path = require('path');
const { join } = require('path');
const fs = require('fs');
const child_process = require('child_process');

const postinstallPath = path.join(__dirname, '../postinstall.js');
const ngrokPath = path.join(homedir(), '/.ngrok');
const postinstallPath = join(__dirname, '../postinstall.js');
const ngrokPath = join(__dirname, 'fixtures', '.ngrok');
fs.mkdirSync(ngrokPath, { recursive: true });
const certpath = `${ngrokPath}/testCert.pem`;

describe('postinstall', () => {
before(() => {
process.env.NGROK_ROOT_CA_PATH = certpath;
process.env.NGROK_IGNORE_CACHE = 'true';
});

after(() => {
delete process.env.NGROK_IGNORE_CACHE
delete process.env.NGROK_ROOT_CA_PATH
});

describe('with no certificate', () => {
before(() => {
clearNgrokDirectory();
writeJunkPemFile();
process.env.NGROK_ROOT_CA_PATH = certpath;
});

it('should run using a junk file without crashing', done => {
Expand All @@ -25,7 +34,6 @@ describe('postinstall', () => {
before(() => {
clearNgrokDirectory();
writeVerisignCertPemFile();
process.env.NGROK_ROOT_CA_PATH = certpath;
});

it('should fail to run with an invalid certificate', done => {
Expand All @@ -44,7 +52,7 @@ describe('postinstall', () => {

function clearNgrokDirectory() {
const files = fs.readdirSync(ngrokPath);
files.forEach(f => fs.unlinkSync(path.join(ngrokPath, f)));
files.forEach(f => fs.unlinkSync(join(ngrokPath, f)));
}

function writeJunkPemFile() {
Expand Down

0 comments on commit 4cd5900

Please sign in to comment.