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
28 changes: 13 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean installation of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: build

on:
Expand All @@ -11,26 +8,27 @@ on:

jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x, 22.x]

env:
CI: true

steps:
- uses: actions/checkout@0717577d45739eb3c851188b29f50ed6c0b2194e # v2.8.0
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1.4.6
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: ${{ matrix.node-version }}
- run: npm audit
continue-on-error: true
cache: 'npm'
- run: npm ci
- run: npm outdated
- run: npm audit
continue-on-error: true
- run: npm run build --if-present
- run: npm run lint
- run: npm test
env:
CI: true
- run: npm run build
- run: npm run test:typecheck
- run: npx playwright install --with-deps chromium
- run: npm run test:coverage
49 changes: 0 additions & 49 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

24 changes: 18 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ permissions:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
environment: automated-release

env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0

- name: Use Node.js 20
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 20.x
cache: 'npm'

- name: Move release to draft
run: gh release edit "$TAG_NAME" --draft=true
Expand All @@ -28,14 +34,20 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm run test
- name: Typecheck tests
run: npm run test:typecheck

- name: Lint
run: npm run lint
- name: Install Playwright browser
run: npx playwright install --with-deps chromium

- name: Test
run: npm test

- name: Create lib archive
run: |
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
## Changelog

## 9.0.0

### Breaking changes

* Updated `tsconfig.json` to `ES2020` / `bundler` module resolution and compilation of the whole `src` folder.
* ChartUtils now requires a JavaScript runtime with ES2020 support.
* Updated the runtime dependencies `powerbi-visuals-utils-formattingutils`, `powerbi-visuals-utils-svgutils` and `powerbi-visuals-utils-typeutils` to 7.x.
* Removed the unused `jsnext:main` field from the package manifest.

### Tooling and packaging

* Migrated the test infrastructure from Karma + Jasmine + webpack to Vite/Vitest browser mode (Playwright Chromium).
* Removed `karma.conf.ts`, `webpack.config.js` and the related dependencies; added `vitest.config.mts` and `test/tsconfig.json`.
* Added `test:watch`, `test:coverage` and `test:typecheck` npm scripts.
* Lint stack migrated to ESLint 10 flat config.
* Enabled the `alwaysStrict`, `noImplicitThis`, `strictBindCallApply` and `useUnknownInCatchVariables` compiler options and pinned `strict` explicitly.
* Development TypeScript upgraded to 6.x.
* Updated the development-only dependencies `powerbi-visuals-utils-colorutils` and `powerbi-visuals-utils-testutils` to 7.x.
* Enabled `skipLibCheck`, which is now required rather than cosmetic: TypeScript 6 rejects the legacy `declare module X {}` form used by the `powerbi-visuals-api` 5.11.1 declaration files (80 `TS1540` errors). It cannot be removed until an upstream fix ships.
* Removed the decorator compiler options.
* The build now removes stale `lib` output before compiling.
* The published package now also ships `README.md`, `LICENSE` and `CHANGELOG.md`.
* CI now tests Node.js 20 and 22, installs Playwright Chromium and collects Vitest coverage.
* Release workflow now runs linting, test type-checking and browser tests before publishing artifacts.
* Removed the advanced `codeql-analysis.yml` workflow, which cannot upload results while CodeQL default setup is enabled on the repository.

## 8.3.0

### Module `legend`
Expand Down
19 changes: 15 additions & 4 deletions docs/dev/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To start development and improvement of the source code you should have the foll
* [git](https://git-scm.com)
* [node.js](https://nodejs.org) (we recommend the latest LTS version)
* [npm](https://www.npmjs.com) (the minimal supported version is 3.0.0)
* [Google Chrome browser](https://www.google.com/chrome) (it's necessary to run unit tests locally)
* [Playwright Chromium](https://playwright.dev/docs/browsers), installed as described in [How to run unit tests locally](#how-to-run-unit-tests-locally)

## Installation
Firstly, you should clone a copy of the repository by using one of the following commands:
Expand Down Expand Up @@ -57,18 +57,29 @@ npm run lint
This command checks style of TypeScript code and provides a list of problems. Please address all of problems reported by eslint before sending a pull request to the [repository](https://github.com/Microsoft/powerbi-visuals-utils-chartutils).

## How to run unit tests locally
We use [Jasmine](https://github.com/jasmine/jasmine) and [Karma](https://github.com/karma-runner/karma) to run unit tests. Please note, Karma requires Google Chrome to run unit tests.
We use [Vitest](https://vitest.dev/) in browser mode to run unit tests. Tests are executed in headless Chromium provided by [Playwright](https://playwright.dev/), so make sure the browser is installed:

```bash
npx playwright install --with-deps chromium
```

To run unit tests locally on your machine you should run the following command:

```bash
npm run test
```

To collect code coverage run:

```bash
npm run test:coverage
```

## How to debug unit tests locally
To debug unit tests in Google Chrome browser you should run the following command:
To run unit tests in watch mode you should run the following command:

```bash
npm run test -- --single-run=false
npm run test:watch
```

This command runs unit tests in the browser and watches tests files, in other words, you have an ability to run unit tests automatically after any changing.
1 change: 1 addition & 0 deletions docs/usage/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ To use the package you should have the following things:
* [node.js](https://nodejs.org) (we recommend the latest LTS version)
* [npm](https://www.npmjs.com/) (the minimal supported version is 3.0.0)
* The custom visual created by [PowerBI-visuals-tools](https://github.com/Microsoft/PowerBI-visuals-tools)
* A JavaScript runtime with ES2020 support (required by ChartUtils 9.0.0 and later)

## Installation
To install the package you should run the following command in the directory with your current custom visual:
Expand Down
13 changes: 9 additions & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import js from "@eslint/js";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import powerbiVisualsConfigs from "eslint-plugin-powerbi-visuals";
import tseslint from 'typescript-eslint';

export default [
{
ignores: ["node_modules/", "dist/", ".vscode/", ".tmp/", "test/", "lib/", "mocks/", "coverage/", "webpack.config.js", "karma.conf.ts"],
ignores: ["node_modules/", "dist/", ".vscode/", ".tmp/", "test/", "lib/", "mocks/", "coverage/", "eslint.config.mjs", "vitest.config.mts"],
},
...tseslint.configs.recommended,
js.configs.recommended,
...tsPlugin.configs["flat/recommended"],
powerbiVisualsConfigs.configs.recommended,
{
files: ["**/*.{js,jsx,ts,tsx}"],
rules: {
"@typescript-eslint/no-explicit-any": "off"
// 182 pre-existing occurrences, mostly in the public API surface; tightening this is its own change.
"@typescript-eslint/no-explicit-any": "off",
"no-useless-assignment": "warn"
}
},
];
103 changes: 0 additions & 103 deletions karma.conf.ts

This file was deleted.

Loading
Loading