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
4 changes: 4 additions & 0 deletions .github/actions/mutation-tests-all-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ runs:
- name: Setup environment
uses: ./.github/actions/setup

- uses: ./.github/actions/build
with:
package-name: ${{ inputs.package-name }}

- name: Get changed files
uses: tj-actions/changed-files@v39.0.0
id: changed-files
Expand Down
8 changes: 6 additions & 2 deletions .github/actions/mutation-tests-changed-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ runs:
- name: Setup environment
uses: ./.github/actions/setup

- uses: ./.github/actions/build
with:
package-name: ${{ inputs.package-name }}

- name: Get changed files
uses: tj-actions/changed-files@v39.0.0
id: changed-files
Expand Down Expand Up @@ -55,7 +59,7 @@ runs:
✅ Mutation testing passed for `${{ inputs.working-directory }}`

Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-${{ steps.findPr.outputs.number }}?module=${{ inputs.package-name }}

<details>
<summary>Mutated files</summary>
<pre>
Expand All @@ -73,7 +77,7 @@ runs:
❌ Mutation testing hasn't passed score threshold for `${{ inputs.working-directory }}`

Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-${{ steps.findPr.outputs.number }}?module=${{ inputs.package-name }}

<details>
<summary>Mutated files</summary>
<pre>
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/unit-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ runs:
node-version-file: .nvmrc
- uses: ./.github/actions/setup

- uses: ./.github/actions/build
with:
package-name: ${{ inputs.package-name }}

# Find current PR's number
- uses: jwalton/gh-find-current-pr@v1
id: findPr
Expand All @@ -26,4 +30,4 @@ runs:
working-directory: ${{ inputs.working-directory }}
test-script: yarn workspace ${{ inputs.package-name }} test
package-manager: yarn
prnumber: ${{ steps.findPr.outputs.number }}
prnumber: ${{ steps.findPr.outputs.number }}
34 changes: 33 additions & 1 deletion .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,43 @@ jobs:
with:
package-name: '@editorjs/core'

tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run unit tests
uses: ./.github/actions/unit-tests
with:
package-name: '@editorjs/core'
working-directory: './packages/core'

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the package
uses: ./.github/actions/build
with:
package-name: '@editorjs/core'
package-name: '@editorjs/core'

mutation-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run mutation tests for changed files
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/mutation-tests-changed-files
with:
package-name: '@editorjs/core'
working-directory: './packages/core'
stryker_dashboard_api_key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: Run mutation tests for all files
if: ${{ github.event_name == 'merge_group' }}
uses: ./.github/actions/mutation-tests-all-files
with:
package-name: '@editorjs/core'
working-directory: './packages/core'
stryker_dashboard_api_key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
7 changes: 7 additions & 0 deletions packages/core/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,30 @@ export default [
project: './tsconfig.json',
tsconfigRootDir: './',
sourceType: 'module',
tsconfig: './tsconfig.json',
},
},
rules: {
'n/no-unpublished-import': ['error', {
allowModules: [
'eslint-config-codex',
'@jest/globals',
],
ignoreTypeImport: true,
}],
// @todo: remove when we setup eslint to correctly handle the types
'n/no-missing-import': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-missing-import': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'n/no-unsupported-features/node-builtins': ['error', {
version: '>=24.0.0',
ignores: [],
}],
},
},
];
31 changes: 31 additions & 0 deletions packages/core/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { JestConfigWithTsJest } from 'ts-jest';

export default {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: [ '<rootDir>/src/**/*.spec.ts' ],
modulePathIgnorePatterns: [ '<rootDir>/.*/__mocks__' ],
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
'^.+\\.jsx?$': [
'babel-jest',
{
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
],
},
],
},
transformIgnorePatterns: [
'node_modules/(?!@editorjs)',
]
} as JestConfigWithTsJest;
24 changes: 21 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,37 @@
"lint": "eslint ./src",
"lint:ci": "eslint --config ./eslint.config.mjs ./src --max-warnings 0",
"lint:fix": "yarn lint --fix",
"test": "node --experimental-vm-modules $(yarn bin jest)",
"test:coverage": "yarn test --coverage=true",
"test:mutations": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" stryker run",
"clear": "rm -rf ./dist && rm -rf ./tsconfig.build.tsbuildinfo"
},
"devDependencies": {
"eslint": "^9.9.1",
"eslint-config-codex": "^2.0.2",
"@babel/core": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"@jest/globals": "^29.7.0",
"@stryker-mutator/core": "^7.0.2",
"@stryker-mutator/jest-runner": "^7.0.2",
"@stryker-mutator/typescript-checker": "^7.0.2",
"@types/eslint": "^8",
"@types/jest": "^29.5.1",
"@types/node": "^22.10.2",
"babel-jest": "^30.3.0",
"eslint": "^9.24.0",
"eslint-config-codex": "^2.0.3",
"eslint-plugin-import": "^2.29.0",
"jest": "^29.7.0",
"stryker-cli": "^1.0.2",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
},
"dependencies": {
"@editorjs/collaboration-manager": "workspace:^",
"@editorjs/dom": "^1.0.0",
"@editorjs/dom-adapters": "workspace:^",
"@editorjs/editorjs": "^2.30.5",
"@editorjs/helpers": "^1.0.0",
"@editorjs/helpers": "^1.1.0",
"@editorjs/model": "workspace:^",
"@editorjs/sdk": "workspace:^",
"reflect-metadata": "^0.2.2",
Expand Down
Loading
Loading