Merge branch '3.99' into 4.0

This commit is contained in:
Steve Gravrock
2021-05-18 17:12:29 -07:00
15 changed files with 470 additions and 155 deletions

View File

@@ -7,6 +7,10 @@ orbs:
node: circleci/node@3.0.0 node: circleci/node@3.0.0
executors: executors:
node16:
docker:
- image: cimg/node:16.1.0-browsers
working_directory: ~/workspace
node14: node14:
docker: docker:
- image: circleci/node:14 - image: circleci/node:14
@@ -61,8 +65,10 @@ jobs:
environment: environment:
JASMINE_LONG_PROPERTY_TESTS: y JASMINE_LONG_PROPERTY_TESTS: y
test_browsers: test_browsers: &test_browsers
executor: node14 executor: node14
environment:
SKIP_JASMINE_BROWSER_FLAKES: "true"
steps: steps:
- attach_workspace: - attach_workspace:
at: . at: .
@@ -91,14 +97,16 @@ jobs:
scripts/stop-sauce-connect $(cat sauce-pidfile) scripts/stop-sauce-connect $(cat sauce-pidfile)
exit $exitcode exit $exitcode
test_browser_flakes:
<<: *test_browsers
environment:
SKIP_JASMINE_BROWSER_FLAKES: "false"
workflows: workflows:
version: 2 version: 2
cron: cron:
triggers: triggers:
- schedule: - schedule:
# The choice of hour is somewhat load-bearing. test_browser currently
# tends to fail if there are other Sauce tunnels open. So we only
# run it at a time when that's unlikely.
# Times are UTC. # Times are UTC.
cron: "0 10 * * *" cron: "0 10 * * *"
filters: filters:
@@ -108,6 +116,9 @@ workflows:
- "3.99" - "3.99"
- "4.0" - "4.0"
jobs: jobs:
- build:
executor: node16
name: build_node_16
- build: - build:
executor: node14 executor: node14
name: build_node_14 name: build_node_14
@@ -117,6 +128,11 @@ workflows:
- build: - build:
executor: node10 executor: node10
name: build_node_10 name: build_node_10
- test_node:
executor: node16
name: test_node_16
requires:
- build_node_16
- test_node_with_long_property_tests: - test_node_with_long_property_tests:
executor: node14 executor: node14
requires: requires:
@@ -137,8 +153,12 @@ workflows:
filters: filters:
branches: branches:
ignore: /pull\/.*/ # Don't run on pull requests. ignore: /pull\/.*/ # Don't run on pull requests.
push: push:
jobs: jobs:
- build:
executor: node16
name: build_node_16
- build: - build:
executor: node14 executor: node14
name: build_node_14 name: build_node_14
@@ -148,6 +168,11 @@ workflows:
- build: - build:
executor: node10 executor: node10
name: build_node_10 name: build_node_10
- test_node:
executor: node16
name: test_node_16
requires:
- build_node_16
- test_node: - test_node:
executor: node14 executor: node14
name: test_node_14 name: test_node_14
@@ -169,3 +194,23 @@ workflows:
filters: filters:
branches: branches:
ignore: /pull\/.*/ # Don't run on pull requests. ignore: /pull\/.*/ # Don't run on pull requests.
browser-flakes:
triggers:
- schedule:
# Times are UTC.
cron: "0 11 * * *"
filters:
branches:
only:
- main
jobs:
- build:
executor: node14
name: build_node_14
- test_browser_flakes:
requires:
- build_node_14
filters:
branches:
ignore: /pull\/.*/ # Don't run on pull requests.

View File

