Commit Graph

518 Commits

Author SHA1 Message Date
John McLear 2ea8ea1275 restructure: move bin/ and tests/ to src/
Also add symlinks from the old `bin/` and `tests/` locations to avoid
breaking scripts and other tools.

Motivations:

  * Scripts and tests no longer have to do dubious things like:

        require('ep_etherpad-lite/node_modules/foo')

    to access packages installed as dependencies in
    `src/package.json`.

  * Plugins can access the backend test helper library in a non-hacky
    way:

        require('ep_etherpad-lite/tests/backend/common')

  * We can delete the top-level `package.json` without breaking our
    ability to lint the files in `bin/` and `tests/`.

    Deleting the top-level `package.json` has downsides: It will cause
    `npm` to print warnings whenever plugins are installed, npm will
    no longer be able to enforce a plugin's peer dependency on
    ep_etherpad-lite, and npm will keep deleting the
    `node_modules/ep_etherpad-lite` symlink that points to `../src`.

    But there are significant upsides to deleting the top-level
    `package.json`: It will drastically speed up plugin installation
    because `npm` doesn't have to recursively walk the dependencies in
    `src/package.json`. Also, deleting the top-level `package.json`
    avoids npm's horrible dependency hoisting behavior (where it moves
    stuff from `src/node_modules/` to the top-level `node_modules/`
    directory). Dependency hoisting causes numerous mysterious
    problems such as silent failures in `npm outdated` and `npm
    update`. Dependency hoisting also breaks plugins that do:

        require('ep_etherpad-lite/node_modules/foo')
2021-02-04 17:15:08 -05:00
John McLear 1076783985
tests: backend test coverage for #3227 where a group cannot be deleted if it has pads. 2021-02-03 10:39:30 +00:00
freddii ea202e41f6 docs: fixed typos 2021-02-03 00:30:07 +01:00
Richard Hansen 05e0e8dbf7 hooks: New `callAllSerial()` function
This is necessary to migrate away from `callAll()` (which only
supports synchronous hook functions).
2021-02-02 09:09:02 +00:00
Richard Hansen ba0544ea9e hooks: Add unit tests for `callFirst()`, `aCallFirst()` 2021-02-02 09:09:02 +00:00
Richard Hansen ba02e70020 tests: Make the fake webaccess hook registrations look more real
The additional properties will be needed once `aCallAll()` is upgraded
to use `callHookFnAsync()`.
2021-02-02 09:09:02 +00:00
Richard Hansen 47f0a7dacf lint: Fix more ESLint errors 2021-02-02 09:09:02 +00:00
John McLear 915849b319
Low hanging lint frontend tests (#4695)
* lint: low hanging specs/alphabet.js

* lint: low hanging specs/authorship_of_editions.js

* lint: low hanging specs/bold.js

* lint: low hanging specs/caret.js

* lint: low hanging specs/change_user_color.js

* lint: low hanging specs/change_user_name.js

* lint: low hanging specs/chat.js

* lint: low hanging specs/chat_load_messages.js

* lint: low hanging specs/clear_authorship_colors.js

* lint: low hanging specs/delete.js

* lint: low hanging specs/drag_and_drop.js

* lint: low hanging specs/embed_value.js

* lint: low hanging specs/enter.js

* lint: low hanging specs/font_type.js

* lint: low hanging specs/helper.js

* lint: low hanging specs/importexport.js

* lint: low hanging specs/importindents.js

* lint: low hanging specs/indentation.js

* lint: low hanging specs/italic.js

* lint: low hanging specs/language.js

* lint: low hanging specs/multiple_authors_clear_authorship_colors.js

* lint: low hanging specs/ordered_list.js

* lint: low hanging specs/pad_modal.js

* lint: low hanging specs/redo.js

* lint: low hanging specs/responsiveness.js

* lint: low hanging specs/select_formatting_buttons.js

* lint: low hanging specs/strikethrough.js

* lint: low hanging specs/timeslider.js

* lint: low hanging specs/timeslider_labels.js

* lint: low hanging specs/timeslider_numeric_padID.js

* lint: low hanging specs/timeslider_revisions.js

* lint: low hanging specs/undo.js

* lint: low hanging specs/unordered_list.js

* lint: low hanging specs/xxauto_reconnect.js

* lint: attempt to do remote_runner.js

* lint: helper linting

* lint: rate limit linting

* use constructor for Event to make eslint happier

* for squash: lint fix refinements

* for squash: lint fix refinements

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-02-01 20:23:14 +00:00
Richard Hansen ecdb105bfe server: Refine process lifetime management
Define states and use them to properly handle multiple calls to
`start()`, `stop()`, and `exit()`. (Multiple calls to `exit()` can
happen if there is an uncaught exception or signal during shutdown.)

This should also make it easier to add support for cleanly restarting
the server after a shutdown (for tests or via an `/admin` page).
2021-01-30 08:05:08 +00:00
Richard Hansen 873987f989 tests: Asyncify indentation test
This makes it much easier to see why a test is failing. Before, a
`helper.waitFor()` failure would simply cause the test to time out.
Now an exception is displayed.
2021-01-29 09:16:50 +00:00
Richard Hansen 56f617060a tests: Fix missing call to `done` callback 2021-01-27 04:59:36 +00:00
Richard Hansen b164f9b431 tests: Replace "expected" with "want", "received" with "got"
"Got" and "want" are common terms for testing, plus this fixes a
spelling mistake ("received" was misspelled as "recieved").
2021-01-27 04:59:36 +00:00
Richard Hansen fc69ae78aa tests: Use `assert.deepEqual()` to simplify equality checks 2021-01-27 04:59:36 +00:00
Richard Hansen dd815892f2 tests: Delete erroneous `describe()` calls
`describe()` is meant to be used by independent tests, but the tests
in this file are not independent. Add a higher-level `describe()` call
and delete all of the `describe()` calls that wrap a single test.
2021-01-27 04:59:36 +00:00
Richard Hansen 32a0df4883 tests: Fix invalid HTML in contentcollector tests
The HTML spec does not permit `<pre>` as a child of `<p>`.
2021-01-27 04:59:36 +00:00
Richard Hansen 53160f4a21 tests: Delete invalid contentcollector test
The HTML spec doesn't allow `<ul>` to be a child of `<ol>` (it must be
a child of `<li>` instead).
2021-01-27 04:59:36 +00:00
Richard Hansen 906b2624ed tests: Re-enable import/export test that is now working 2021-01-27 04:59:36 +00:00
Richard Hansen 54a3dbb9a0 lint: Fix some straightforward ESLint errors 2021-01-27 04:59:36 +00:00
John McLear 44c2bc040c lint: tests/backend/specs/api/tidy.js 2021-01-25 22:53:11 -05:00
Richard Hansen 610326b496 lint: tests/backend/specs/api/importexportGetPost.js 2021-01-25 22:53:11 -05:00
John McLear f0a77cb98c
lint: contentcollector and domline
Various tidy up and linting of contentcollector.js and domline.js.

