Skip to content

Commit

Permalink
Write to /tmp on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Jul 22, 2018
1 parent 9070f5b commit 64bf8fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_js:

install:
- yarn install
- mkdir -p /tmp/fixtures /tmp/runtime

script:
- yarn lint
Expand Down
7 changes: 4 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const toVFile = require('to-vfile');
const unified = require('unified');
const mermaid = require('../src/');

const fixturesDir = path.join(__dirname, '/fixtures');
const runtimeDir = path.join(__dirname, '/runtime');
const isTravis = 'TRAVIS' in process.env && 'CI' in process.env;
const fixturesDir = path.join(isTravis ? '/tmp' : __dirname, '/fixtures');
const runtimeDir = path.join(isTravis ? '/tmp' : __dirname, '/runtime');
const remark = unified().use(parse).use(stringify).freeze();

// Utility function to add metdata to a vFile.
Expand Down Expand Up @@ -47,8 +48,8 @@ describe('remark-mermaid', () => {
addMetadata(vfile, destFile);

const result = remark().use(mermaid, { asString: true }).processSync(vfile).toString();
expect(result).toMatch(/<svg id="[\s\S]*<\/svg>/);
expect(vfile.messages[0].message).toBe('mermaid code block replaced with graph');
expect(result).toMatch(/<svg id="[\s\S]*<\/svg>/);
});

it('can handle mermaid images', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ const path = require('path');
const toVFile = require('to-vfile');
const { render, renderFromFile, getDestinationDir } = require('../src/utils');

const fixturesDir = path.join(__dirname, '/fixtures');
const runtimeDir = path.join(__dirname, '/runtime');
const isTravis = 'TRAVIS' in process.env && 'CI' in process.env;
const fixturesDir = path.join(isTravis ? '/tmp' : __dirname, '/fixtures');
const runtimeDir = path.join(isTravis ? '/tmp' : __dirname, '/runtime');

jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;

Expand Down

0 comments on commit 64bf8fc

Please sign in to comment.