|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -var fs = require('fs'), |
4 |
| - path = require('path'), |
5 |
| - exec = require('child_process').exec, |
6 |
| - expect = require('chai').expect, |
7 |
| - jsoncovToLcov = require('../lib/json2lcov'); |
8 |
| - |
9 |
| -describe('json2lcov-cli', function(){ |
10 |
| - |
11 |
| - var expectLcovContent = ''; |
12 |
| - |
13 |
| - beforeEach(function(done){ |
14 |
| - fs.readFile( path.resolve('./test/fixtures/fixture.lcov'), function (error, content) { |
15 |
| - expectLcovContent = content.toString(); |
16 |
| - done(); |
| 3 | +const fs = require('fs'); |
| 4 | +const path = require('path'); |
| 5 | +const exec = require('child_process').exec; |
| 6 | +const jsoncovToLcov = require('../lib/json2lcov'); |
| 7 | + |
| 8 | +describe('json2lcov-cli', function() { |
| 9 | + beforeEach(function() { |
| 10 | + return readFile('./test/fixtures/fixture.lcov').then((content) => { |
| 11 | + this.lcov = content.toString(); |
17 | 12 | });
|
18 | 13 | });
|
19 | 14 |
|
20 |
| - it('converted into lcov from json-cov', function(done){ |
| 15 | + it('converted into lcov from json-cov', function(done) { |
| 16 | + const fixtureFile = path.resolve('./test/fixtures/fixture.json'); |
21 | 17 |
|
22 |
| - var fixtureFile = path.resolve('./test/fixtures/fixture.json'); |
23 |
| - |
24 |
| - exec('cat ' + fixtureFile + ' | ./bin/json2lcov.js', function (error, stdout, stderr) { |
25 |
| - expect(stdout.toString()).to.equals(expectLcovContent); |
| 18 | + exec('cat ' + fixtureFile + ' | ./bin/json2lcov.js', (error, stdout, stderr) => { |
| 19 | + assert.equal(stdout.toString(), this.lcov); |
26 | 20 | done();
|
27 | 21 | });
|
28 |
| - |
29 | 22 | });
|
30 |
| - |
31 | 23 | });
|
0 commit comments