Commit Graph

53 Commits

Author SHA1 Message Date
Slayer95
b0dc94f196
Further update tests after startup refactor (#11521)
- Adds config.lazysockets to prevent listening to the network
- Fixes modlog tests
2026-01-25 07:58:21 -05:00
Slayer95
4b8c6a4d6d
Refactor startup (#11346)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
This minimizes side effects of import/require across the codebase,
and lets the caller be responsible of initializing child processeses,
as well as other async logic, such as restoring saved battles.
2025-10-17 19:37:47 -07:00
WifiLatency
9c1457ee9b
/ds: Collapsibles New Styling (#11041)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-04-21 05:07:44 -07:00
WifiLatency
c4a5ed50e4
/ds: Param to expand collapsible datasearches by default (#11023)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
* Reimplement all as a param to automatically expand nonbroadcast results.

* Tests ensuring datasearches don't expand when broadcast with all
2025-04-08 23:53:40 -06:00
WifiLatency
bdeb19f26a
/ds: Add rule functionality (#10973)
* /ds metagame rules with moves compability.

* mon attributes compatibility

* pokedex rule compatibility.

* clean up. support convergencelegality

* updated dexsearchhelp. better error feedback.

* Fix negations for abilities and moves.

* Scrapped convergence, cleanup.

* Updated dshelp for the mapped rule param values.

* Fixed duplicate formes and tests reciving species.

* Support /ds stacking multiple rules

* Apply suggestions from code review

* tests for /ds rule functionality

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2025-03-18 00:50:32 -06:00
Guangcong Luo
78439b4a02
Update to ESLint 9 (#10926)
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.

- First, we no longer have separate eslint-no-types configs. Lint
  performance shouldn't be enough of a problem to justify the
  relevant maintenance complexity.

- Second, our base config should work out-of-the-box now. `npx eslint`
  will work as expected, without any CLI flags. You should still use
  `npm run lint` which adds the `--cached` flag for performance.

- Third, whatever updates I did fixed style linting, which apparently
  has been bugged for quite some time, considering all the obvious
  mixed-tabs-and-spaces issues I found in the upgrade.

Also here are some changes to our style rules. In particular:

- Curly brackets (for objects etc) now have spaces inside them. Sorry
  for the huge change. ESLint doesn't support our old style, and most
  projects use Prettier style, so we might as well match them in this way.
  See https://github.com/eslint-stylistic/eslint-stylistic/issues/415

- String + number concatenation is no longer allowed. We now
  consistently use template strings for this.
2025-02-25 20:03:46 -08:00
Mia
b11177d530
Migrate to esbuild for compilation (#9203) 2022-12-22 15:19:29 -06:00
Alexander B
ca8e17109b
Datasearch: Show formes if sorted (#9190) 2022-12-15 19:52:42 -08:00
Alexander B
1d5334432e
Hangman: Prevent impossible guesses, escape HTML (#9033)
* Prevent guessing words with incorrect already revealed indexes

* Clarify hint length and use consts

* Escape HTML on words

* lint

* Hangman: Better testing for invalid guesses

* Hangman: Escape HTML characters

Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com>
2022-11-23 12:50:09 -08:00
Kris Johnson
d50c8c249b
Add Gen 9 (#8997) 2022-11-17 20:46:29 -05:00
sparksblade
c528075dc7
Fix abilitysearch for special char separators (#8872) 2022-08-24 20:49:09 -07:00
Mia
5925f4b7b0
Remove prefix-manager timeout tests 2022-06-17 07:39:12 -05:00
Kris Johnson
758356a55d
Add a timeout for userprefixes (#8667) 2022-02-22 17:44:48 -08:00
Annika
57f19246a8 Trivia: Support a cycle-specific leaderboard 2021-12-11 18:13:20 -08:00
Annika
1a41721aba Trivia: Make unit tests work without SQLite 2021-08-14 20:48:37 -07:00
Annika
0a33b52ad4 Trivia: Use transactions and split into a directory 2021-08-14 20:35:08 -07:00
Annika
dcb96fa7ed Trivia: Refactor to use SQLite as a storage backend 2021-08-14 20:35:08 -07:00
Mia
e5fbd64427
Support adding friends (#7333) 2021-07-16 12:56:34 -07:00
Annika
52a9378361 Trivia: Support combining multiple categories 2021-07-13 16:01:03 -07:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Mia
5f9072b2ba
Chat-monitor: Centralize functions and migrate to JSON (#8328) 2021-05-29 22:11:32 -07:00
Annika
83df279b1d
Add a chat plugin to manage username prefixes (#8338) 2021-05-26 14:39:13 -07:00
Annika
f6b21b90ce Trivia: Support games with fewer than 3 players
Requested by Trivia roomstaff
2021-05-02 21:36:22 -07:00
Annika
c1fa436e35 Trivia: Implement a /trivia unrankednew command
This enables the creation of Trivia officials that do not reward points.
2021-03-20 12:30:46 -07:00
Adam Tran
14744879c8
Fix excluding variables in /ms (#7859) 2021-01-18 11:42:58 -06:00
Guangcong Luo
a68656a8e7 Support destroying rooms in unit tests
Matchmaking unit tests currently rely on destroying and re-creating a
user causing them to forget about battles they're in, which is not
actually supposed to happen, and breaks #7815.
2021-01-10 03:39:01 -08:00
Guangcong Luo
66fe68e8ee Tests: Refactor users-utils
The old users-utils had an unnecessarily difficult-to-use API. This
new one should be more straightforward and unified.
2021-01-09 22:33:32 -08:00
Adam Tran
6702decd95
Add Pivot moves as a /ms category (#7822)
* draft test

* Move search for pivot moves
2020-12-26 21:57:03 -08:00
Annika
f2bfc82ca1
Chat monitor: Improve the handling of usernames (#7786)
* Chat monitor: Improve the handling of usernames

This PR ignores word boundaries in evasion regexes when filtering usernames, preventing the use of usernames with evasions of slurs in them.

* properly fix merge conflicts
2020-12-14 12:55:11 -08:00
Annika
a1b085f033
Chat monitor: Support unit tests (#7710) 2020-11-26 01:33:09 -08:00
Mia
6145fab828
Allow the Help auto-response filter to be used in all rooms (#7645) 2020-11-08 20:16:25 -08:00
Guangcong Luo
a65faf263f
Stop using assert.strict.strictEqual (#7515)
It turns out that when I switched us from `assert` to `assert.strict`,
I didn't actually update any existing tests or tell anyone:

0df0d234f2

So apparently everyone else just kept on using `strictEqual`.

This will be a PR and also throw an error if people continue trying to
use it, which should make it much clearer what PS policy is on this.

A lot of the problem may be that TypeScript marks assert.strict.equal
as deprecated when it's not. This was fixed 4 days ago:

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48452

But this probably hasn't made it to a thing yet. Until then, you'll
have to deal with TS marking your tests as deprecated, but it shouldn't
be too long.

Accidentally using `assert` instead of `assert.strict` should now show
an error. This protects against the probably much worse mistake of
accidentally using `assert.equal` rather than `assert.strict.equal`.

`assert.ok` is also deprecated now.
2020-10-14 01:19:03 -07:00
Kris Johnson
b107236dc5
Repeats: Refactor storing and deleting repeats, let people repeat room FAQs (#7488) 2020-10-07 23:42:30 -07:00
Mia
4279d1f3bc
Update attributions in various locations (#7354) 2020-10-06 15:55:26 -07:00
Annika
216e4a7354
Add a plugin to repeat phrases in chatrooms (#7338) 2020-10-05 14:25:18 -07:00
Annika
1e20f6a96f
Trivia: Add leaderboard management commands (#7402) 2020-09-20 16:33:03 -07:00
Annika
6d8d0bd93a
Trivia: Use Chat.ErrorMessage more (#7384) 2020-09-18 16:19:26 -07:00
Annika
422649dca7
Trivia: Add a new game called Mastermind (#7368) 2020-09-14 16:03:50 -07:00
Annika
c9fa3fc389
Refactor User#prevNames and User#ips to arrays (#7267) 2020-08-29 10:27:03 -07:00
Mia
d8ecdb5f83
Help: Only write state when relevant to the room (#7207) 2020-08-18 13:06:52 -07:00
Mia
fbe5d90dd0
Youtube: Add tests (#7081) 2020-08-06 00:34:18 -07:00
Mia
647d5af76f
Add a filter for auto-answering questions in the Help room (#7100) 2020-08-05 23:44:46 -07:00
Annika
577b858994
Tests: Allow requiring Config at the top level (#7109)
This solves issues like https://github.com/smogon/pokemon-showdown/pull/7100#discussion_r463922425 and makes it easier to test chat plugins.
2020-08-02 22:10:22 -07:00
Annika
cd85cd7a9d
Hosts & IPTools: Refactor to remove hardcoded ranges (#7078) 2020-07-29 23:04:50 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Kris Johnson
18fbcbc914
Typescript Trivia (#6768) 2020-05-29 23:53:52 -07:00
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
Guangcong Luo
229f5f809d Use assert in strict mode
This makes it so we can use `assert.equal` instead of
`assert.strictEqual`, which I think is more readable.
2020-02-20 00:39:31 -08:00
Waleed Hassan
da4b887054 Rename Room#id -> Room#roomid, User#userid -> User#id (#5826)
These should make it clearer that userids are IDs but roomids aren't.
2019-10-03 18:57:38 +10:00
TheJetOU
2b28c9fd6b Refactor Rooms(), Users() to Rooms.get(), Users.get() (#5725) 2019-08-25 06:33:56 -07:00