TypeError: Cannot read property 'measureText' of null
TypeError: Cannot read property 'measureText' of null
我在 angular 的 ag-grid jest 单元测试中遇到以下错误。知道是什么原因造成的吗?
TypeError: 无法读取 属性 'measureText' of null
23 | import { assign, get, isEmpty } from 'lodash';
24 | import {
> 25 | a4aGridTypes,
26 | abbreviated,
27 | AbbreviatedColumn,
28 | columnTypes,
at node_modules/ag-grid-enterprise/dist/lib/charts/canvas/hdpiCanvas.js:258:45
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/canvas/hdpiCanvas.js:264:2)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/scene/scene.js:4:20)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart/chart.js:4:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart/cartesianChart.js:17:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart.js:31:24)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chartingService.js:15:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/menu/menuItemMapper.js:16:25)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/menu/enterpriseMenu.js:29:24)
at Object.<anonymous> (node_modules/ag-grid-enterprise/main.js:5:24)
我正在关注 ag-grid 的文档:https://www.ag-grid.com/javascript-grid-testing-angular/
并使用以下版本:
"ag-grid-angular": "20.2.0",
"ag-grid-community": "20.2.0",
"ag-grid-enterprise": "20.2.0",
根据ag-grid V21.0.0的官方文档
在密钥下:AG-2869 已经解决了关于玩笑的问题。
AG-2869: Error is thrown when Importing ag-grid-enterprise when running jest
tests with ag-grid
只需升级到较新版本的 Ag-Grid 即可解决您当前的问题。
更新到以下版本的 ag-grid 库:
"ag-grid-angular": "21.0.0",
"ag-grid-community": "21.0.0",
"ag-grid-enterprise": "21.0.0",
我在 angular 的 ag-grid jest 单元测试中遇到以下错误。知道是什么原因造成的吗?
TypeError: 无法读取 属性 'measureText' of null
23 | import { assign, get, isEmpty } from 'lodash';
24 | import {
> 25 | a4aGridTypes,
26 | abbreviated,
27 | AbbreviatedColumn,
28 | columnTypes,
at node_modules/ag-grid-enterprise/dist/lib/charts/canvas/hdpiCanvas.js:258:45
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/canvas/hdpiCanvas.js:264:2)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/scene/scene.js:4:20)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart/chart.js:4:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart/cartesianChart.js:17:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chart.js:31:24)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/charts/chartingService.js:15:15)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/menu/menuItemMapper.js:16:25)
at Object.<anonymous> (node_modules/ag-grid-enterprise/dist/lib/menu/enterpriseMenu.js:29:24)
at Object.<anonymous> (node_modules/ag-grid-enterprise/main.js:5:24)
我正在关注 ag-grid 的文档:https://www.ag-grid.com/javascript-grid-testing-angular/ 并使用以下版本:
"ag-grid-angular": "20.2.0",
"ag-grid-community": "20.2.0",
"ag-grid-enterprise": "20.2.0",
根据ag-grid V21.0.0的官方文档 在密钥下:AG-2869 已经解决了关于玩笑的问题。
AG-2869: Error is thrown when Importing ag-grid-enterprise when running jest tests with ag-grid
只需升级到较新版本的 Ag-Grid 即可解决您当前的问题。
更新到以下版本的 ag-grid 库:
"ag-grid-angular": "21.0.0",
"ag-grid-community": "21.0.0",
"ag-grid-enterprise": "21.0.0",