1 | var assert = require("assert");
|
2 | var fs = require('fs')
|
3 | var Formatter = require('../formatter.js');
|
4 | var CiInfo = require('../ci_info');
|
5 |
|
6 | describe('JSON', function(){
|
7 |
|
8 | var lcovFixture = fs.readFileSync('test/fixtures/lcov.info').toString();
|
9 | var formatter = new Formatter({rootDirectory: "/Users/noah/p/request"});
|
10 |
|
11 | describe('parse', function() {
|
12 | it("should return the correct filenames", function(done) {
|
13 | formatter.format(lcovFixture, function(err, data) {
|
14 | var names = data.source_files.map(function(elem) {
|
15 | return elem.name;
|
16 | });
|
17 | expected = ["lib/cookies.js", "lib/copy.js"]
|
18 | assert.deepEqual(expected, names);
|
19 | done();
|
20 | });
|
21 | });
|
22 | });
|
23 | });
|
24 |
|
25 | describe('ci_info', function() {
|
26 | describe('#getInfo', function() {
|
27 | var bupenv = Object.keys(process.env);
|
28 |
|
29 | beforeEach(function(){
|
30 | delete process.env['TRAVIS'];
|
31 | });
|
32 |
|
33 | afterEach(function(){
|
34 | for(var pk in process.env) {
|
35 | if (bupenv.indexOf(pk) < 0) {
|
36 | delete process.env[pk];
|
37 | }
|
38 | }
|
39 | });
|
40 |
|
41 | it('should return travis-ci as name if process.env.TRAVIS is set', function() {
|
42 | process.env.TRAVIS = 'true';
|
43 |
|
44 | var ci = CiInfo.getInfo();
|
45 | assert.equal(ci.name, 'travis-ci');
|
46 | });
|
47 |
|
48 | it('should return appveyor as name if process.env.APPVEYOR is set', function() {
|
49 | process.env.APPVEYOR = 'true';
|
50 |
|
51 | var ci = CiInfo.getInfo();
|
52 | assert.equal(ci.name, 'appveyor');
|
53 | });
|
54 |
|
55 | it('should return buildkite as name if process.env.BUILDKITE is set', function() {
|
56 | process.env.BUILDKITE = 'true';
|
57 |
|
58 | var ci = CiInfo.getInfo();
|
59 | assert.equal(ci.name, 'buildkite');
|
60 | });
|
61 |
|
62 | });
|
63 | }); |
\ | No newline at end of file |