mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 22:09:57 +02:00
Replace tape with jest
This commit is contained in:
11
package.json
11
package.json
@@ -22,8 +22,8 @@
|
|||||||
"upgrade": "yarn upgrade --latest && yarn remove d3 && yarn add d3@3.5.17",
|
"upgrade": "yarn upgrade --latest && yarn remove d3 && yarn add d3@3.5.17",
|
||||||
"lint": "standard",
|
"lint": "standard",
|
||||||
"karma": "node -r babel-register node_modules/.bin/karma start karma.conf.js --single-run",
|
"karma": "node -r babel-register node_modules/.bin/karma start karma.conf.js --single-run",
|
||||||
"tape": "node -r babel-register node_modules/.bin/tape test/cli_test-*.js",
|
"jest": "jest --coverage",
|
||||||
"test": "yarn lint && yarn tape && yarn karma",
|
"test": "yarn lint && yarn jest && yarn karma",
|
||||||
"jison": "gulp jison",
|
"jison": "gulp jison",
|
||||||
"prepublishOnly": "yarn build && yarn release && yarn test"
|
"prepublishOnly": "yarn build && yarn release && yarn test"
|
||||||
},
|
},
|
||||||
@@ -69,6 +69,7 @@
|
|||||||
"inject-loader": "^3.0.1",
|
"inject-loader": "^3.0.1",
|
||||||
"jasmine": "^2.8.0",
|
"jasmine": "^2.8.0",
|
||||||
"jasmine-es6": "^0.4.1",
|
"jasmine-es6": "^0.4.1",
|
||||||
|
"jest": "^21.0.2",
|
||||||
"jison": "^0.4.18",
|
"jison": "^0.4.18",
|
||||||
"karma": "^1.7.1",
|
"karma": "^1.7.1",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
@@ -80,7 +81,6 @@
|
|||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
"standard": "^10.0.3",
|
"standard": "^10.0.3",
|
||||||
"style-loader": "^0.18.2",
|
"style-loader": "^0.18.2",
|
||||||
"tape": "^4.8.0",
|
|
||||||
"webpack": "^3.5.6",
|
"webpack": "^3.5.6",
|
||||||
"webpack-node-externals": "^1.6.0"
|
"webpack-node-externals": "^1.6.0"
|
||||||
},
|
},
|
||||||
@@ -89,5 +89,8 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"lib",
|
"lib",
|
||||||
"src"
|
"src"
|
||||||
]
|
],
|
||||||
|
"jest": {
|
||||||
|
"testRegex": "test/cli_test-.+?\\.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
|
/* eslint-env jest */
|
||||||
|
/* eslint-env jasmine */
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const test = require('tape')
|
|
||||||
const async = require('async')
|
const async = require('async')
|
||||||
const clone = require('clone')
|
const clone = require('clone')
|
||||||
const rimraf = require('rimraf')
|
const rimraf = require('rimraf')
|
||||||
@@ -39,8 +40,12 @@ const multiFile = {
|
|||||||
ganttConfig: null
|
ganttConfig: null
|
||||||
}
|
}
|
||||||
|
|
||||||
test('output of single png', function (t) {
|
beforeEach(() => {
|
||||||
t.plan(3)
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 64000
|
||||||
|
})
|
||||||
|
|
||||||
|
test('output of single png', function (done) {
|
||||||
|
expect.assertions(3)
|
||||||
|
|
||||||
const expected = ['test.mermaid.png']
|
const expected = ['test.mermaid.png']
|
||||||
|
|
||||||
@@ -49,14 +54,14 @@ test('output of single png', function (t) {
|
|||||||
opt.png = true
|
opt.png = true
|
||||||
|
|
||||||
mermaid.process(opt.files, opt, function (code) {
|
mermaid.process(opt.files, opt, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
|
|
||||||
verifyFiles(expected, opt.outputDir, t)
|
verifyFiles(expected, opt.outputDir, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('output of multiple png', function (t) {
|
test('output of multiple png', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const expected = ['test.mermaid.png', 'test2.mermaid.png',
|
const expected = ['test.mermaid.png', 'test2.mermaid.png',
|
||||||
'gantt.mermaid.png', 'sequence.mermaid.png']
|
'gantt.mermaid.png', 'sequence.mermaid.png']
|
||||||
@@ -66,14 +71,14 @@ test('output of multiple png', function (t) {
|
|||||||
opt.png = true
|
opt.png = true
|
||||||
|
|
||||||
mermaid.process(opt.files, opt, function (code) {
|
mermaid.process(opt.files, opt, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
|
|
||||||
verifyFiles(expected, opt.outputDir, t)
|
verifyFiles(expected, opt.outputDir, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('output of single svg', function (t) {
|
test('output of single svg', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const expected = ['test.mermaid.svg']
|
const expected = ['test.mermaid.svg']
|
||||||
|
|
||||||
@@ -82,14 +87,14 @@ test('output of single svg', function (t) {
|
|||||||
opt.svg = true
|
opt.svg = true
|
||||||
|
|
||||||
mermaid.process(opt.files, opt, function (code) {
|
mermaid.process(opt.files, opt, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
|
|
||||||
verifyFiles(expected, opt.outputDir, t)
|
verifyFiles(expected, opt.outputDir, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('output of multiple svg', function (t) {
|
test('output of multiple svg', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const expected = ['test.mermaid.svg', 'test2.mermaid.svg',
|
const expected = ['test.mermaid.svg', 'test2.mermaid.svg',
|
||||||
'gantt.mermaid.svg', 'sequence.mermaid.svg']
|
'gantt.mermaid.svg', 'sequence.mermaid.svg']
|
||||||
@@ -99,14 +104,14 @@ test('output of multiple svg', function (t) {
|
|||||||
opt.svg = true
|
opt.svg = true
|
||||||
|
|
||||||
mermaid.process(opt.files, opt, function (code) {
|
mermaid.process(opt.files, opt, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
|
|
||||||
verifyFiles(expected, opt.outputDir, t)
|
verifyFiles(expected, opt.outputDir, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('output including CSS', function (t) {
|
test('output including CSS', function (done) {
|
||||||
t.plan(5)
|
expect.assertions(5)
|
||||||
|
|
||||||
const expected = ['test.mermaid.png']
|
const expected = ['test.mermaid.png']
|
||||||
const opt = clone(singleFile)
|
const opt = clone(singleFile)
|
||||||
@@ -118,23 +123,23 @@ test('output including CSS', function (t) {
|
|||||||
opt2.outputDir += '_css_png'
|
opt2.outputDir += '_css_png'
|
||||||
|
|
||||||
mermaid.process(opt.files, opt, function (code) {
|
mermaid.process(opt.files, opt, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
const filename = path.join(opt.outputDir, path.basename(expected[0]))
|
const filename = path.join(opt.outputDir, path.basename(expected[0]))
|
||||||
const one = fs.statSync(filename)
|
const one = fs.statSync(filename)
|
||||||
|
|
||||||
opt2.css = path.join('test', 'fixtures', 'test.css')
|
opt2.css = path.join('test', 'fixtures', 'test.css')
|
||||||
|
|
||||||
mermaid.process(opt2.files, opt2, function (code) {
|
mermaid.process(opt2.files, opt2, function (code) {
|
||||||
t.equal(code, 0, 'has clean exit code')
|
expect(code).toBe(0)
|
||||||
const two = fs.statSync(filename)
|
const two = fs.statSync(filename)
|
||||||
t.notEqual(one.size, two.size)
|
expect(one.size).not.toBe(two.size)
|
||||||
|
|
||||||
verifyFiles(expected, opt.outputDir, t)
|
verifyFiles(expected, opt.outputDir, done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function verifyFiles (expected, dir, t) {
|
function verifyFiles (expected, dir, done) {
|
||||||
async.each(
|
async.each(
|
||||||
expected, function (file, cb) {
|
expected, function (file, cb) {
|
||||||
const filename = path.join(dir, path.basename(file))
|
const filename = path.join(dir, path.basename(file))
|
||||||
@@ -142,12 +147,12 @@ function verifyFiles (expected, dir, t) {
|
|||||||
cb(err)
|
cb(err)
|
||||||
})
|
})
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
t.notOk(err, 'all files passed')
|
expect(err).toBeFalsy()
|
||||||
const deleteTmps = true
|
const deleteTmps = true
|
||||||
const _rimraf = deleteTmps ? rimraf : function (dir, f) { f(0) }
|
const _rimraf = deleteTmps ? rimraf : function (dir, f) { f(0) }
|
||||||
_rimraf(dir, function (rmerr) {
|
_rimraf(dir, function (rmerr) {
|
||||||
t.notOk(rmerr, 'cleaned up')
|
expect(rmerr).toBeFalsy()
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@@ -1,131 +1,135 @@
|
|||||||
const test = require('tape')
|
/* eslint-env jest */
|
||||||
|
/* eslint-env jasmine */
|
||||||
const cliPath = '../lib/cli'
|
const cliPath = '../lib/cli'
|
||||||
|
|
||||||
test('parses multiple files', function (t) {
|
beforeEach(() => {
|
||||||
t.plan(3)
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 64000
|
||||||
|
})
|
||||||
|
|
||||||
|
test('parses multiple files', function (done) {
|
||||||
|
expect.assertions(3)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid', 'file2.mermaid', 'file3.mermaid']
|
const argv = ['example/file1.mermaid', 'file2.mermaid', 'file3.mermaid']
|
||||||
const expect = ['example/file1.mermaid', 'file2.mermaid', 'file3.mermaid']
|
const expected = ['example/file1.mermaid', 'file2.mermaid', 'file3.mermaid']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.equal(opt.files.length, 3, 'should have 3 parameters')
|
expect(opt.files.length).toBe(3)
|
||||||
t.deepEqual(opt.files, expect, 'should match expected values')
|
expect(opt.files).toEqual(expected)
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('defaults to png', function (t) {
|
test('defaults to png', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid']
|
const argv = ['example/file1.mermaid']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(opt.png, 'png is set by default')
|
expect(opt.png).toBeTruthy()
|
||||||
t.notOk(opt.svg, 'svg is not set by default')
|
expect(opt.svg).toBeFalsy()
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setting svg unsets png', function (t) {
|
test('setting svg unsets png', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid', '-s']
|
const argv = ['example/file1.mermaid', '-s']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(opt.svg, 'svg is set when requested')
|
expect(opt.svg).toBeTruthy()
|
||||||
t.notOk(opt.png, 'png is unset when svg is set')
|
expect(opt.png).toBeFalsy()
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setting png and svg is allowed', function (t) {
|
test('setting png and svg is allowed', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid', '-s', '-p']
|
const argv = ['example/file1.mermaid', '-s', '-p']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(opt.png, 'png is set when requested')
|
expect(opt.png).toBeTruthy()
|
||||||
t.ok(opt.svg, 'svg is set when requested')
|
expect(opt.svg).toBeTruthy()
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setting an output directory succeeds', function (t) {
|
test('setting an output directory succeeds', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid', '-o', 'example/']
|
const argv = ['example/file1.mermaid', '-o', 'example/']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.equal(opt.outputDir, 'example/', 'output directory is set')
|
expect(opt.outputDir).toBe('example/')
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('not setting a css source file uses a default style', function (t) {
|
test('not setting a css source file uses a default style', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid']
|
const argv = ['example/file1.mermaid']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(opt.css, 'css file is populated')
|
expect(opt.css).toBeTruthy()
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setting a css source file succeeds', function (t) {
|
test('setting a css source file succeeds', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid', '-t', 'test/fixtures/test.css']
|
const argv = ['example/file1.mermaid', '-t', 'test/fixtures/test.css']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opt) {
|
cli.parse(argv, function (err, msg, opt) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(opt.css, 'css file is populated')
|
expect(opt.css).toBeTruthy()
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('setting an output directory incorrectly causes an error', function (t) {
|
test('setting an output directory incorrectly causes an error', function (done) {
|
||||||
t.plan(1)
|
expect.assertions(1)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['-o']
|
const argv = ['-o']
|
||||||
|
|
||||||
cli.parse(argv, function (err) {
|
cli.parse(argv, function (err) {
|
||||||
t.ok(err, 'an error is raised')
|
expect(err).toBeTruthy()
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('a callback function is called after parsing', function (t) {
|
test('a callback function is called after parsing', function (done) {
|
||||||
t.plan(3)
|
expect.assertions(3)
|
||||||
|
|
||||||
const cli = require(cliPath)
|
const cli = require(cliPath)
|
||||||
const argv = ['example/file1.mermaid']
|
const argv = ['example/file1.mermaid']
|
||||||
|
|
||||||
cli.parse(argv, function (err, msg, opts) {
|
cli.parse(argv, function (err, msg, opts) {
|
||||||
t.ok(!err, 'no err')
|
expect(!err).toBeTruthy()
|
||||||
t.ok(true, 'callback was called')
|
expect(true).toBeTruthy()
|
||||||
t.deepEqual(argv, opts.files, 'options are as expected')
|
expect(argv).toEqual(opts.files)
|
||||||
|
|
||||||
t.end()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
|
/* eslint-env jest */
|
||||||
|
/* eslint-env jasmine */
|
||||||
const exec = require('child_process').exec
|
const exec = require('child_process').exec
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const test = require('tape')
|
|
||||||
const rimraf = require('rimraf')
|
const rimraf = require('rimraf')
|
||||||
|
|
||||||
const localSearchPath = './node_modules/.bin' + path.delimiter + process.env.PATH
|
const localSearchPath = './node_modules/.bin' + path.delimiter + process.env.PATH
|
||||||
@@ -36,107 +37,103 @@ function execCmd (cmd, verify) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyNoError (t) {
|
function verifyNoError (done) {
|
||||||
return function (error, stdout, stderr) {
|
return function (error, stdout, stderr) {
|
||||||
t.ok(!error, 'no error')
|
expect(!error).toBeTruthy()
|
||||||
t.notOk(stderr, 'no stderr')
|
expect(stderr).toBeFalsy()
|
||||||
t.end()
|
done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyError (t) {
|
function verifyError (done) {
|
||||||
return function (error, stdout, stderr) {
|
return function (error, stdout, stderr) {
|
||||||
t.ok(!error, 'no error')
|
expect(!error).toBeTruthy()
|
||||||
t.ok(stderr, 'should get stderr')
|
expect(stderr).toBeTruthy()
|
||||||
t.end()
|
done()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test('mermaid cli help', function (t) {
|
beforeEach(() => {
|
||||||
t.plan(2)
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 64000
|
||||||
|
})
|
||||||
|
|
||||||
|
test('mermaid cli help', function (done) {
|
||||||
|
expect.assertions(2)
|
||||||
const args = ['--help']
|
const args = ['--help']
|
||||||
execMermaid(args.join(' '), verifyNoError(t))
|
execMermaid(args.join(' '), verifyNoError(done))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('mermaid cli help', function (t) {
|
test('mermaid cli help', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--badopt']
|
const args = ['--badopt']
|
||||||
execMermaid(args.join(' '), verifyError(t))
|
execMermaid(args.join(' '), verifyError(done))
|
||||||
})
|
|
||||||
|
|
||||||
test.skip('sequence syntax error', function (t) {
|
|
||||||
t.plan(2)
|
|
||||||
const args = ['--svg',
|
|
||||||
testDir + 'sequence_err.mmd'
|
|
||||||
]
|
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
['', 'fo', 'tspan', 'old'].forEach(function (textPlacement) {
|
['', 'fo', 'tspan', 'old'].forEach(function (textPlacement) {
|
||||||
test('sequence svg text placement: ' + textPlacement, function (t) {
|
test('sequence svg text placement: ' + textPlacement, function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--svg',
|
const args = ['--svg',
|
||||||
'--outputDir=' + testDir,
|
'--outputDir=' + testDir,
|
||||||
'--outputSuffix=' + (textPlacement ? '_' + textPlacement : '') + '.actual',
|
'--outputSuffix=' + (textPlacement ? '_' + textPlacement : '') + '.actual',
|
||||||
textPlacement ? '--sequenceConfig=' + testDir + 'sequence_text_' + textPlacement + '.cfg' : '',
|
textPlacement ? '--sequenceConfig=' + testDir + 'sequence_text_' + textPlacement + '.cfg' : '',
|
||||||
testDir + 'sequence_text.mmd'
|
testDir + 'sequence_text.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(args.join(' '), verifyNoError(t))
|
execMermaid(args.join(' '), verifyNoError(done))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('sequence png', function (t) {
|
test('sequence png', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--png',
|
const args = ['--png',
|
||||||
testDir + 'sequence_text.mmd'
|
testDir + 'sequence_text.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(done))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('flowchart svg text', function (t) {
|
test('flowchart svg text', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--svg',
|
const args = ['--svg',
|
||||||
'--css=dist/mermaid.css',
|
'--css=dist/mermaid.css',
|
||||||
'--width=500',
|
'--width=500',
|
||||||
testDir + 'flowchart_text.mmd'
|
testDir + 'flowchart_text.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(done))
|
||||||
});
|
});
|
||||||
|
|
||||||
['svg', 'png'].forEach(function (format) {
|
['svg', 'png'].forEach(function (format) {
|
||||||
test('flowchart ' + format + 'text2', function (t) {
|
test('flowchart ' + format + 'text2', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--' + format,
|
const args = ['--' + format,
|
||||||
'--css=dist/mermaid.forest.css',
|
'--css=dist/mermaid.forest.css',
|
||||||
'--width=500',
|
'--width=500',
|
||||||
testDir + 'flowchart_text2.mmd'
|
testDir + 'flowchart_text2.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(done))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('gantt axis formatter svg', function (t) {
|
test('gantt axis formatter svg', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['--svg',
|
const args = ['--svg',
|
||||||
'--css=dist/mermaid.css',
|
'--css=dist/mermaid.css',
|
||||||
'--width=500',
|
'--width=500',
|
||||||
'--ganttConfig=' + testDir + 'gantt_axis_formatter.cfg',
|
'--ganttConfig=' + testDir + 'gantt_axis_formatter.cfg',
|
||||||
testDir + 'gantt_axis_formatter.mmd'
|
testDir + 'gantt_axis_formatter.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(done))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('gitgraph sample svg', function (t) {
|
test('gitgraph sample svg', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
const args = ['-s', '-v',
|
const args = ['-s', '-v',
|
||||||
'--width=500',
|
'--width=500',
|
||||||
testDir + 'gitgraph.mmd'
|
testDir + 'gitgraph.mmd'
|
||||||
]
|
]
|
||||||
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(t))
|
execMermaid(prependOutputArgs(args.join(' ')), verifyNoError(done))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('load sample.html in phantomjs and save screenshot png', function (t) {
|
test('load sample.html in phantomjs and save screenshot png', function (done) {
|
||||||
t.plan(2)
|
expect.assertions(2)
|
||||||
execPhantomjsToLoadHtmlSaveScreenshotPng(testDir + 'samples.html',
|
execPhantomjsToLoadHtmlSaveScreenshotPng(testDir + 'samples.html',
|
||||||
verifyNoError(t))
|
verifyNoError(done))
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user