Skip to content

Commit

Permalink
Removed Jasmine#addSpecFiles and Jasmine#addHelperFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sgravrock committed Oct 12, 2021
1 parent 4cd0f7d commit 28f9495
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 67 deletions.
33 changes: 0 additions & 33 deletions lib/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,39 +358,6 @@ Jasmine.prototype.addMatchingSpecFiles = addFiles('specFiles');
*/
Jasmine.prototype.addMatchingHelperFiles = addFiles('helperFiles');


// Deprecated synonyms for the above. These are confusingly named (addSpecFiles
// doesn't just do N of what addSpecFile does) but they've been around a long
// time and there might be quite a bit of code that uses them.

/**
* Synonym for {@link Jasmine#addMatchingSpecFiles}
* @function
* @name Jasmine#addSpecFiles
* @deprecated Use {@link Jasmine#addMatchingSpecFiles|addMatchingSpecFiles},
* {@link Jasmine#loadConfig|loadConfig}, or {@link Jasmine#loadConfigFile|loadConfigFile}
* instead.
*/
Jasmine.prototype.addSpecFiles = function(globs) {
this.env.deprecated('jasmine#addSpecFiles is deprecated. Use ' +
'jasmine#addMatchingSpecFiles instead.');
this.addMatchingSpecFiles(globs);
};

/**
* Synonym for {@link Jasmine#addMatchingHelperFiles}
* @name Jasmine#addHelperFiles
* @function
* @deprecated Use {@link Jasmine#addMatchingHelperFiles|addMatchingHelperFiles},
* {@link Jasmine#loadConfig|loadConfig}, or {@link Jasmine#loadConfigFile|loadConfigFile}
* instead.
*/
Jasmine.prototype.addHelperFiles = function(globs) {
this.env.deprecated('jasmine#addHelperFiles is deprecated. Use ' +
'jasmine#addMatchingHelperFiles instead.');
this.addMatchingHelperFiles(globs);
};

Jasmine.prototype.addRequires = function(requires) {
const jasmineRunner = this;
requires.forEach(function(r) {
Expand Down
35 changes: 1 addition & 34 deletions spec/jasmine_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,47 +82,14 @@ describe('Jasmine', function() {
});

describe('Methods that specify files via globs', function() {
describe('#addSpecFiles', function() {
beforeEach(function() {
this.testJasmine.env.deprecated = jasmine.createSpy('env.deprecated');
});

hasCommonFileGlobBehavior('addSpecFiles', 'specFiles');

it('issues a deprecation warning', function() {
this.testJasmine.addSpecFiles([]);
expect(this.testJasmine.env.deprecated).toHaveBeenCalledWith(
'jasmine#addSpecFiles is deprecated. Use ' +
'jasmine#addMatchingSpecFiles instead.'
);
});
});

describe('#addMatchingSpecFiles', function() {
hasCommonFileGlobBehavior('addMatchingSpecFiles', 'specFiles');
});

describe('#addHelperFiles', function() {
beforeEach(function() {
this.testJasmine.env.deprecated = jasmine.createSpy('env.deprecated');
});

hasCommonFileGlobBehavior('addHelperFiles', 'helperFiles');

it('issues a deprecation warning', function() {
this.testJasmine.addHelperFiles([]);
expect(this.testJasmine.env.deprecated).toHaveBeenCalledWith(
'jasmine#addHelperFiles is deprecated. Use ' +
'jasmine#addMatchingHelperFiles instead.'
);
});
});

describe('#addMatchingHelperFiles', function() {
hasCommonFileGlobBehavior('addMatchingHelperFiles', 'helperFiles');
});



function hasCommonFileGlobBehavior(method, destProp) {
it('adds a file with an absolute path', function() {
const aFile = path.join(this.testJasmine.projectBaseDir, this.testJasmine.specDir, 'spec/command_spec.js');
Expand Down

0 comments on commit 28f9495

Please sign in to comment.