Skip to content

Commit

Permalink
Plugin: Avoid calling deprecated gutenberg_silence_rest_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 23, 2019
1 parent 0259f7b commit f909853
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 15 deletions.
4 changes: 4 additions & 0 deletions bin/install-wordpress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ if [ "$CURRENT_URL" != "http://localhost:$HOST_PORT" ]; then
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI option update siteurl "http://localhost:$HOST_PORT" --quiet
fi

# Configure site constants.
echo -e $(status_message "Configuring site constants...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI config set WP_DEBUG true --quiet

# Activate Gutenberg.
echo -e $(status_message "Activating Gutenberg...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI plugin activate gutenberg --quiet
Expand Down
4 changes: 0 additions & 4 deletions gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ function gutenberg_pre_init() {

require_once dirname( __FILE__ ) . '/lib/load.php';

if ( function_exists( 'gutenberg_silence_rest_errors' ) ) {
gutenberg_silence_rest_errors();
}

add_filter( 'replace_editor', 'gutenberg_init', 10, 2 );
}

Expand Down
42 changes: 32 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/e2e-test-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export { installPlugin } from './install-plugin';
export { isCurrentURL } from './is-current-url';
export { loginUser } from './login-user';
export { observeFocusLoss } from './observe-focus-loss';
export { observePageWarnings } from './observe-page-warnings';
export { openDocumentSettingsSidebar } from './open-document-settings-sidebar';
export { openPublishPanel } from './open-publish-panel';
export { pressKeyTimes } from './press-key-times';
Expand Down
15 changes: 15 additions & 0 deletions packages/e2e-test-utils/src/observe-page-warnings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Binds to the document on page load which throws an error if any warnings had
* been logged to the page. This assumes both that the server is configured to
* display warnings, and that the warnings would be output to the page before
* the `<!doctype>`.
*/
export function observePageWarnings() {
page.on( 'load', async () => {
const hasDoctype = await page.evaluate( () => !! document.doctype );

if ( ! hasDoctype ) {
throw new Error( 'Unexpected page warnings' );
}
} );
}
2 changes: 2 additions & 0 deletions packages/e2e-tests/config/setup-test-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '@wordpress/jest-console';
import {
clearLocalStorage,
enablePageDialogAccept,
observePageWarnings,
setBrowserViewport,
visitAdminPage,
} from '@wordpress/e2e-test-utils';
Expand Down Expand Up @@ -151,6 +152,7 @@ beforeAll( async () => {
capturePageEventsForTearDown();
enablePageDialogAccept();
observeConsoleLogging();
observePageWarnings();

await trashExistingPosts();
await setupBrowser();
Expand Down
4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Added support for `build` script ([#12837](https://github.com/WordPress/gutenberg/pull/12837))
- Added support for `start` script ([#12837](https://github.com/WordPress/gutenberg/pull/12837))

### Internal

- Update `puppeteer` dependency from 1.6.1 to 1.11.0 ([#13446](https://github.com/WordPress/gutenberg/pull/13446))

## 2.5.0 (2019-01-09)

### New Features
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"jest": "^23.6.0",
"jest-puppeteer": "3.2.1",
"npm-package-json-lint": "^3.3.1",
"puppeteer": "1.6.1",
"puppeteer": "1.11.0",
"read-pkg-up": "^1.0.1",
"resolve-bin": "^0.4.0",
"stylelint": "^9.10.1",
Expand Down

0 comments on commit f909853

Please sign in to comment.