3 Tests disabled which are not due to be covered.

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-01-22 20:41:14 +00:00
webzwo0i 951c93fa6d change_user_name test: refactor 2020-12-27 23:40:35 +00:00
John McLear 38c9827161
Feature: Scroll to Line number based on Hash IE http://foo.com/p/bar#L10 will scroll to line 10. (#4554)
Includes test coverage
Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
2020-12-26 22:05:08 +01:00
Richard Hansen ff19181cd1 lint: Fix some straightforward ESLint errors 2020-12-23 16:18:28 -05:00
webzwo0i 790ba72a9e change scroll-behavior to auto
timeslider follow test: ensure there are so much lines in the pad view
below the changed line, so that the changed line will be the first
visible line
2020-12-23 16:18:28 -05:00
Richard Hansen d34a70c940 Delete merge conflict marker
This fixes a bug introduced in commit
040057239e.
2020-12-20 18:32:30 -05:00
webzwo0i 040057239e
tests for spaces (#4594) 2020-12-20 06:18:19 +00:00
webzwo0i a637920e55
add list-style:none for ul.indents in exported HTML (#4586)
* add list-style:none for ul.indents in exported HTML

* use list-style-type not list-style
2020-12-20 06:00:18 +00:00
webzwo0i c5cf7ab144
tests: Ignore head tag on import / improved contentcollector tests
* fix accidental write to global variable
properly show pending tests
log test name in suite
better log output for received/expected strings

* cc tests: enable second nestedOL test

* ignore the head tag on import
2020-12-18 09:37:37 +00:00
webzwo0i 5673a76b38 cc tests: enable second nestedOL test 2020-12-18 09:30:18 +00:00
webzwo0i c989a8e279 fix accidental write to global variable
properly show pending tests
log test name in suite
better log output for received/expected strings
2020-12-18 09:30:18 +00:00
Richard Hansen a44debdcfe Add `'` and `*` to acceptable URL characters
These characters are in the RFC3986 reserved set.

These characters are added to the set of characters that cannot be the
last character of a URL to avoid mislinkification.
2020-12-14 07:03:17 +00:00
Richard Hansen 7d23278ed0 Exclude `?`, `!`, and `)` from last character of URL
Now the final character in each of these example strings is no longer
considered part of the URL:
  * Have you seen http://example.com?
  * Look at http://example.com!
  * (see http://example.com)
2020-12-14 07:03:17 +00:00
Richard Hansen 66d0eb9a1f tests: Expand the tests in `urls_become_clickable.js` 2020-12-14 07:03:17 +00:00
Richard Hansen 1c388ca66e tests: New `helper.clearPad` method 2020-12-14 07:03:17 +00:00
Richard Hansen ca01856f94 lint: Fix some straightforward ESLint errors 2020-12-14 07:03:17 +00:00
Richard Hansen 5a8f7cf54e test runner: Simplify `getURLParameter()` 2020-11-25 19:19:24 +00:00
Richard Hansen 958f7d8966 lint: Fix most ESLint errors in `runner.js` 2020-11-25 19:19:24 +00:00
Richard Hansen 064fcf8c00 test runner: Pass single argument to `append()`
This makes the strings easier to read, and it simplifies `append()`.

Also fix some lint errors:
  * Use `const` instead of `var`.
  * Convert `append()` to an arrow function.
  * Wrap long lines.
2020-11-25 19:19:24 +00:00
Richard Hansen 107942ad8a lint: Rerun `eslint --fix` to nuke trailing function call commas
eslint-config-etherpad 1.0.11 changed the comma-dangle rule to
prohibit trailing commas for function arguments. See:
673ab07acf
Re-run the automated fixes to apply the rule change.

This also fixes a few lint issues in changes that were made after
`eslint --fix` was originally run.
2020-11-25 13:09:14 -05:00
webzwo0i 0a72459b3d frontend tests: fix trailing comma in runner.js 2020-11-25 09:04:34 +00:00
webzwo0i b98aaf4904
backend tests: change loglevel to WARN (#4514) 2020-11-25 02:20:50 -05:00
Richard Hansen c673a597f8 tests: Fix what appears to be a typo
This fixes a SonarCloud error.
2020-11-24 20:06:12 +00:00
Richard Hansen b8d07a42eb lint: Run `eslint --fix` on `bin/` and `tests/` 2020-11-24 20:06:12 +00:00
Richard Hansen 7df3ded66f lint: Put opening brace on same line as `function`
Normally I would let `eslint --fix` do this for me, but there's a bug
that causes:

    const x = function ()
    {
      // ...
    };

to become:

    const x = ()
    => {
      // ...
    };

which ESLint thinks is a syntax error. (It probably is; I don't know
enough about the automatic semicolon insertion rules to be confident.)
2020-11-24 20:06:12 +00:00
Richard Hansen cc988bd67b lint: Convert CR+LF line endings to LF 2020-11-24 20:06:12 +00:00
webzwo0i b71b606774
tests: Switch from Travis to Github Actions
Travis placed an unnecessary breaking restriction on our tests and failed to respond within 72 hours to our complaint.  This has forced us to introduce Github Actions to manage our testing.  This is hopefully a temporary measure while Travis either gets itself together or we find a non-Github requirement.
2020-11-24 18:12:41 +00:00
webzwo0i f2febcfc7e
minify: Fix gzip not triggered for packages (#4491)
* caching_middleware: fix gzip compression not triggered

* packages: If a client sets `Accept-Encoding: gzip`, the responseCache will
include `Content-Encoding: gzip` in all future responses, even
if a subsequent request does not set `Accept-Encoding` or another client
requests the file without setting `Accept-Encoding`.
Fix that.

* caching_middleware: use `test` instead of `match`

* add tests

* make code easier to understand

* make the regex more clear
2020-11-22 09:23:33 +00:00
Richard Hansen 1d491c0059 tests: Clean up Travis runner scripts
* Avoid bashisms.
  * Simplify `sed` of `settings.json`.
  * Wrap long lines.
  * Define and use the conventional log functions.
  * Quote variable expansions.
2020-11-22 09:22:14 +00:00
Richard Hansen c9eb4c72a5 tests: Kill Etherpad and wait for it to exit 2020-11-22 09:22:14 +00:00