Skip to content

Commit

Permalink
Allow to add files with absolute path
Browse files Browse the repository at this point in the history
requires nodejs >= 0.12
  • Loading branch information
Martin R. Hufsky committed Mar 12, 2016
1 parent 07181a4 commit eed0eed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/jasmine.js
Expand Up @@ -120,7 +120,10 @@ function addFiles(kind) {
var fileArr = this[kind];

files.forEach(function(file) {
var filePaths = glob.sync(path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file));
if(!(path.isAbsolute && path.isAbsolute(file))) {
file = path.join(jasmineRunner.projectBaseDir, jasmineRunner.specDir, file);
}
var filePaths = glob.sync(file);
filePaths.forEach(function(filePath) {
if(fileArr.indexOf(filePath) === -1) {
fileArr.push(filePath);
Expand Down
8 changes: 8 additions & 0 deletions spec/jasmine_spec.js
Expand Up @@ -43,6 +43,14 @@ describe('Jasmine', function() {
describe('file handler', function() {
function basename(name) { return path.basename(name); }

it('add spec files with absolute glob pattern', function() {
if (!path.isAbsolute) { return; }
var aFile = path.join(this.testJasmine.projectBaseDir, this.testJasmine.specDir, 'spec/command_spec.js');
expect(this.testJasmine.specFiles).toEqual([]);
this.testJasmine.addSpecFiles([aFile]);
expect(this.testJasmine.specFiles).toEqual([aFile]);
});

it('add spec files with glob pattern', function() {
expect(this.testJasmine.specFiles).toEqual([]);
this.testJasmine.addSpecFiles(['spec/*.js']);
Expand Down

0 comments on commit eed0eed

Please sign in to comment.