diff --git a/.travis.yml b/.travis.yml index e0052b7..c23ad1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,5 @@ after_success: npm run coverage node_js: - "4" - - "node" - -# mock-fs breaks the test-suite in Node 0.10, -# we circument this by skipping mock-fs related -# tests. This hack is also required which prevents -# mocha from loading mock-fs in files it instruments. -matrix: - include: - - node_js: "0.10" - env: FS_MOCK=./package.json + - "6" + - "stable" diff --git a/README.md b/README.md index dbbdf2d..fa8cd61 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # babel-plugin-istanbul -[![Build Status](https://travis-ci.org/istanbuljs/babel-plugin-istanbul.svg)](https://travis-ci.org/istanbuljs/babel-plugin-istanbul) +[![Build Status](https://travis-ci.org/istanbuljs/babel-plugin-istanbul.svg?branch=master)](https://travis-ci.org/istanbuljs/babel-plugin-istanbul) [![Coverage Status](https://coveralls.io/repos/github/istanbuljs/babel-plugin-istanbul/badge.svg?branch=master)](https://coveralls.io/github/istanbuljs/babel-plugin-istanbul?branch=master) [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) diff --git a/package.json b/package.json index f4faeae..1889dba 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lib" ], "dependencies": { - "find-up": "^1.1.2", + "find-up": "^2.1.0", "istanbul-lib-instrument": "^1.4.2", "object-assign": "^4.1.0", "test-exclude": "^4.0.0" @@ -20,9 +20,8 @@ "babel-preset-es2015": "^6.18.0", "chai": "^3.5.0", "coveralls": "^2.11.15", - "cross-env": "^2.0.1", + "cross-env": "^3.1.4", "mocha": "^3.2.0", - "mock-fs": "^3.12.1", "nyc": "^10.0.0", "pmock": "^0.2.3", "standard": "^8.6.0", @@ -32,7 +31,7 @@ "coverage": "nyc report --reporter=text-lcov | coveralls", "release": "babel src --out-dir lib", "pretest": "standard && npm run release", - "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha --require=${FS_MOCK:-mock-fs} test/*.js", + "test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.js", "prepublish": "npm test && npm run release", "version": "standard-version" }, diff --git a/test/babel-plugin-istanbul.js b/test/babel-plugin-istanbul.js index b700851..91408e3 100644 --- a/test/babel-plugin-istanbul.js +++ b/test/babel-plugin-istanbul.js @@ -1,8 +1,6 @@ /* eslint-env mocha */ const babel = require('babel-core') -import mockProcess from 'pmock' -import fs from 'fs' import makeVisitor from '../src' require('chai').should() @@ -89,83 +87,6 @@ describe('babel-plugin-istanbul', function () { }) }) - // Regression tests for https://github.com/istanbuljs/babel-plugin-istanbul/issues/7 - if (!/^v0\.10/.test(process.version)) { // mock-fs does not work on Node 0.10. - const mockFs = require('mock-fs') - context('when current path uses a symlink', function () { - beforeEach(function () { - mockFs({ - '/project': { - 'fixtures': { - 'should-cover.js': fs.readFileSync('./fixtures/should-cover.js') - }, - 'package.json': fs.readFileSync('./package.json') - }, - '/symlink': mockFs.symlink({path: '/project'}) - }) - }) - - const shouldInstrument = file => { - var result = babel.transformFileSync(file, { - plugins: [ - makeVisitor({types: babel.types}) - ] - }) - result.code.should.match(/statementMap/) - } - - context('and NYC_CWD is set', function () { - var env - - beforeEach(function () { - env = mockProcess.env({ - NYC_CWD: '/symlink' - }) - }) - - it('should instrument file accessed via link', function () { - shouldInstrument('/symlink/fixtures/should-cover.js') - }) - - it('should instrument file accessed via real path', function () { - shouldInstrument('/project/fixtures/should-cover.js') - }) - - afterEach(function () { - env.reset() - }) - }) - - context('and only process.cwd() is set', function () { - var env, cwd - - beforeEach(function () { - env = mockProcess.env({ - NYC_CWD: '' - }) - cwd = mockProcess.cwd(fs.realpathSync('/symlink')) // realpath because of mock-fs Windows quirk re: process.cwd - }) - - it('should instrument file accessed via link', function () { - shouldInstrument('/symlink/fixtures/should-cover.js') - }) - - it('should instrument file accessed via real path', function () { - shouldInstrument('/project/fixtures/should-cover.js') - }) - - afterEach(function () { - env.reset() - cwd.reset() - }) - }) - - afterEach(function () { - mockFs.restore() - }) - }) - } - // TODO: setup istanbul-lib-instrument, such that we can // run various babel configurations. context('regression tests', () => {