Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jasmine/jasmine-npm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 75eb8df42cf1112033b707550acbdd1601bd23ef
Choose a base ref
...
head repository: jasmine/jasmine-npm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 30843ab6a326b1579c7fa423a5e297d68b26fd81
Choose a head ref
  • 13 commits
  • 7 files changed
  • 1 contributor

Commits on May 12, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0488650 View commit details

Commits on Jun 21, 2021

  1. Copy the full SHA
    d8d5473 View commit details

Commits on Aug 28, 2021

  1. Copy the full SHA
    58ace2d View commit details
  2. Copy the full SHA
    a80b18e View commit details

Commits on Sep 4, 2021

  1. Copy the full SHA
    d506860 View commit details

Commits on Oct 8, 2021

  1. Copy the full SHA
    2a73958 View commit details
  2. Depend on -core 3.99

    sgravrock committed Oct 8, 2021
    Copy the full SHA
    68a6e7b View commit details

Commits on Oct 12, 2021

  1. Copy the full SHA
    e0505dd View commit details

Commits on Oct 13, 2021

  1. Copy the full SHA
    30e2eee View commit details

Commits on Oct 16, 2021

  1. Set version to 3.99.0-dev

    sgravrock committed Oct 16, 2021
    Copy the full SHA
    a7d18ff View commit details

Commits on Nov 27, 2021

  1. Copy the full SHA
    03ec293 View commit details

Commits on Dec 31, 2021

  1. Depend on -core main

    sgravrock committed Dec 31, 2021
    Copy the full SHA
    736d40d View commit details

Commits on Jan 1, 2022

  1. Bump version to 3.99.0

    sgravrock committed Jan 1, 2022
    Copy the full SHA
    30843ab View commit details
Showing with 125 additions and 24 deletions.
  1. +0 −2 Gruntfile.js
  2. +29 −5 lib/jasmine.js
  3. +2 −2 package.json
  4. +6 −0 release_notes/3.10.0.md
  5. +10 −0 release_notes/3.99.0.md
  6. +78 −1 spec/jasmine_spec.js
  7. +0 −14 tasks/jasmine.js
2 changes: 0 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -33,6 +33,4 @@ module.exports = function(grunt) {

runCommands(commands, done);
});

grunt.loadTasks('tasks');
};
34 changes: 29 additions & 5 deletions lib/jasmine.js
Original file line number Diff line number Diff line change
@@ -216,6 +216,12 @@ Jasmine.prototype.loadRequires = function() {
// TODO: In 4.0, switch to calling _loadFiles
// (requires making this function async)
this.requires.forEach(function(r) {
if (r.startsWith('./') || r.startsWith("../")) {
console.warn('DEPRECATION: requires with relative paths (in this case ' +
`${r}) are currently resolved relative to the jasmine/lib/jasmine ` +
'module but will be relative to the current working directory in ' +
'Jasmine 4.0.');
}
require(r);
});
};
@@ -294,6 +300,10 @@ Jasmine.prototype.loadConfig = function(config) {
envConfig.random = config.random;
}

if (config.verboseDeprecations !== undefined) {
envConfig.verboseDeprecations = config.verboseDeprecations;
}


/**
* Specifies how to load files with names ending in .js. Valid values are
@@ -326,7 +336,7 @@ Jasmine.prototype.loadConfig = function(config) {
* @type string[] | undefined
*/
if(config.helpers) {
this.addHelperFiles(config.helpers);
this.addMatchingHelperFiles(config.helpers);
}

/**
@@ -346,7 +356,7 @@ Jasmine.prototype.loadConfig = function(config) {
* @type string[] | undefined
*/
if(config.spec_files) {
this.addSpecFiles(config.spec_files);
this.addMatchingSpecFiles(config.spec_files);
}
};

