From 7c7f83c0377985aa461cedfab10329935bb70f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Edman?= Date: Thu, 11 Apr 2024 06:30:10 +0200 Subject: [PATCH] update all dev deps and use latest eslint --- .eslintignore | 4 -- .eslintrc.json | 24 ------- .github/workflows/build-latest.yaml | 10 +-- .nvmrc | 2 +- CHANGELOG.md | 4 ++ babel.config.cjs | 1 - eslint.config.js | 106 ++++++++++++++++++++++++++++ package.json | 15 ++-- test/features/error-feature.js | 44 +++++++++++- 9 files changed, 166 insertions(+), 44 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 5bccd15..0000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -dist/ -node_modules/ -tmp/ -coverage/ diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 083f336..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2020 - }, - "env": { - "shared-node-browser": true, - "es6": true - }, - "plugins": ["import"], - "extends": ["eslint:recommended", "plugin:import/recommended"], - "rules": { - "eol-last": 2, - "eqeqeq": 2, - "import/extensions": [2, "always"], - "linebreak-style": [2, "unix"], - "quotes": [2, "single"], - "require-atomic-updates": 0, - "require-await": 2, - "strict": [2, "global"], - "unicode-bom": ["error", "never"], - "yoda": [2, "never"] - } -} diff --git a/.github/workflows/build-latest.yaml b/.github/workflows/build-latest.yaml index dba90a7..57fcb6c 100644 --- a/.github/workflows/build-latest.yaml +++ b/.github/workflows/build-latest.yaml @@ -11,18 +11,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 16, 18, 20, latest] + node-version: [18, 20, latest] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm i - run: npm run test:lcov - name: Coveralls - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} flag-name: run-${{ matrix.node-version }} @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Coveralls Finished - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true diff --git a/.nvmrc b/.nvmrc index 8351c19..3c03207 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14 +18 diff --git a/CHANGELOG.md b/CHANGELOG.md index a4dc972..b5b7ecf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# unreleased + +- update all dev dependencies and run tests + # 7.1.0 - add process attribute `historyTimeToLive` to process environment variables when running diff --git a/babel.config.cjs b/babel.config.cjs index 993dba0..ee57cfd 100644 --- a/babel.config.cjs +++ b/babel.config.cjs @@ -1,4 +1,3 @@ -/* global module */ module.exports = function babelRoot(api) { api.cache(true); diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..08f885e --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,106 @@ +import js from '@eslint/js'; +import globals from 'globals'; + +const rules = { + 'dot-notation': [2, { allowKeywords: true }], + 'eol-last': 2, + eqeqeq: 2, + 'linebreak-style': ['error', 'unix'], + 'no-alert': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-catch-shadow': 2, + 'no-console': 1, + 'no-eval': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-fallthrough': 'off', + 'no-implied-eval': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': 2, + 'no-lone-blocks': 2, + 'no-loop-func': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0, maxBOF: 0 }], + 'no-new-func': 2, + 'no-new-object': 2, + 'no-new-wrappers': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-process-exit': 2, + 'no-proto': 2, + 'no-prototype-builtins': 2, + 'no-return-assign': 2, + 'no-script-url': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-shadow': 2, + 'no-spaced-func': 2, + 'no-trailing-spaces': 2, + 'no-undef-init': 2, + 'no-undef': 2, + 'no-underscore-dangle': 0, + 'no-unused-expressions': 2, + 'no-use-before-define': 0, + 'no-var': 0, + 'no-with': 2, + 'prefer-const': ['error', { destructuring: 'all' }], + 'require-atomic-updates': 0, + 'require-await': 2, + 'semi-spacing': [2, { before: false, after: true }], + semi: [2, 'always'], + 'space-before-blocks': 2, + 'space-before-function-paren': [2, { anonymous: 'never', named: 'never' }], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { words: true, nonwords: false }], + 'unicode-bom': ['error', 'never'], + yoda: [2, 'never'], +}; + +export default [ + js.configs.recommended, + { + rules, + }, + { + files: ['**/*.js'], + languageOptions: { + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020, + }, + globals: { + ...globals['shared-node-browser'], + ...globals.es6, + }, + }, + }, + { + files: ['test/**/*.js'], + languageOptions: { + globals: { + ...globals.node, + ...globals.mocha, + expect: 'readonly', + beforeEachScenario: 'readonly', + Buffer: 'readonly', + Feature: 'readonly', + Scenario: 'readonly', + Given: 'readonly', + When: 'readonly', + Then: 'readonly', + And: 'readonly', + But: 'readonly', + }, + }, + rules: { + 'no-unused-expressions': 0, + 'no-var': 1, + }, + }, + { + ignores: ['coverage/**/*', 'node_modules/**/*', 'tmp/*', 'dist/*'], + }, +]; diff --git a/package.json b/package.json index 8d284d4..f854dff 100644 --- a/package.json +++ b/package.json @@ -38,21 +38,20 @@ "license": "MIT", "devDependencies": { "@aircall/expression-parser": "^1.0.4", - "@babel/cli": "^7.23.4", - "@babel/core": "^7.23.7", - "@babel/preset-env": "^7.23.8", + "@babel/cli": "^7.23.9", + "@babel/core": "^7.23.9", + "@babel/preset-env": "^7.23.9", "@babel/register": "^7.23.7", "bpmn-elements-8-1": "npm:bpmn-elements@8.1", - "bpmn-engine": "^18.0.0", + "bpmn-engine": "^20.0.1", "bpmn-engine-14": "npm:bpmn-engine@14", - "bpmn-moddle": "^8.1.0", + "bpmn-moddle": "^9.0.1", "c8": "^9.1.0", "camunda-bpmn-moddle": "^7.0.1", - "chai": "^5.0.0", + "chai": "^5.0.3", "chronokinesis": "^6.0.0", "debug": "^4.3.4", - "eslint": "^8.56.0", - "eslint-plugin-import": "^2.29.1", + "eslint": "^9.0.0", "mocha": "^10.2.0", "mocha-cakes-2": "^3.3.0", "moddle-context-serializer": "^4.1.1", diff --git a/test/features/error-feature.js b/test/features/error-feature.js index 0e1762d..575a0a5 100644 --- a/test/features/error-feature.js +++ b/test/features/error-feature.js @@ -53,9 +53,51 @@ Feature('Flow errors', () => { flow.run(); }); - And('task is fails', async () => { + And('task fails', async () => { + const err = await error; + expect(err.content.error).to.match(/SyntaxError/); + }); + + Given('a flow with a output expression succeeded by a faulty task', async () => { + const source = ` + + + + + + bar + + + + + + + + \${content.output.result)} + + + + + `; + + flow = await testHelpers.getOnifyFlow(source); + }); + + When('started', () => { + error = flow.waitFor('error'); + flow.run(); + }); + + And('task fails', async () => { const err = await error; expect(err.content.error).to.match(/SyntaxError/); }); + + And('flow has output from non-failing task', async () => { + expect(await flow.getState()) + .to.have.property('environment') + .with.property('output') + .with.property('foo', 'bar'); + }); }); });