diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f345279d54..ad4bbe922f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,179 +46,6 @@ jobs: - run: sudo apt-get install shellcheck - run: git ls-files '*.sh' | xargs shellcheck - # Run the integration, find and mapreduce tests against CouchDB on Node.js. - # This should be run against every version of CouchDB and every version of - # Node.js we support. - - couchdb-nodejs: - needs: lint - strategy: - fail-fast: false - matrix: - couchdb: ['2.3', '3.1'] - node: [18, 20] - cmd: - - npm test - - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test - - TYPE=mapreduce ADAPTERS=http npm test - runs-on: ubuntu-latest - env: - CLIENT: node - SERVER: couchdb-master - COUCH_HOST: http://admin:password@127.0.0.1:5984 - SKIP_MIGRATION: 1 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: ./.github/actions/install-node-package - with: - node-version: ${{ matrix.node }} - - uses: ./.github/actions/install-couchdb - with: - couchdb-version: ${{ matrix.couchdb }} - - uses: ./.github/actions/build-pouchdb - - id: test - run: ${{ matrix.cmd }} - continue-on-error: true - - name: First retry - id: retry - if: steps.test.outcome == 'failure' - run: ${{ matrix.cmd }} - continue-on-error: true - - name: Second retry - if: steps.retry.outcome == 'failure' - run: ${{ matrix.cmd }} - - # Run the integration, find and mapreduce tests against CouchDB in the - # browser. This should be run against every version of CouchDB we support and - # every target browser. - - couchdb-browser: - needs: lint - strategy: - fail-fast: false - matrix: - couchdb: ['2.3','3.1'] - client: ['firefox', 'chromium', 'webkit'] - cmd: - - npm test - - TYPE=find PLUGINS=pouchdb-find ADAPTERS=http npm test - - TYPE=mapreduce ADAPTERS=http npm test - runs-on: ubuntu-latest - env: - USE_MINIFIED: 1 - CLIENT: ${{ matrix.client }} - SERVER: couchdb-master - COUCH_HOST: http://admin:password@127.0.0.1:5984 - SKIP_MIGRATION: 1 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: ./.github/actions/install-node-package - with: - node-version: ${{ env.NODE_VERSION }} - - uses: ./.github/actions/install-playwright - - uses: ./.github/actions/install-couchdb - with: - couchdb-version: ${{ matrix.couchdb }} - - uses: ./.github/actions/build-pouchdb - - id: test - run: ${{ matrix.cmd }} - continue-on-error: true - - name: First retry - id: retry - if: steps.test.outcome == 'failure' - run: ${{ matrix.cmd }} - continue-on-error: true - - name: Second retry - if: steps.retry.outcome == 'failure' - run: ${{ matrix.cmd }} - - # Run the integration, find and mapreduce tests against all the Node.js - # PouchDB adapters. This should be run for every adapter on every version of - # Node.js we support. - - nodejs-adapter: - needs: lint - strategy: - fail-fast: false - matrix: - node: [18, 20] - adapter: ['leveldb', 'memory'] - cmd: - - npm test - - TYPE=find PLUGINS=pouchdb-find npm test - - TYPE=mapreduce npm test - runs-on: ubuntu-latest - env: - CLIENT: node - ADAPTERS: ${{ matrix.adapter }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: ./.github/actions/install-node-package - with: - node-version: ${{ matrix.node }} - - uses: ./.github/actions/build-pouchdb - - id: test - run: ${{ matrix.cmd }} - continue-on-error: true - - name: First retry - id: retry - if: steps.test.outcome == 'failure' - run: ${{ matrix.cmd }} - continue-on-error: true - - name: Second retry - if: steps.retry.outcome == 'failure' - run: ${{ matrix.cmd }} - - # Run the integration, find and mapreduce tests against all the browser-based - # adapters. PouchDB adapters. This should be run for every adapter on every - # target browser. - - browser-adapter: - needs: lint - strategy: - fail-fast: false - matrix: - client: ['firefox', 'chromium', 'webkit'] - adapter: ['idb', 'indexeddb', 'memory'] - cmd: - - npm test - - TYPE=find PLUGINS=pouchdb-find npm test - - TYPE=mapreduce npm test - runs-on: ubuntu-latest - env: - USE_MINIFIED: 1 - CLIENT: ${{ matrix.client }} - ADAPTERS: ${{ matrix.adapter }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: ./.github/actions/install-node-package - with: - node-version: ${{ env.NODE_VERSION }} - - uses: ./.github/actions/install-playwright - - uses: ./.github/actions/build-pouchdb - - id: test - run: ${{ matrix.cmd }} - continue-on-error: true - - name: First retry - id: retry - if: steps.test.outcome == 'failure' - run: ${{ matrix.cmd }} - continue-on-error: true - - name: Second retry - if: steps.retry.outcome == 'failure' - run: ${{ matrix.cmd }} - - # Run all the other testing tasks -- unit tests, and so on. These should be - # run on every version of Node.js that we support. - nodejs: needs: lint strategy: @@ -226,14 +53,7 @@ jobs: matrix: node: [18, 20] cmd: - - CLIENT=firefox npm run test-webpack - - AUTO_COMPACTION=true npm test - - PERF=1 npm test - - npm run test-unit - - npm run test-component - - npm run test-fuzzy - # - SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find npm run report-coverage - - npm run verify-build + - SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find npm run test-coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 05812d8318..1c18491be1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [PouchDB](https://pouchdb.com/) – The Database that Syncs! ========= -[![Build Status](https://github.com/pouchdb/pouchdb/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/pouchdb/pouchdb/actions/workflows/ci.yml?query=branch%3Amaster) [![Coverage Status](https://s3.amazonaws.com/assets.coveralls.io/badges/coveralls_100.svg)](https://coveralls.io/github/pouchdb/pouchdb?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/pouchdb/pouchdb.svg)](https://greenkeeper.io/) [![npm version](https://img.shields.io/npm/v/pouchdb.svg)](https://www.npmjs.com/package/pouchdb) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/pouchdb/badge?style=rounded)](https://www.jsdelivr.com/package/npm/pouchdb) +[![Build Status](https://github.com/pouchdb/pouchdb/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/pouchdb/pouchdb/actions/workflows/ci.yml?query=branch%3Amaster) [![Greenkeeper badge](https://badges.greenkeeper.io/pouchdb/pouchdb.svg)](https://greenkeeper.io/) [![npm version](https://img.shields.io/npm/v/pouchdb.svg)](https://www.npmjs.com/package/pouchdb) [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/pouchdb/badge?style=rounded)](https://www.jsdelivr.com/package/npm/pouchdb) PouchDB is an open-source JavaScript database inspired by [Apache CouchDB](http://couchdb.apache.org/) that is designed to run well within the browser. diff --git a/bin/test-node.sh b/bin/test-node.sh index ae0cdc92d2..603596f37c 100755 --- a/bin/test-node.sh +++ b/bin/test-node.sh @@ -29,10 +29,6 @@ fi if [ $TYPE = "find" ]; then TESTS_PATH="tests/find/*/test.*.js" fi -if [ "$COVERAGE" ]; then - # run all tests when testing for coverage - TESTS_PATH="tests/{unit,integration,mapreduce,component}/test*.js tests/find/*/test.*.js" -fi if [ "$PERF" ]; then node tests/performance/index.js @@ -47,8 +43,11 @@ elif [ ! "$COVERAGE" ]; then --grep="$GREP" \ "$TESTS_PATH" else + # Ignore TESTS_PATH: + # run all tests when testing for coverage + # --exit required to workaround #8839 - ./node_modules/.bin/istanbul cover \ + ./node_modules/.bin/nyc \ --no-default-excludes -x 'tests/**' -x 'node_modules/**' \ ./node_modules/mocha/bin/_mocha -- \ --exit \ @@ -57,9 +56,9 @@ else --require=./tests/integration/node.setup.js \ --reporter="$REPORTER" \ --grep="$GREP" \ - "$TESTS_PATH" - - ./node_modules/.bin/istanbul check-coverage --line 100 + 'tests/{unit,integration,mapreduce,component}/test*.js' \ + 'tests/find/*/test.*.js' + ./node_modules/.bin/nyc check-coverage --line 100 fi EXIT_STATUS=$? diff --git a/package.json b/package.json index 7ffdd57710..75a9d960e8 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "build-site": "node ./bin/build-site.js", "test-coverage": "./bin/test-coverage.sh", "coverage": "COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find ./bin/test-coverage.sh", - "report-coverage": "npm run test-coverage && istanbul-coveralls --no-rm", "build-test": "npm run build-test-utils && npm run build-perf", "build-test-utils": "browserify tests/integration/utils.js > tests/integration/utils-bundle.js", "build-perf": "browserify tests/performance/index.js > tests/performance-bundle.js", @@ -76,8 +75,6 @@ "glob": "7.1.5", "glob-watcher": "^6.0.0", "http-server": "0.12.3", - "istanbul": "0.4.5", - "istanbul-coveralls": "1.0.3", "less": "3.9.0", "lodash": "4.17.21", "marky": "1.2.5", @@ -85,6 +82,7 @@ "mkdirp": "0.5.1", "mocha": "10.2.0", "ncp": "2.0.0", + "nyc": "^15.1.0", "playwright": "1.42.1", "pouchdb-express-router": "0.0.11", "replace": "1.2.1",