test: crash mocha if unhandled errors occur (#11055)
This commit is contained in:
parent
c5f2d28b76
commit
28c1c2662a
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -175,6 +175,8 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
env:
|
env:
|
||||||
PUPPETEER_SKIP_DOWNLOAD: true
|
PUPPETEER_SKIP_DOWNLOAD: true
|
||||||
|
# Set up GitHub Actions caching for Wireit.
|
||||||
|
- uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1
|
||||||
- name: Build packages
|
- name: Build packages
|
||||||
run: npm run build --workspace @puppeteer-test/test
|
run: npm run build --workspace @puppeteer-test/test
|
||||||
- name: Setup cache for Chrome binary
|
- name: Setup cache for Chrome binary
|
||||||
@ -263,6 +265,8 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
env:
|
env:
|
||||||
PUPPETEER_SKIP_DOWNLOAD: true
|
PUPPETEER_SKIP_DOWNLOAD: true
|
||||||
|
# Set up GitHub Actions caching for Wireit.
|
||||||
|
- uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1
|
||||||
- name: Build packages
|
- name: Build packages
|
||||||
run: npm run build --workspace @puppeteer-test/test
|
run: npm run build --workspace @puppeteer-test/test
|
||||||
- name: Setup cache for Firefox binary
|
- name: Setup cache for Firefox binary
|
||||||
|
@ -27,4 +27,9 @@ module.exports = {
|
|||||||
parallel: !!process.env.PARALLEL,
|
parallel: !!process.env.PARALLEL,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
reporter: process.env.CI ? 'spec' : 'dot',
|
reporter: process.env.CI ? 'spec' : 'dot',
|
||||||
|
// This should make mocha crash on uncaught errors.
|
||||||
|
// See https://github.com/mochajs/mocha/blob/master/docs/index.md#--allow-uncaught.
|
||||||
|
allowUncaught: true,
|
||||||
|
// See https://github.com/mochajs/mocha/blob/master/docs/index.md#--async-only--a.
|
||||||
|
asyncOnly: true,
|
||||||
};
|
};
|
||||||
|
@ -690,7 +690,7 @@ describe('ElementHandle specs', function () {
|
|||||||
Puppeteer.customQueryHandlerNames();
|
Puppeteer.customQueryHandlerNames();
|
||||||
expect(handlerNamesAfterUnregistering.includes('getById')).toBeFalsy();
|
expect(handlerNamesAfterUnregistering.includes('getById')).toBeFalsy();
|
||||||
});
|
});
|
||||||
it('should throw with invalid query names', () => {
|
it('should throw with invalid query names', async () => {
|
||||||
try {
|
try {
|
||||||
Puppeteer.registerCustomQueryHandler('1/2/3', {
|
Puppeteer.registerCustomQueryHandler('1/2/3', {
|
||||||
queryOne: () => {
|
queryOne: () => {
|
||||||
|
@ -249,10 +249,6 @@ if (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('unhandledRejection', reason => {
|
|
||||||
throw reason;
|
|
||||||
});
|
|
||||||
|
|
||||||
const browserNotClosedError = new Error(
|
const browserNotClosedError = new Error(
|
||||||
'A manually launched browser was not closed!'
|
'A manually launched browser was not closed!'
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user