Skip to content

Commit

Permalink
Merge branch 'master' into jsdoc-titlepath
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg authored Dec 2, 2023
2 parents 525c2e4 + b41e985 commit 01d4c27
Show file tree
Hide file tree
Showing 38 changed files with 7,782 additions and 10,417 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'run-browser-test')
steps:
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions/checkout@v2
node-version: lts/*
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '~/.npm'
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v16-
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
Expand All @@ -33,7 +32,7 @@ jobs:
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'
- name: remove 'run-browser-test' label
uses: buildsville/add-remove-label@v1
uses: buildsville/add-remove-label@v2.0.0
if: ${{ always() }}
with:
token: ${{secrets.GITHUB_TOKEN}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/delete-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
inputs:
days:
description: 'Number of days'
type: number
required: true
default: 180

Expand Down
94 changes: 69 additions & 25 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ jobs:
- name: Check event pull_request
if: github.event_name == 'pull_request'
run: 'echo pull_request: run workflow'
- uses: actions/checkout@v2
- uses: actions/checkout@v4
if: github.event_name == 'push'
with:
persist-credentials: false
- name: Check event push
id: findPr
if: github.event_name == 'push'
Expand All @@ -45,9 +47,12 @@ jobs:
- 14
- 16
- 18
- 20
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node }}'
- run: npm install --production
Expand All @@ -58,17 +63,17 @@ jobs:
runs-on: ubuntu-latest
needs: smoke
steps:
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions/checkout@v2
node-version: lts/*
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '~/.npm'
key: "ubuntu-latest-node-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-v16-
key: "ubuntu-latest-node-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: 'Check lint'
Expand All @@ -89,28 +94,29 @@ jobs:
- 14
- 16
- 18
- 20
include:
- os: ubuntu-latest
node: 16
env:
COVERAGE: 1
steps:
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get npm cache directory in Windows
id: npm-cache
if: ${{ matrix.os == 'windows-2019' }}
run: |
echo "::set-output name=dir::$(npm config get cache)"
echo "dir=$(npm config get cache)" >> $env:GITHUB_OUTPUT
- name: 'Cache node_modules'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }}
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: Install Annotation Support
Expand All @@ -131,31 +137,69 @@ jobs:
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'

test-browser:
name: 'Browser Tests'
test-browser-local:
name: Browser Test [ChromeHeadless]
needs: smoke
runs-on: ubuntu-latest
timeout-minutes: 20
# Don't run forked 'pull_request' without saucelabs token
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
steps:
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
BROWSER: ChromeHeadless

test-browser-saucelabs:
name: Browser Tests on SauceLabs [${{ matrix.browser }}]
needs:
- smoke
- test-browser-local
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
browser:
- firefox@latest
- chrome@latest
- MicrosoftEdge@latest
- safari@latest
# Don't run forked 'pull_request' without saucelabs token
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
with:
node-version: 16
- uses: actions/checkout@v2
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v16-
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
BROWSER: ${{ matrix.browser }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly-site-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Webhook Action
uses: joelwmale/webhook-action@1.0.0
uses: joelwmale/webhook-action@2.3.2
env:
data: ''
WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }}
25 changes: 0 additions & 25 deletions .github/workflows/stale.yml

This file was deleted.

7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,12 @@ Mattias Norlander <[email protected]>
CommanderRoot <[email protected]>
Elihu Cruz <[email protected]>
Sukka <[email protected]>
Darius Dzien <[email protected]>
Yeting Li <[email protected]>
Greggman <[email protected]>
Josh Goldberg <[email protected]>
Kleis Auke Wolthuizen <[email protected]>
Paulo Gonçalves <[email protected]>
Anton Usmansky <[email protected]>

# Generated by scripts/update-authors.js
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# 10.2.0 / 2022-12-11

## :tada: Enhancements

- [#4945](https://github.com/mochajs/mocha/issues/4945): API: add possibility to decorate ESM name before import ([**@j0tunn**](https://github.com/j0tunn))

## :bug: Fixes

- [#4946](https://github.com/mochajs/mocha/issues/4946): Browser: color of failed test icon ([**@kleisauke**](https://github.com/kleisauke))

## :book: Documentation

- [#4944](https://github.com/mochajs/mocha/issues/4944): Remove duplicated header ([**@PauloGoncalvesBH**](https://github.com/PauloGoncalvesBH))

# 10.1.0 / 2022-10-16

## :tada: Enhancements

- [#4896](https://github.com/mochajs/mocha/issues/4896): Browser: add support for `prefers-color-scheme: dark` ([**@greggman**](https://github.com/greggman))

## :nut\_and\_bolt: Other

- [#4912](https://github.com/mochajs/mocha/issues/4912): Browser: increase contrast for replay buttons ([**@JoshuaKGoldberg**](https://github.com/JoshuaKGoldberg))
- [#4905](https://github.com/mochajs/mocha/issues/4905): Use standard `Promise.allSettled` instead of polyfill ([**@outsideris**](https://github.com/outsideris))
- [#4899](https://github.com/mochajs/mocha/issues/4899): Upgrade official GitHub actions to latest ([**@ddzz**](https://github.com/ddzz))
- [#4770](https://github.com/mochajs/mocha/issues/4770): Fix regex in function `clean`([**@yetingli**](https://github.com/yetingli))

# 10.0.0 / 2022-05-01

## :boom: Breaking Changes
Expand Down
2 changes: 0 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,6 @@ It can however make the output harder to interpret when comparing large strings.

A value of 0 indicates no limit, default is 8192 characters.

## Command-Line Usage

### `--full-trace`

Enable "full" stack traces. By default, Mocha attempts to distill stack traces into less noisy (though still useful) output.
Expand Down
17 changes: 15 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const rollupPlugin = require('./scripts/karma-rollup-plugin');
const BASE_BUNDLE_DIR_PATH = path.join(__dirname, '.karma');
const env = process.env;
const hostname = os.hostname();
const BROWSER = env.BROWSER;

const SAUCE_BROWSER_PLATFORM_MAP = {
'chrome@latest': 'Windows 10',
Expand Down Expand Up @@ -120,6 +121,13 @@ module.exports = config => {
files: [...cfg.files, {pattern: './mocha.js.map', included: false}]
};

if (BROWSER) {
cfg = {
...cfg,
browsers: [BROWSER]
};
}

config.set(cfg);
};

Expand Down Expand Up @@ -171,7 +179,7 @@ const addSauceTests = (cfg, sauceLabs) => {
const customLaunchers = sauceBrowsers.reduce((acc, sauceBrowser) => {
const platformName = SAUCE_BROWSER_PLATFORM_MAP[sauceBrowser];
const [browserName, browserVersion] = sauceBrowser.split('@');
return {
const result = {
...acc,
[sauceBrowser]: {
base: 'SauceLabs',
Expand All @@ -181,9 +189,13 @@ const addSauceTests = (cfg, sauceLabs) => {
'sauce:options': sauceLabs
}
};
if (browserName === 'firefox') {
result[sauceBrowser]['sauce:options']['moz:debuggerAddress'] = true;
}
return result;
}, {});

return {
const result = {
...cfg,
reporters: [...cfg.reporters, 'saucelabs'],
browsers: [...cfg.browsers, ...sauceBrowsers],
Expand All @@ -197,6 +209,7 @@ const addSauceTests = (cfg, sauceLabs) => {
captureTimeout: 120000,
browserNoActivityTimeout: 20000
};
return result;
}
return {...cfg};
};
Expand Down
19 changes: 17 additions & 2 deletions lib/browser/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ Progress.prototype.update = function (n) {
*/
Progress.prototype.draw = function (ctx) {
try {
var darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
var isDarkMode = !!darkMatcher.matches;
var lightColors = {
outerCircle: '#9f9f9f',
innerCircle: '#eee',
text: '#000'
};
var darkColors = {
outerCircle: '#888',
innerCircle: '#444',
text: '#fff'
};
var colors = isDarkMode ? darkColors : lightColors;

var percent = Math.min(this.percent, 100);
var size = this._size;
var half = size / 2;
Expand All @@ -100,13 +114,13 @@ Progress.prototype.draw = function (ctx) {
ctx.clearRect(0, 0, size, size);

// outer circle
ctx.strokeStyle = '#9f9f9f';
ctx.strokeStyle = colors.outerCircle;
ctx.beginPath();
ctx.arc(x, y, rad, 0, angle, false);
ctx.stroke();

// inner circle
ctx.strokeStyle = '#eee';
ctx.strokeStyle = colors.innerCircle;
ctx.beginPath();
ctx.arc(x, y, rad - 1, 0, angle, true);
ctx.stroke();
Expand All @@ -115,6 +129,7 @@ Progress.prototype.draw = function (ctx) {
var text = this._text || (percent | 0) + '%';
var w = ctx.measureText(text).width;

ctx.fillStyle = colors.text;
ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
} catch (ignore) {
// don't fail if we can't render progress
Expand Down
Loading

0 comments on commit 01d4c27

Please sign in to comment.