Component: PrimeNG TAble
Describe the bug
While running tests into my application i got the following error:
...
ReferenceError: Cannot access 'ColumnFilter' before initialization
....
import {TableModule} from "primeng/table";
....
at Object.<anonymous> (node_modules/primeng/fesm2020/primeng-table.mjs:4023:176)
at Object.<anonymous> (src/app/app.module.ts:23:1)
at Object.<anonymous> (src/app/app.component.spec.ts:8:1)
....
traced down the error in primeng-table.mjs
and the error was the class ColumnFilter was initiated after the call for it in the following line:
ColumnFilterFormElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ColumnFilterFormElement, deps: [{ token: Table }, { token: ColumnFilter }], target: i0.ɵɵFactoryTarget.Component });
simply moving the class ColumnFilter 1 line before 4023 fixed the issue and everything worked.
Environment
Linux Jest tests.
Reproducer
No response
Angular version
14.0.1
PrimeNG version
14.1.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
17.8.0
Browser(s)
CLI
Steps to reproduce the behavior
- import {TableModule} from "primeng/table";
- run npm test:ci which is Jest
Expected behavior
I expect that the problem is solved
We're seeing the same error running PrimeNG 14.1.0, Angular 14.2.1 on Node 16.17.0
● Test suite failed to run
ReferenceError: Cannot access 'ColumnFilter' before initialization
7 | import { DropdownModule } from 'primeng/dropdown';
8 | import { ProgressBarModule } from 'primeng/progressbar';
> 9 | import { TableModule } from 'primeng/table';
| ^
10 | import { ToolbarModule } from 'primeng/toolbar';
11 | import { SharedModule as ACSharedModule } from '../../shared/shared.module';
12 | import { PermissionsConfigurationComponent } from './permissions-configuration.component';
at Object.<anonymous> (node_modules/primeng/fesm2020/primeng-table.mjs:4023:176)
Same here. This error was introduced with version v14.1.0, two days ago
Getting the same, error. Reverting until fix is released.
Any new news?
I have the same problem. So @yamennassif, like you, when I moved ColumnFilter on top of the line for fesm2015 it was ok. you think it's a packager problem?
@mo0om It is introduced cyclomatic dependency problem, not packager
thank you @Delagen
The problem stil occurs on PrimeNG v14.1.2
I was hoping to use primeng in a new project but I have the same error with ColumFilter when running tests.
Tests are working with Karma, but not with Jest
Angular version 14.2.0
PrimeNG version 14.1.2
As a workaround, modify primeng-table.mjs is ok
Will you fix this problem in a next version ? Thanks for your work !
This issue is not resolved getting the same error with jest on version 14.1.2.
Work around for jest users. Revert to version 14.0.1 and primeicons 5.0.0
This issue is not resolved getting the same error with jest on version 14.1.2.
Work around for jest users. Revert to version 14.0.1 and primeicons 5.0.0
Nobody said this. The fix is merged 2 days ago and v14.1.2 was released 22days ago. so it could never be fixed in that release 😉
Is there any idea when the next release is going to be ?
Hello guys, Any idea if this issue is going to be resolved anytime soon? Many thanks!
We've encountered the same problem; upgrading to 14.2.3fixed it, it was released on 2022-12-14. I believe, this issue can be closed.