UNPKG

1.14 kBJavaScriptView Raw
1/* global describe, it, afterEach */
2
3require('chai').should()
4
5var NYC = require('../'),
6 path = require('path')
7
8describe('nyc', function () {
9 describe('cwd', function () {
10 afterEach(function () {
11 delete process.env.NYC_CWD
12 })
13
14 it('sets cwd to process.cwd() if no environment variable set', function () {
15 var nyc = new NYC()
16
17 nyc.cwd.should.eql(process.cwd())
18 })
19
20 it('uses NYC_CWD environment variable for cwd if it is set', function () {
21 process.env.NYC_CWD = path.resolve(__dirname, './fixtures')
22
23 var nyc = new NYC()
24
25 nyc.cwd.should.match(/nyc\/test\/fixtures/)
26 })
27 })
28
29 describe('exclude', function () {
30 it('loads exclude patterns from package.json in cwd', function () {
31 var nyc = new NYC()
32
33 nyc.exclude.length.should.eql(1)
34 })
35 })
36
37 /*describe('wrapSpawn', function () {
38
39 })*/
40
41 describe('wrapRequire', function () {
42 it('uses istanbul to wrap modules when required', function () {
43 (new NYC()).wrapRequire()
44
45 var A = require('./fixtures/a')
46 A.should.match(/__cov_/)
47 })
48 })
49
50 describe('report', function () {
51 })
52})