diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1691ec50398..a6c2a4ac3cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -125,7 +125,7 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Run tests on ${{ matrix.browser }} - run: npm test -- --browsers ${{ matrix.browser }} + run: npm test -- --browsers ${{ matrix.browser }} --single-run publish-artifacts: needs: setup diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96dc8dafda7..c4ea321ac55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,7 +97,7 @@ Also, please make sure that you have [line endings configured properly](https:// Happy coding! -### Using RollupJS +### Building Leaflet The source JavaScript code for Leaflet is a few dozen files, in the `src/` directory. But normally, Leaflet is loaded in a web browser as just one JavaScript file. @@ -110,7 +110,7 @@ development. `dist/leaflet.js` is uglified and thus is smaller, so it's better for deployment. When developing (or bugfixing) core Leaflet functionalities, it's common to use -the webpages in the `debug/` directory, and run the unit tests (`spec/index.html`) +the webpages in the `debug/` directory, and run the tests in a graphical browser. This requires regenerating the bundled files quickly. In order to do so, run `npm run watch` or `yarn run watch`. This will keep @@ -118,21 +118,24 @@ on rebuilding the bundles whenever any source file changes. ## Running the Tests -To run the tests from the command line, install [Google Chrome](https://www.google.com/chrome/) then run: +Before running the tests make sure that the source code has been built (as mentioned above). If you want to run the tests in the background while working on Leaflet it is recommended you run the build in `watch` mode. This way the tests will automatically re-run when changes to the source code are made. + +To run the tests from the command line, ensure you have [Google Chrome](https://www.google.com/chrome/) installed and then run: ``` npm test ``` -To run the tests in other browsers at the same time, you can do: +By default the tests will run in Google Chrome headlessly (without a UI), to run the tests in other browsers you can pass in the [`--browsers`](https://karma-runner.github.io/latest/config/configuration-file.html#browsers) flag. ``` -npm test -- -- --browsers Firefox,Chrome,Safari,IE +npm test -- --browsers Firefox ``` -(Note: the doubling of "`--`" [special option](https://docs.npmjs.com/cli/run-script#description) is [important](https://github.com/Leaflet/Leaflet/pull/6166#issuecomment-390959903)) - -To run the tests in a browser manually, open `spec/index.html`. +For a list of available browsers see the documentation of the included launcher plugins: +- [`karma-chrome-launcher`](https://github.com/karma-runner/karma-chrome-launcher#available-browsers) +- [`karma-firefox-launcher`](https://github.com/karma-runner/karma-firefox-launcher#configuration) +- [`karma-safarinative-launcher`](https://github.com/muthu90ec/karma-safarinative-launcher#readme) ## Improving Documentation diff --git a/package-lock.json b/package-lock.json index a81851c0ca2..ddf88557920 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ "karma-expect": "^1.1.3", "karma-firefox-launcher": "^2.1.2", "karma-mocha": "^2.0.1", - "karma-rollup-preprocessor": "^7.0.8", "karma-safarinative-launcher": "^1.1.0", "karma-sinon": "^1.0.5", "karma-time-stats-reporter": "^0.1.0", @@ -1292,12 +1291,6 @@ "node": ">=4.0" } }, - "node_modules/debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", - "dev": true - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3169,22 +3162,6 @@ "minimist": "^1.2.3" } }, - "node_modules/karma-rollup-preprocessor": { - "version": "7.0.8", - "resolved": "https://registry.npmjs.org/karma-rollup-preprocessor/-/karma-rollup-preprocessor-7.0.8.tgz", - "integrity": "sha512-WiuBCS9qsatJuR17dghiTARBZ7LF+ml+eb7qJXhw7IbsdY0lTWELDRQC/93J9i6636CsAXVBL3VJF4WtaFLZzA==", - "dev": true, - "dependencies": { - "chokidar": "^3.3.1", - "debounce": "^1.2.0" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "rollup": ">= 1.0.0" - } - }, "node_modules/karma-safarinative-launcher": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/karma-safarinative-launcher/-/karma-safarinative-launcher-1.1.0.tgz", diff --git a/package.json b/package.json index 56d7fef553f..994f02f1f1e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "karma-expect": "^1.1.3", "karma-firefox-launcher": "^2.1.2", "karma-mocha": "^2.0.1", - "karma-rollup-preprocessor": "^7.0.8", "karma-safarinative-launcher": "^1.1.0", "karma-sinon": "^1.0.5", "karma-time-stats-reporter": "^0.1.0", diff --git a/spec/index.html b/spec/index.html deleted file mode 100644 index 07b29792821..00000000000 --- a/spec/index.html +++ /dev/null @@ -1,121 +0,0 @@ - - -
- -