@@ -382,7 +392,12 @@ Jasmine.prototype.addMatchingHelperFiles = addFiles('helperFiles');
* {@link Jasmine#loadConfig|loadConfig}, or {@link Jasmine#loadConfigFile|loadConfigFile}
* instead.
*/
Jasmine.prototype.addSpecFiles = Jasmine.prototype.addMatchingSpecFiles;
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
@@ -391,7 +406,11 @@ Jasmine.prototype.addSpecFiles = Jasmine.prototype.addMatchingSpecFiles;
* {@link Jasmine#loadConfig|loadConfig}, or {@link Jasmine#loadConfigFile|loadConfigFile}
* instead.
*/
Jasmine.prototype.addHelperFiles = Jasmine.prototype.addMatchingHelperFiles;
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;
@@ -452,6 +471,11 @@ function addFiles(kind) {
* @param {function} onCompleteCallback
*/
Jasmine.prototype.onComplete = function(onCompleteCallback) {
this.env.deprecated(
'Jasmine#onComplete is deprecated. Instead of calling onComplete, set ' +
"the Jasmine instance's exitOnCompletion property to false and use the " +
'promise returned from the execute method.'
);
this.completionReporter.onComplete(onCompleteCallback);
};

@@ -554,7 +578,7 @@ Jasmine.prototype.execute = async function(files, filterString) {
if (files && files.length > 0) {
this.specDir = '';
this.specFiles = [];
this.addSpecFiles(files);
this.addMatchingSpecFiles(files);
}

await this.loadSpecs();
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"bdd"
],
"license": "MIT",
"version": "3.10.0",
"version": "3.99.0",
"repository": {
"type": "git",
"url": "https://github.com/jasmine/jasmine-npm"
@@ -28,7 +28,7 @@
],
"dependencies": {
"glob": "^7.1.6",
"jasmine-core": "~3.10.0"
"jasmine-core": "~3.99.0"
},
"bin": "./bin/jasmine.js",
"main": "./lib/jasmine.js",
6 changes: 6 additions & 0 deletions release_notes/3.10.0.md
Original file line number Diff line number Diff line change
@@ -41,6 +41,12 @@ for more information.

* Test suite improvements

## Supported environments

The jasmine NPM package has been tested on Node 12, 14, and 16. See the
[jasmine-core release notes](https://github.com/jasmine/jasmine/blob/main/release_notes/3.10.0.md)
for supported browsers.

------

_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
10 changes: 10 additions & 0 deletions release_notes/3.99.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Jasmine NPM 3.99.0 Release Notes

This release adds deprecation warnings for breaking changes that will be
introduced in Jasmine 4.0. Please see the
[migration guide](https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0)
for more information.

------

_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
79 changes: 78 additions & 1 deletion spec/jasmine_spec.js
Original file line number Diff line number Diff line change
@@ -56,15 +56,39 @@ 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() {
@@ -297,6 +321,23 @@ describe('Jasmine', function() {
});
});

it('passes verboseDeprecations to jasmine-core when specified', function() {
this.configObject.verboseDeprecations = true;
this.fixtureJasmine.loadConfig(this.configObject);

expect(this.fixtureJasmine.env.configure).toHaveBeenCalledWith(
jasmine.objectContaining({verboseDeprecations: true})
);
});

it('does not pass verboseDeprecations to jasmine-core when not specified', function() {
this.configObject.random = true; // or set any other property
this.fixtureJasmine.loadConfig(this.configObject);

expect(this.fixtureJasmine.env.configure).toHaveBeenCalled();
expect(this.fixtureJasmine.env.configure.calls.argsFor(0)[0].verboseDeprecations)
.toBeUndefined();
});
describe('with jsLoader: "require"', function () {
it('tells the loader not to always import', async function() {
this.configObject.jsLoader = 'require';
@@ -331,13 +372,41 @@ describe('Jasmine', function() {
describe('with jsLoader undefined', function () {
it('tells the loader not to always import', async function() {
this.configObject.jsLoader = undefined;

this.fixtureJasmine.loadConfig(this.configObject);
await this.fixtureJasmine.loadSpecs();

expect(this.loader.load).toHaveBeenCalledWith(jasmine.any(String), false);
});
});

it('logs a deprecation when a require has a path beginning with ../', function() {
this.configObject.requires = ['../somefile.js'];
spyOn(console, 'warn');

this.fixtureJasmine.loadConfig(this.configObject);
expect(() => this.fixtureJasmine.loadRequires())
.toThrowError(/^Cannot find module '\.\.\/somefile.js'/);

expect(console.warn).toHaveBeenCalledWith('DEPRECATION: requires ' +
'with relative paths (in this case ../somefile.js) are currently ' +
'resolved relative to the jasmine/lib/jasmine module but will be ' +
'relative to the current working directory in Jasmine 4.0.');
});

it('logs a deprecation when a require has a path beginning with ./', function() {
this.configObject.requires = ['./somefile.js'];
spyOn(console, 'warn');

this.fixtureJasmine.loadConfig(this.configObject);
expect(() => this.fixtureJasmine.loadRequires())
.toThrowError(/^Cannot find module '\.\/somefile.js'/);

expect(console.warn).toHaveBeenCalledWith('DEPRECATION: requires ' +
'with relative paths (in this case ./somefile.js) are currently ' +
'resolved relative to the jasmine/lib/jasmine module but will be ' +
'relative to the current working directory in Jasmine 4.0.');
});
});

describe('from a file', function() {
@@ -411,9 +480,13 @@ describe('Jasmine', function() {
it('stores an onComplete function', function() {
const fakeOnCompleteCallback = function() {};
spyOn(this.testJasmine.completionReporter, 'onComplete');
this.testJasmine.env.deprecated = jasmine.createSpy('env.deprecated');

this.testJasmine.onComplete(fakeOnCompleteCallback);
expect(this.testJasmine.completionReporter.onComplete).toHaveBeenCalledWith(fakeOnCompleteCallback);
expect(this.testJasmine.env.deprecated).toHaveBeenCalledWith(
"Jasmine#onComplete is deprecated. Instead of calling onComplete, set the Jasmine instance's exitOnCompletion property to false and use the promise returned from the execute method."
);
});
});

@@ -590,6 +663,10 @@ describe('Jasmine', function() {
});

describe('When #onComplete has been called', function() {
beforeEach(function() {
this.testJasmine.env.deprecated = function() {};
});

it('calls the supplied completion handler with true when the whole suite is green', async function() {
const completionHandler = jasmine.createSpy('completionHandler');
this.testJasmine.onComplete(completionHandler);
14 changes: 0 additions & 14 deletions tasks/jasmine.js

This file was deleted.