Compare commits

...

11 Commits

Author SHA1 Message Date
Steve Gravrock
e4f8669835 Bump version to 4.6.1 2024-05-25 10:16:04 -07:00
Steve Gravrock
26be252e70 Removed unnecessary throw when building stack trace
Since 4.0, all supported JS runtimes populate the stack property of
Error objects when the Error is instantiated, not when it's thrown.
2024-05-25 10:00:26 -07:00
Steve Gravrock
2a1b7a04f7 Fix Chrome on CI 2024-05-25 10:00:26 -07:00
Steve Gravrock
4c8a4f2b00 Built distribution 2024-05-24 17:19:18 -07:00
angrycat9000
8bc95ae2e3 Skip parsing cause if it is not an Error object
* Merges #2013 from @angrycat9000
    * Fixes #2011
2024-05-24 17:18:35 -07:00
Steve Gravrock
80b9d6c2e0 CI: Use a globally-unique Sauce tunnel ID
CIRCLE_BUILD_NUM is only unique per-repo, and we have multiple repos
that can concurrently run Sauce builds.
2024-05-24 17:15:34 -07:00
Steve Gravrock
66ffb5f7a3 Accessibility: Always provide a non-color indication that a spec is pending 2024-05-24 17:15:26 -07:00
Steve Gravrock
225194c343 Accessibility: Improved contrast of version number and inactive tab links 2024-05-24 17:15:19 -07:00
Steve Gravrock
7a75cc7643 Updated copyright date 2024-05-24 17:15:06 -07:00
Steve Gravrock
ec7a9e2416 Fixed formatting of copyright notice in README 2024-05-24 17:14:48 -07:00
Steve Gravrock
7896ae84e6 Updated copyright notices
The Pivotal copyright notice needs to be retained. That's the right
thing to do and the MIT license requires it. However, using it by itself
becomes more obviously incorrect with each passing year since Pivotal
ceased to exist. Moreover, Pivotal hasn't actually been the sole
copyright owner since the first external contribution was merged.
Contributors were not asked to sign a copyright assignment, so they
retain copyright to their contributions.

"Copyright (c) 2008-2019 Pivotal Labs" complies with the terms of the
license and acknowledges Pivotal's outsized role in developing Jasmine.
"Copyright (c) 2008-$YEAR The Jasmine developers" acknowledges all
authors and will remain correct in the future.
2024-05-24 17:14:32 -07:00
18 changed files with 117 additions and 65 deletions

View File

@@ -80,7 +80,7 @@ jobs:
# cleanly if we kill it from a different step than it started in.
export PATH=$PATH:$HOME/workspace/bin
export SAUCE_TUNNEL_IDENTIFIER=$CIRCLE_BUILD_NUM
export SAUCE_TUNNEL_IDENTIFIER=$CIRCLE_WORKFLOW_JOB_ID
scripts/start-sauce-connect sauce-pidfile
set +o errexit
scripts/run-all-browsers

View File