@@ -20,12 +20,12 @@ Please read the [contributors' guide](https://github.com/jasmine/jasmine/blob/ma
For the Jasmine NPM module:<br> For the Jasmine NPM module:<br>
[https://github.com/jasmine/jasmine-npm](https://github.com/jasmine/jasmine-npm). [https://github.com/jasmine/jasmine-npm](https://github.com/jasmine/jasmine-npm).
For the Jasmine browser runner:<br>
[https://github.com/jasmine/jasmine-browser](https://github.com/jasmine/jasmine-browser).
For the Jasmine Ruby Gem:<br> For the Jasmine Ruby Gem:<br>
[https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem). [https://github.com/jasmine/jasmine-gem](https://github.com/jasmine/jasmine-gem).
For the Jasmine Python Egg:<br>
[https://github.com/jasmine/jasmine-py](https://github.com/jasmine/jasmine-py).
For the Jasmine headless browser gulp plugin:<br> For the Jasmine headless browser gulp plugin:<br>
[https://github.com/jasmine/gulp-jasmine-browser](https://github.com/jasmine/gulp-jasmine-browser). [https://github.com/jasmine/gulp-jasmine-browser](https://github.com/jasmine/gulp-jasmine-browser).
@@ -54,7 +54,7 @@ Jasmine tests itself across many browsers (Safari, Chrome, Firefox, Microsoft Ed
| Environment | Supported versions | | Environment | Supported versions |
|-------------------|--------------------| |-------------------|--------------------|
| Node | 10, 12, 14 | | Node | 10, 12, 14, 16 |
| Safari | 9-14 | | Safari | 9-14 |
| Chrome | Evergreen | | Chrome | Evergreen |
| Firefox | Evergreen, 68, 78 | | Firefox | Evergreen, 68, 78 |

View File

@@ -59,6 +59,7 @@ Install [twine](https://github.com/pypa/twine)
### Release the core NPM module ### Release the core NPM module
1. Run the tests on Windows. (CI only tests on Linux.)
1. `npm adduser` to save your credentials locally 1. `npm adduser` to save your credentials locally
1. `npm publish .` to publish what's in `package.json` 1. `npm publish .` to publish what's in `package.json`

View File

@@ -1,9 +1,8 @@
const sass = require('node-sass'); const sass = require('sass');
module.exports = { module.exports = {
options: { options: {
implementation: sass, implementation: sass,
outputStyle: 'compact',
sourceComments: false sourceComments: false
}, },
dist: { dist: {

View File

@@ -1,4 +1,33 @@
import pkg_resources import pkg_resources
import os
if 'SUPPRESS_JASMINE_DEPRECATION' not in os.environ:
print('DEPRECATION WARNING:\n' +
'\n' +
'The Jasmine packages for Python are deprecated. There will be no further\n' +
'releases after the end of the Jasmine 3.x series. We recommend migrating to the\n' +
'following options:\n' +
'\n' +
'* jasmine-browser-runner (<https://github.com/jasmine/jasmine-browser>,\n' +
' `npm install jasmine-browser-runner`) to run specs in browsers, including\n' +
' headless Chrome and Saucelabs. This is the most direct replacement for the\n' +
' jasmine server` and `jasmine ci` commands provided by the `jasmine` Python\n' +
' package.\n' +
'* The jasmine npm package (<https://github.com/jasmine/jasmine-npm>,\n' +
' `npm install jasmine`) to run specs under Node.js.\n' +
'* The standalone distribution from the latest Jasmine release\n' +
' <https://github.com/jasmine/jasmine/releases> to run specs in browsers with\n' +
' no additional tools.\n' +
'* The jasmine-core npm package (`npm install jasmine-core`) if all you need is\n' +
' the Jasmine assets. This is the direct equivalent of the jasmine-core Python\n' +
' package.\n' +
'\n' +
'Except for the standalone distribution, all of the above are distributed through\n' +
'npm.\n' +
'\n' +
'To prevent this message from appearing, set the SUPPRESS_JASMINE_DEPRECATION\n' +
'environment variable.\n')
try: try:
from collections import OrderedDict from collections import OrderedDict

File diff suppressed because one or more lines are too long

View File

@@ -3525,7 +3525,29 @@ getJasmineRequireObj().Expectation = function(j$) {
}); });
/** /**
* Asynchronous matchers. * Asynchronous matchers that operate on an actual value which is a promise,
* and return a promise.
*
* Note: Specs must await the result of each async matcher, return the
* promise returned by the matcher, or return a promise that's derived from
* the one returned by the matcher. Otherwise the matcher will not be
* evaluated before the spec completes.
*
* @example
* // Good
* await expectAsync(aPromise).toBeResolved();
* @example
* // Good
* return expectAsync(aPromise).toBeResolved();
* @example
* // Good
* return expectAsync(aPromise).toBeResolved()
* .then(function() {
* // more spec code
* });
* @example
* // Bad
* expectAsync(aPromise).toBeResolved();
* @namespace async-matchers * @namespace async-matchers
*/ */
function AsyncExpectation(options) { function AsyncExpectation(options) {
@@ -8018,6 +8040,7 @@ getJasmineRequireObj().Spy = function(j$) {
* @property {object} object - `this` context for the invocation. * @property {object} object - `this` context for the invocation.
* @property {number} invocationOrder - Order of the invocation. * @property {number} invocationOrder - Order of the invocation.
* @property {Array} args - The arguments passed for this invocation. * @property {Array} args - The arguments passed for this invocation.
* @property returnValue - The value that was returned from this invocation.
*/ */
var callData = { var callData = {
object: context, object: context,

View File

@@ -26,11 +26,9 @@
"homepage": "https://jasmine.github.io", "homepage": "https://jasmine.github.io",
"main": "./lib/jasmine-core.js", "main": "./lib/jasmine-core.js",
"devDependencies": { "devDependencies": {
"acorn": "^6.0.0",
"ejs": "^2.5.5", "ejs": "^2.5.5",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-plugin-compat": "^3.8.0", "eslint-plugin-compat": "^3.8.0",
"express": "^4.16.4",
"fast-check": "^1.21.0", "fast-check": "^1.21.0",
"fast-glob": "^2.2.6", "fast-glob": "^2.2.6",
"grunt": "^1.0.4", "grunt": "^1.0.4",
@@ -43,9 +41,8 @@
"jasmine-browser-runner": "github:jasmine/jasmine-browser#main", "jasmine-browser-runner": "github:jasmine/jasmine-browser#main",
"jsdom": "^15.0.0", "jsdom": "^15.0.0",
"load-grunt-tasks": "^4.0.0", "load-grunt-tasks": "^4.0.0",
"node-sass": "^4.11.0",
"prettier": "1.17.1", "prettier": "1.17.1",
"selenium-webdriver": "^3.6.0", "sass": "^1.32.12",
"shelljs": "^0.8.3", "shelljs": "^0.8.3",
"temp": "^0.9.0" "temp": "^0.9.0"
}, },

View File

@@ -24,16 +24,14 @@ run_browser() {
passfile=`mktemp -t jasmine-results.XXXXXX` || exit 1 passfile=`mktemp -t jasmine-results.XXXXXX` || exit 1
failfile=`mktemp -t jasmine-results.XXXXXX` || exit 1 failfile=`mktemp -t jasmine-results.XXXXXX` || exit 1
run_browser "internet explorer" 11 run_browser "internet explorer" 11
run_browser chrome latest
run_browser firefox latest run_browser firefox latest
run_browser firefox 78 run_browser firefox 78
run_browser firefox 68 run_browser firefox 68
run_browser safari 14 run_browser safari 14
run_browser safari 13 run_browser safari 13
run_browser safari 12 run_browser safari 9
run_browser safari 11 run_browser MicrosoftEdge latest
run_browser safari 10
run_browser safari 9
run_browser MicrosoftEdge latest
echo echo
cat "$passfile" "$failfile" cat "$passfile" "$failfile"

View File

@@ -4,15 +4,41 @@ import json
with open('package.json') as packageFile: with open('package.json') as packageFile:
version = json.load(packageFile)['version'] version = json.load(packageFile)['version']
short_description=('Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on '+
'browsers, DOM, or any JavaScript framework. Thus it\'s suited for websites, '+
'Node.js (http://nodejs.org) projects, or anywhere that JavaScript can run.')
deprecation=('The Jasmine packages for Python are deprecated. There will be no further\n' +
'releases after the end of the Jasmine 3.x series. We recommend migrating to the\n' +
'following options:\n' +
'\n' +
'* jasmine-browser-runner (<https://github.com/jasmine/jasmine-browser>,\n' +
' `npm install jasmine-browser-runner`) to run specs in browsers, including\n' +
' headless Chrome and Saucelabs. This is the most direct replacement for the\n' +
' jasmine server` and `jasmine ci` commands provided by the `jasmine` Python\n' +
' package.\n' +
'* The jasmine npm package (<https://github.com/jasmine/jasmine-npm>,\n' +
' `npm install jasmine`) to run specs under Node.js.\n' +
'* The standalone distribution from the latest Jasmine release\n' +
' <https://github.com/jasmine/jasmine/releases> to run specs in browsers with\n' +
' no additional tools.\n' +
'* The jasmine-core npm package (`npm install jasmine-core`) if all you need is\n' +
' the Jasmine assets. This is the direct equivalent of the jasmine-core Python\n' +
' package.\n' +
'\n' +
'Except for the standalone distribution, all of the above are distributed through\n'
'npm.\n')
long_description = short_description + '\n\n' + deprecation
setup( setup(
name="jasmine-core", name="jasmine-core",
version=version, version=version,
url="http://jasmine.github.io", url="http://jasmine.github.io",
author="Pivotal Labs", author="Pivotal Labs",
author_email="jasmine-js@googlegroups.com", author_email="jasmine-js@googlegroups.com",
description=('Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on '+ description=short_description,
'browsers, DOM, or any JavaScript framework. Thus it\'s suited for websites, '+ long_description=long_description,
'Node.js (http://nodejs.org) projects, or anywhere that JavaScript can run.'), long_description_content_type='text/plain',
license='MIT', license='MIT',
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',

View File

@@ -459,6 +459,10 @@ describe('Env integration', function() {
}); });
it('copes with async failures after done has been called', function(done) { it('copes with async failures after done has been called', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
var global = { var global = {
setTimeout: function(fn, delay) { setTimeout: function(fn, delay) {
setTimeout(fn, delay); setTimeout(fn, delay);
@@ -656,8 +660,8 @@ describe('Env integration', function() {
}); });
env.execute(null, function() { env.execute(null, function() {
// Expect >= 9 rather than >= 10 to compensate for clock imprecision // Expect > 0 to compensate for clock imprecision
expect(duration).toBeGreaterThanOrEqual(9); expect(duration).toBeGreaterThan(0);
done(); done();
}); });
}); });
@@ -1007,6 +1011,10 @@ describe('Env integration', function() {
}); });
it('Mock clock can be installed and used in tests', function(done) { it('Mock clock can be installed and used in tests', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
var globalSetTimeout = jasmine var globalSetTimeout = jasmine
.createSpy('globalSetTimeout') .createSpy('globalSetTimeout')
.and.callFake(function(cb, t) { .and.callFake(function(cb, t) {
@@ -1147,6 +1155,10 @@ describe('Env integration', function() {
}); });
it('should not use the mock clock for asynchronous timeouts', function(done) { it('should not use the mock clock for asynchronous timeouts', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
createMockedEnv(); createMockedEnv();
var reporter = jasmine.createSpyObj('fakeReporter', ['specDone']), var reporter = jasmine.createSpyObj('fakeReporter', ['specDone']),
clock = env.clock; clock = env.clock;
@@ -1185,6 +1197,10 @@ describe('Env integration', function() {
}); });
it('should wait a custom interval before reporting async functions that fail to complete', function(done) { it('should wait a custom interval before reporting async functions that fail to complete', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
createMockedEnv(); createMockedEnv();
var reporter = jasmine.createSpyObj('fakeReport', [ var reporter = jasmine.createSpyObj('fakeReport', [
'jasmineDone', 'jasmineDone',
@@ -2823,6 +2839,10 @@ describe('Env integration', function() {
}); });
it('provides custom equality testers to async matchers', function(done) { it('provides custom equality testers to async matchers', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
jasmine.getEnv().requirePromises(); jasmine.getEnv().requirePromises();
var specDone = jasmine.createSpy('specDone'); var specDone = jasmine.createSpy('specDone');

View File

@@ -0,0 +1,7 @@
(function(env) {
env.skipBrowserFlake = function() {
pending(
'Skipping specs that are known to be flaky in browsers in this run'
);
};
})(jasmine.getEnv());

View File

@@ -47,3 +47,7 @@ module.exports = {
} }
} }
}; };
if (process.env.SKIP_JASMINE_BROWSER_FLAKES === 'true') {
module.exports.helpers.push('helpers/disableBrowserFlakes.js');
}

View File

@@ -43,7 +43,29 @@ getJasmineRequireObj().Expectation = function(j$) {
}); });
/** /**
* Asynchronous matchers. * Asynchronous matchers that operate on an actual value which is a promise,
* and return a promise.
*
* Note: Specs must await the result of each async matcher, return the
* promise returned by the matcher, or return a promise that's derived from
* the one returned by the matcher. Otherwise the matcher will not be
* evaluated before the spec completes.
*
* @example
* // Good
* await expectAsync(aPromise).toBeResolved();
* @example
* // Good
* return expectAsync(aPromise).toBeResolved();
* @example
* // Good
* return expectAsync(aPromise).toBeResolved()
* .then(function() {
* // more spec code
* });
* @example
* // Bad
* expectAsync(aPromise).toBeResolved();
* @namespace async-matchers * @namespace async-matchers
*/ */
function AsyncExpectation(options) { function AsyncExpectation(options) {

View File

@@ -44,6 +44,7 @@ getJasmineRequireObj().Spy = function(j$) {
* @property {object} object - `this` context for the invocation. * @property {object} object - `this` context for the invocation.
* @property {number} invocationOrder - Order of the invocation. * @property {number} invocationOrder - Order of the invocation.
* @property {Array} args - The arguments passed for this invocation. * @property {Array} args - The arguments passed for this invocation.
* @property returnValue - The value that was returned from this invocation.
*/ */
var callData = { var callData = {
object: context, object: context,