Skip to content

Commit

Permalink
Tests: fixed ESlint error, added eslint-check GH workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jszuminski committed Mar 19, 2024
1 parent e16173c commit 2f9b374
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ module.exports = {
'plugin:import/recommended',
'plugin:prettier/recommended'
],
plugins: ['import', 'prettier'],
overrides: [
{
files: ['/**/*.test.js'],
files: ['**/*.test.js'],
env: {
mocha: true
}
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/eslint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint Code Base

on: [ pull_request ]

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '16.4.0'

- name: Install Dependencies
run: npm install

- name: Run ESLint
id: eslint
continue-on-error: true
run: |
ESLINT_OUTPUT=$(npx eslint . --ext .js,.jsx,.ts,.tsx)
echo "::set-output name=result::$ESLINT_OUTPUT"
if [ -z "$ESLINT_OUTPUT" ]; then
echo "ESLint found no issues :white_check_mark:"
echo "::set-output name=status::success"
else
echo "$ESLINT_OUTPUT"
echo "::set-output name=status::failure"
exit 1
fi
- name: Success Message
if: steps.eslint.outputs.status == 'success'
run: echo "✅ ESLint check passed successfully!"

- name: Failure Message
if: failure()
run: echo "❌ ESLint check failed. Please fix the issues."
5 changes: 1 addition & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit tests of the server
name: Unit tests

on:
pull_request:
Expand All @@ -20,9 +20,6 @@ jobs:
- name: 'Install dependencies'
run: npm ci

- name: 'Build the project with rollup'
run: npm run build --if-present

- name: Run unit tests
run: npm run unit:test
env:
Expand Down
1 change: 0 additions & 1 deletion lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const extractVersion = () =>
.replace(/\n/g, '')
.trim());


/**
* Extracts the Highcharts module name based on the scriptPath.
*/
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"install": "node install.js",
"prestart": "rm -rf tmp && node node_modules/puppeteer/install.js",
"start": "node bin/cli.js --enableServer 1 --logLevel 2",
"eslint-check": "eslint ./",
"lint": "eslint ./ --fix",
"cli-tests": "node tests/cli/cli_test_runner.js",
"cli-tests-single": "node tests/cli/cli_test_runner_single.js",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ describe('Array', function () {
const arr = [];
expect(arr).to.be.empty;
});
});
});

0 comments on commit 2f9b374

Please sign in to comment.