Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ changes to start using the library right away.
<td>v7.x</td>
<td>v8.x</td>
<td>v9.x</td>
<td>v10.x</td>
</tr>

<tr>
Expand All @@ -121,6 +122,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -134,6 +136,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -147,6 +150,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -160,6 +164,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -173,6 +178,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -186,6 +192,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -199,6 +206,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -212,6 +220,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -225,6 +234,7 @@ changes to start using the library right away.
<td></td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -238,6 +248,7 @@ changes to start using the library right away.
<td>✓</td>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -251,6 +262,7 @@ changes to start using the library right away.
<td></td>
<td>✓</td>
<td></td>
<td></td>
</tr>

<tr>
Expand All @@ -264,6 +276,21 @@ changes to start using the library right away.
<td></td>
<td></td>
<td>✓</td>
<td></td>
</tr>

<tr>
<td>21</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>✓</td>
</tr>

</tbody></table>
Expand Down
20 changes: 19 additions & 1 deletion apps/ng2-charts-demo/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const esModules = ['lodash-es'].join('|');
const esModules = ['lodash-es', 'marked', 'ngx-markdown'].join('|');
export default {
displayName: 'ng2-charts',
preset: '../../jest.preset.js',
Expand All @@ -17,6 +17,24 @@ export default {
transformIgnorePatterns: [`node_modules/(?!.*\\.mjs$|${esModules})`],
moduleNameMapper: {
'.*\\.txt': 'jest-raw-loader',
'^@angular/core/testing$':
'<rootDir>/../../node_modules/@angular/core/fesm2022/testing.mjs',
'^@angular/common/testing$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/testing.mjs',
'^@angular/common/http$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/http.mjs',
'^@angular/common/http/testing$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/http-testing.mjs',
'^@angular/platform-browser/testing$':
'<rootDir>/../../node_modules/@angular/platform-browser/fesm2022/testing.mjs',
'^@angular/platform-browser/animations$':
'<rootDir>/../../node_modules/@angular/platform-browser/fesm2022/animations.mjs',
'^@angular/router$':
'<rootDir>/../../node_modules/@angular/router/fesm2022/router.mjs',
'^@angular/router/testing$':
'<rootDir>/../../node_modules/@angular/router/fesm2022/testing.mjs',
'^@angular/material/(.+)$':
'<rootDir>/../../node_modules/@angular/material/fesm2022/$1.mjs',
},
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
Expand Down
8 changes: 6 additions & 2 deletions apps/ng2-charts-demo/src/main.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { bootstrapApplication } from '@angular/platform-browser';
import {
bootstrapApplication,
BootstrapContext,
} from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { config } from './app/app.config.server';

const bootstrap = () => bootstrapApplication(AppComponent, config);
const bootstrap = (context: BootstrapContext) =>
bootstrapApplication(AppComponent, config, context);

export default bootstrap;
13 changes: 5 additions & 8 deletions apps/ng2-charts-demo/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ global.ResizeObserver = jest.fn().mockImplementation(() => ({
disconnect: jest.fn(),
}));

// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
setupZoneTestEnv({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
});
import 'jest-canvas-mock';
52 changes: 50 additions & 2 deletions apps/ng2-charts-demo/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,56 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
"module": "ES2022",
"types": ["jest", "node"],
"paths": {
"@angular/core/testing": [
"node_modules/@angular/core/types/testing.d.ts"
],
"@angular/common/testing": [
"node_modules/@angular/common/types/testing.d.ts"
],
"@angular/common/http": ["node_modules/@angular/common/types/http.d.ts"],
"@angular/common/http/testing": [
"node_modules/@angular/common/types/http-testing.d.ts"
],
"@angular/platform-browser/testing": [
"node_modules/@angular/platform-browser/types/testing.d.ts"
],
"@angular/platform-browser/animations": [
"node_modules/@angular/platform-browser/types/animations.d.ts"
],
"@angular/router": ["node_modules/@angular/router/types/router.d.ts"],
"@angular/router/testing": [
"node_modules/@angular/router/types/testing.d.ts"
],
"@angular/material/button": [
"node_modules/@angular/material/types/button.d.ts"
],
"@angular/material/card": [
"node_modules/@angular/material/types/card.d.ts"
],
"@angular/material/tabs": [
"node_modules/@angular/material/types/tabs.d.ts"
],
"@angular/material/divider": [
"node_modules/@angular/material/types/divider.d.ts"
],
"@angular/material/toolbar": [
"node_modules/@angular/material/types/toolbar.d.ts"
],
"@angular/material/slide-toggle": [
"node_modules/@angular/material/types/slide-toggle.d.ts"
],
"@angular/material/menu": [
"node_modules/@angular/material/types/menu.d.ts"
],
"@angular/material/icon": [
"node_modules/@angular/material/types/icon.d.ts"
],
"ng2-charts": ["libs/ng2-charts/src/index.ts"],
"ng2-charts-schematics": ["libs/ng2-charts-schematics/src/index.ts"]
}
},
"files": ["src/test-setup.ts"],
"include": [
Expand Down
1 change: 1 addition & 0 deletions libs/ng2-charts-schematics/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default {
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
transformIgnorePatterns: [],
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/ng2-charts-schematics',
};
3 changes: 2 additions & 1 deletion libs/ng2-charts-schematics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"moduleResolution": "node"
},
"references": [
{
Expand Down
14 changes: 14 additions & 0 deletions libs/ng2-charts/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@ export default {
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
moduleNameMapper: {
'^@angular/core/testing$':
'<rootDir>/../../node_modules/@angular/core/fesm2022/testing.mjs',
'^@angular/common/testing$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/testing.mjs',
'^@angular/common/http$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/http.mjs',
'^@angular/common/http/testing$':
'<rootDir>/../../node_modules/@angular/common/fesm2022/http-testing.mjs',
'^@angular/platform-browser/testing$':
'<rootDir>/../../node_modules/@angular/platform-browser/fesm2022/testing.mjs',
'^@angular/platform-browser/animations$':
'<rootDir>/../../node_modules/@angular/platform-browser/fesm2022/animations.mjs',
},
};
10 changes: 5 additions & 5 deletions libs/ng2-charts/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "9.0.2",
"version": "10.0.0",
"name": "ng2-charts",
"description": "Reactive, responsive, beautiful charts for Angular based on Chart.js",
"peerDependencies": {
"@angular/platform-browser": ">=20.0.0",
"@angular/common": ">=20.0.0",
"@angular/core": ">=20.0.0",
"@angular/cdk": ">=20.0.0",
"@angular/platform-browser": ">=21.0.0",
"@angular/common": ">=21.0.0",
"@angular/core": ">=21.0.0",
"@angular/cdk": ">=21.0.0",
"chart.js": "^3.4.0 || ^4.0.0",
"rxjs": "^6.5.3 || ^7.4.0"
},
Expand Down
13 changes: 5 additions & 8 deletions libs/ng2-charts/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { Chart } from 'chart.js';
// @ts-expect-error TS2339: Property 'Chart' does not exist on type 'Window & typeof globalThis'.
window.Chart = Chart;

// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
setupZoneTestEnv({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
});
import 'jest-canvas-mock';

window.ResizeObserver =
Expand Down
24 changes: 22 additions & 2 deletions libs/ng2-charts/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,28 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
"module": "ES2022",
"types": ["jest", "node"],
"paths": {
"@angular/core/testing": [
"node_modules/@angular/core/types/testing.d.ts"
],
"@angular/common/testing": [
"node_modules/@angular/common/types/testing.d.ts"
],
"@angular/common/http": ["node_modules/@angular/common/types/http.d.ts"],
"@angular/common/http/testing": [
"node_modules/@angular/common/types/http-testing.d.ts"
],
"@angular/platform-browser/testing": [
"node_modules/@angular/platform-browser/types/testing.d.ts"
],
"@angular/platform-browser/animations": [
"node_modules/@angular/platform-browser/types/animations.d.ts"
],
"ng2-charts": ["libs/ng2-charts/src/index.ts"],
"ng2-charts-schematics": ["libs/ng2-charts-schematics/src/index.ts"]
}
},
"files": ["src/test-setup.ts"],
"include": [
Expand Down
Loading
Loading