@@ -1,4 +1,5 @@
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2023 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -58,4 +58,6 @@ To find out what environments work with a particular Jasmine release, see the [r
* [Christian Williams](mailto:antixian666@gmail.com)
* Sheel Choksi
Copyright (c) 2008-2022 Jasmine Maintainers. This software is licensed under the [MIT License](https://github.com/jasmine/jasmine/blob/main/MIT.LICENSE).
Copyright (c) 2008-2019 Pivotal Labs<br>
Copyright (c) 2008-2024 The Jasmine developers<br>
This software is licensed under the [MIT License](https://github.com/jasmine/jasmine/blob/main/LICENSE).

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-<%= currentYear %> Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-<%= currentYear %> The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-2023 Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2024 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-2023 Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2024 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-2023 Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2024 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -530,14 +531,13 @@ jasmineRequire.HtmlReporter = function(j$) {
if (noExpectations(resultNode.result)) {
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
}
if (
resultNode.result.status === 'pending' &&
resultNode.result.pendingReason !== ''
) {
specDescription =
specDescription +
' PENDING WITH MESSAGE: ' +
resultNode.result.pendingReason;
if (resultNode.result.status === 'pending') {
if (resultNode.result.pendingReason !== '') {
specDescription +=
' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
} else {
specDescription += ' PENDING';
}
}
specListNode.appendChild(
createDom(

View File

@@ -55,9 +55,6 @@ body {
position: fixed;
right: 100%;
}
.jasmine_html-reporter .jasmine-version {
color: #aaa;
}
.jasmine_html-reporter .jasmine-banner {
margin-top: 14px;
}
@@ -169,10 +166,11 @@ body {
}
.jasmine_html-reporter .jasmine-bar.jasmine-menu {
background-color: #fff;
color: #aaa;
color: #000;
}
.jasmine_html-reporter .jasmine-bar.jasmine-menu a {
color: #333;
color: blue;
text-decoration: underline;
}
.jasmine_html-reporter .jasmine-bar a {
color: white;

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-2023 Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2024 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -2644,11 +2645,7 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
} else if (options.stack) {
error = options;
} else {
try {
throw new Error(message());
} catch (e) {
error = e;
}
error = new Error(message());
}
}
// Omit the message from the stack trace because it will be
@@ -3524,7 +3521,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
lines.unshift(stackTrace.message);
}
if (error.cause) {
if (error.cause && error.cause instanceof Error) {
const substack = this.stack_(error.cause, {
messageHandling: 'require'
});
@@ -10484,5 +10481,5 @@ getJasmineRequireObj().UserContext = function(j$) {
};
getJasmineRequireObj().version = function() {
return '4.6.0';
return '4.6.1';
};

View File

@@ -1,5 +1,6 @@
/*
Copyright (c) 2008-2023 Pivotal Labs
Copyright (c) 2008-2019 Pivotal Labs
Copyright (c) 2008-2024 The Jasmine developers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,7 +1,7 @@
{
"name": "jasmine-core",
"license": "MIT",
"version": "4.6.0",
"version": "4.6.1",
"repository": {
"type": "git",
"url": "https://github.com/jasmine/jasmine.git"

View File

@@ -3,6 +3,7 @@
run_browser() {
browser=$1
version=$2
os="$3"
description="$browser $version"
if [ $version = "latest" ]; then
version=""
@@ -12,7 +13,7 @@ run_browser() {
echo
echo "Running $description"
echo
USE_SAUCE=true JASMINE_BROWSER=$browser SAUCE_BROWSER_VERSION=$version npm run ci
USE_SAUCE=true JASMINE_BROWSER=$browser SAUCE_BROWSER_VERSION=$version SAUCE_OS="$os" npm run ci
if [ $? -eq 0 ]; then
echo "PASS: $description" >> "$passfile"
@@ -23,7 +24,17 @@ run_browser() {
passfile=`mktemp -t jasmine-results.XXXXXX` || exit 1
failfile=`mktemp -t jasmine-results.XXXXXX` || exit 1
run_browser chrome latest
# As of 2023-09-30, Sauce Connect doesn't work with the latest Chrome version
# on the default Linux. Run on Mac OS instead. The OS specification may need to
# be updated or removed when new Chrome versions stop being available on Mac OS
# 12, although historically this has taken several major OS versions.
# See <https://saucelabs.com/products/supported-browsers-devices>.
# On Saucelabs, the test suite frequently runs ~30s slower on Mac OS than it
# does on Linux, so it's probably worth removing the OS specification once Sauce
# Connect works with Chrome latest on Linux again.
run_browser chrome latest "macOS 12"
run_browser firefox latest
run_browser firefox 102
run_browser firefox 91

View File

@@ -301,6 +301,26 @@ describe('ExceptionFormatter', function() {
.withContext('first root cause stack frame')
.toContain('ExceptionFormatterSpec.js');
});
it('does not throw if cause is a non Error', function() {
const formatter = new jasmineUnderTest.ExceptionFormatter();
expect(function() {
formatter.stack(
new Error('error', {
cause: function() {}
})
);
}).not.toThrowError();
expect(function() {
formatter.stack(
new Error('error', {
cause: 'another error'
})
);
}).not.toThrowError();
});
});
});
});

View File

@@ -1411,6 +1411,23 @@ describe('HtmlReporter', function() {
describe('and there are pending specs', function() {
let container, reporter;
function pendingSpecStatus() {
return {
id: 123,
description: 'with a spec',
fullName: 'A Suite with a spec',
status: 'pending',
passedExpectations: [],
failedExpectations: []
};
}
function reportWithSpecStatus(specStatus) {
reporter.specStarted(specStatus);
reporter.specDone(specStatus);
reporter.jasmineDone({});
}
beforeEach(function() {
container = document.createElement('div');
const getContainer = function() {
@@ -1429,21 +1446,10 @@ describe('HtmlReporter', function() {
reporter.initialize();
reporter.jasmineStarted({ totalSpecsDefined: 1 });
const specStatus = {
id: 123,
description: 'with a spec',
fullName: 'A Suite with a spec',
status: 'pending',
passedExpectations: [],
failedExpectations: [],
pendingReason: 'my custom pending reason'
};
reporter.specStarted(specStatus);
reporter.specDone(specStatus);
reporter.jasmineDone({});
});
it('reports the pending specs count', function() {
reportWithSpecStatus(pendingSpecStatus());
const alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
expect(alertBar.innerHTML).toMatch(
@@ -1452,17 +1458,36 @@ describe('HtmlReporter', function() {
});
it('reports no failure details', function() {
reportWithSpecStatus(pendingSpecStatus());
const specFailure = container.querySelector('.jasmine-failures');
expect(specFailure.childNodes.length).toEqual(0);
});
it('displays the custom pending reason', function() {
reportWithSpecStatus({
...pendingSpecStatus(),
pendingReason: 'my custom pending reason'
});
const pendingDetails = container.querySelector(
'.jasmine-summary .jasmine-pending'
);
expect(pendingDetails.innerHTML).toContain('my custom pending reason');
expect(pendingDetails.innerHTML).toContain(
'PENDING WITH MESSAGE: my custom pending reason'
);
});
it('indicates that the spec is pending even if there is no reason', function() {
reportWithSpecStatus({
...pendingSpecStatus(),
pendingReason: ''
});
const pendingDetails = container.querySelector(
'.jasmine-summary .jasmine-pending'
);
expect(pendingDetails.innerHTML).toContain('PENDING');
});
});

View File

@@ -67,7 +67,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
lines.unshift(stackTrace.message);
}
if (error.cause) {
if (error.cause && error.cause instanceof Error) {
const substack = this.stack_(error.cause, {
messageHandling: 'require'
});

View File

@@ -69,11 +69,7 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
} else if (options.stack) {
error = options;
} else {
try {
throw new Error(message());
} catch (e) {
error = e;
}
error = new Error(message());
}
}
// Omit the message from the stack trace because it will be

View File

@@ -498,14 +498,13 @@ jasmineRequire.HtmlReporter = function(j$) {
if (noExpectations(resultNode.result)) {
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
}
if (
resultNode.result.status === 'pending' &&
resultNode.result.pendingReason !== ''
) {
specDescription =
specDescription +
' PENDING WITH MESSAGE: ' +
resultNode.result.pendingReason;
if (resultNode.result.status === 'pending') {
if (resultNode.result.pendingReason !== '') {
specDescription +=
' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
} else {
specDescription += ' PENDING';
}
}
specListNode.appendChild(
createDom(

View File

@@ -3,11 +3,13 @@
$line-height: 14px;
$margin-unit: 14px;
$faint-text-color: #aaa;
$light-text-color: #666;
$text-color: #333;
$inactive-tab-text-color: blue;
$active-tab-text-color: #000;
$page-background-color: #eee;
$menu-background-color: #aaa;
$passing-color: #007069;
$failing-color: #ca3a11;
@@ -91,10 +93,6 @@ body {
right: 100%;
}
.jasmine-version {
color: $faint-text-color;
}
//--- Banner ---//
.jasmine-banner {
@@ -238,10 +236,11 @@ body {
&.jasmine-menu {
background-color: #fff;
color: $faint-text-color;
color: $active-tab-text-color;
a {
color: $text-color;
color: $inactive-tab-text-color;
text-decoration: underline;
}
}