You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAIL blocks/layout-grid/src/__tests__/migrations.js
● Test suite failed to run
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
Consider using the "jsdom" test environment.
ReferenceError: window is not defined
at Object.<anonymous> (node_modules/@wordpress/jest-preset-default/scripts/setup-globals.js:2:14)
Seems that apart from upgrading the package @wordpress/scripts, we'd need to update the Jest configuration and upgrade other packages. So far, I tried the following updates but none seemed to work:
FAIL blocks/layout-grid/src/__tests__/migrations.js
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/Users/<local-path>/block-experiments/node_modules/uuid/dist/esm-browser/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
2 | * WordPress dependencies
3 | */
> 4 | import { parse, serialize, rawHandler } from '@wordpress/blocks';
| ^
5 | import { registerCoreBlocks } from '@wordpress/block-library';
6 |
7 | /**
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
at Object.<anonymous> (node_modules/@wordpress/blocks/build/api/@wordpress/blocks/src/api/factory.js:4:1)
at Object.<anonymous> (node_modules/@wordpress/blocks/build/api/@wordpress/blocks/src/api/utils.js:20:1)
at Object.<anonymous> (node_modules/@wordpress/blocks/build/store/@wordpress/blocks/src/store/reducer.js:15:1)
at Object.<anonymous> (node_modules/@wordpress/blocks/build/store/@wordpress/blocks/src/store/index.js:9:1)
at Object.<anonymous> (node_modules/@wordpress/blocks/build/@wordpress/blocks/src/index.js:11:1)
at Object.require (blocks/layout-grid/src/__tests__/migrations.js:4:1)
FAIL blocks/layout-grid/src/__tests__/migrations.js
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/Users/fluiddot/workspace/gutenberg-mobile/block-experiments/node_modules/@wordpress/block-library/node_modules/is-plain-obj/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export default function isPlainObject(value) {
^^^^^^
SyntaxError: Unexpected token 'export'
3 | */
4 | import { parse, serialize, rawHandler } from '@wordpress/blocks';
> 5 | import { registerCoreBlocks } from '@wordpress/block-library';
| ^
6 |
7 | /**
8 | * Internal dependencies
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
at Object.<anonymous> (node_modules/@wordpress/block-library/node_modules/@wordpress/data/build/plugins/persistence/@wordpress/data/src/plugins/persistence/index.js:4:1)
at Object.<anonymous> (node_modules/@wordpress/block-library/node_modules/@wordpress/data/build/plugins/@wordpress/data/src/plugins/index.js:1:1)
at Object.<anonymous> (node_modules/@wordpress/block-library/node_modules/@wordpress/data/build/@wordpress/data/src/index.js:10:1)
at Object.<anonymous> (node_modules/@wordpress/block-library/node_modules/@wordpress/blocks/build/store/@wordpress/blocks/src/store/index.js:4:1)
at Object.<anonymous> (node_modules/@wordpress/block-library/node_modules/@wordpress/blocks/build/@wordpress/blocks/src/index.js:11:1)
at Object.<anonymous> (node_modules/@wordpress/block-library/build/@wordpress/block-library/src/index.js:4:1)
at Object.require (blocks/layout-grid/src/__tests__/migrations.js:5:1)
FAIL blocks/layout-grid/src/__tests__/invalidations.js
● Test suite failed to run
Cannot find module 'react-resize-aware' from 'node_modules/@wordpress/block-editor/node_modules/@wordpress/compose/build/hooks/use-resize-observer/index.js'
Require stack:
node_modules/@wordpress/block-editor/node_modules/@wordpress/compose/build/hooks/use-resize-observer/index.js
node_modules/@wordpress/block-editor/node_modules/@wordpress/compose/build/index.js
node_modules/@wordpress/block-editor/build/hooks/align.js
node_modules/@wordpress/block-editor/build/hooks/index.js
node_modules/@wordpress/block-editor/build/index.js
blocks/layout-grid/src/grid/edit.js
blocks/layout-grid/src/index.js
blocks/layout-grid/src/__tests__/invalidations.js
9 | */
10 |
> 11 | import {
| ^
12 | InnerBlocks,
13 | InspectorControls,
14 | BlockControls,
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (node_modules/@wordpress/block-editor/node_modules/@wordpress/compose/build/hooks/use-resize-observer/@wordpress/compose/src/hooks/use-resize-observer/index.js:4:1)
at Object.<anonymous> (node_modules/@wordpress/block-editor/node_modules/@wordpress/compose/build/@wordpress/compose/src/index.js:32:1)
at Object.<anonymous> (node_modules/@wordpress/block-editor/build/hooks/@wordpress/block-editor/src/hooks/align.js:10:1)
at Object.<anonymous> (node_modules/@wordpress/block-editor/build/hooks/@wordpress/block-editor/src/hooks/index.js:5:1)
at Object.<anonymous> (node_modules/@wordpress/block-editor/build/@wordpress/block-editor/src/index.js:4:1)
at Object.require (blocks/layout-grid/src/grid/edit.js:11:1)
at Object.require (blocks/layout-grid/src/index.js:12:1)
at Object.require (blocks/layout-grid/src/__tests__/invalidations.js:9:1)
The text was updated successfully, but these errors were encountered:
We tried to upgrade node to version 20 in #340, however, the effort got blocked due to failures in Jest (#340 (comment)).
Steps to reproduce it:
update/node-20
(Update node to version 20 #340)yarn jest
Seems that apart from upgrading the package
@wordpress/scripts
, we'd need to update the Jest configuration and upgrade other packages. So far, I tried the following updates but none seemed to work:1 - Use
jsdom
as the test environmentyarn jest
Error:
2 - Issue with package
uuid
Error:
The text was updated successfully, but these errors were encountered: