mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Rules now get the Meteor root directory passed to them. They can use that information to extract further information about the file being linted based on its path in the project.
33 lines
903 B
JavaScript
33 lines
903 B
JavaScript
/* eslint-env mocha */
|
|
|
|
var assert = require('assert')
|
|
var path = require('path')
|
|
var rewire = require('rewire')
|
|
var getMeteorProjectRootPath = rewire('../../../dist/util/getMeteorProjectRootPath.js')
|
|
|
|
|
|
var isInMeteorProject
|
|
getMeteorProjectRootPath.__set__('pathExists', {
|
|
sync: function () {
|
|
return isInMeteorProject
|
|
}
|
|
})
|
|
|
|
|
|
describe('getMeteorProjectRootPath', function () {
|
|
it('returns false for top-level directory', function () {
|
|
assert.equal(getMeteorProjectRootPath(path.sep), false)
|
|
})
|
|
|
|
it('returns false when not in meteor project', function () {
|
|
isInMeteorProject = false
|
|
assert.equal(getMeteorProjectRootPath('/not-in-meteor/sub'), false)
|
|
})
|
|
|
|
it('returns the directory when in meteor project', function () {
|
|
isInMeteorProject = true
|
|
var meteorPath = '/Users/anon/meteor-project'
|
|
assert.equal(getMeteorProjectRootPath(meteorPath), meteorPath)
|
|
})
|
|
})
|