diff --git a/.github/workflows/unit-tests-workflow-for-customImportMap.yml b/.github/workflows/unit-tests-workflow-for-customImportMap.yml index 1fced466..bc8c26e1 100644 --- a/.github/workflows/unit-tests-workflow-for-customImportMap.yml +++ b/.github/workflows/unit-tests-workflow-for-customImportMap.yml @@ -2,21 +2,38 @@ name: Unit tests workflow on: push: branches: - - main + - "*" + - "feature/**" + paths: + - src/plugins/custom_import_map/** + - .github/workflows/unit-tests-workflow-for-customImportMap.yml pull_request: branches: - - main + - "*" + - "feature/**" + paths: + - src/plugins/custom_import_map/** + - .github/workflows/unit-tests-workflow-for-customImportMap.yml env: OPENSEARCH_DASHBOARDS_VERSION: '2.0' jobs: tests: + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + name: Run unit tests - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout Plugin uses: actions/checkout@v2 + # Enable longer filenames for windows + - name: Enable longer filenames + if: ${{ matrix.os == 'windows-latest' }} + run: git config --system core.longpaths true + - name: Checkout OpenSearch Dashboards uses: actions/checkout@v2 with: @@ -50,10 +67,12 @@ jobs: cd OpenSearch-Dashboards/plugins/src/plugins/custom_import_map yarn osd bootstrap - - name: Run tests + - name: Run tests with coverage run: | cd OpenSearch-Dashboards/plugins/src/plugins/custom_import_map yarn run test:jest --coverage - name: Uploads coverage uses: codecov/codecov-action@v1 + + diff --git a/src/plugins/custom_import_map/package.json b/src/plugins/custom_import_map/package.json index ce4a8f50..c08f1c28 100644 --- a/src/plugins/custom_import_map/package.json +++ b/src/plugins/custom_import_map/package.json @@ -8,7 +8,7 @@ "lint": "yarn run lint:es && yarn run lint:style", "lint:es": "node ../../../../scripts/eslint", "lint:style": "node ../../../../scripts/stylelint", - "test:jest": "TZ=UTC ../../../../node_modules/.bin/jest --config ./test/jest.config.js" + "test:jest": "../../../../node_modules/.bin/jest --config ./test/jest.config.js" }, "husky": { "hooks": { diff --git a/src/plugins/custom_import_map/test/jest.config.js b/src/plugins/custom_import_map/test/jest.config.js index 80ea0c30..53d38049 100644 --- a/src/plugins/custom_import_map/test/jest.config.js +++ b/src/plugins/custom_import_map/test/jest.config.js @@ -2,7 +2,7 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ - +process.env.TZ = 'UTC'; module.exports = { rootDir: '../', setupFiles: [