Skip to content

Conversation

@Henddher
Copy link

@Henddher Henddher commented Jun 15, 2025

Replaces Koa with Express

Checklist

  • Use a separate branch in your local repo (not main).
  • Test coverage is 100% (or you have a story for why it's ok).

Note


husky > pre-commit (node v24.2.0)
ℹ No staged files match any configured task.
[koa-to-express 3432cec] Use v8 coverage (instead of babel).
 2 files changed, 28 insertions(+), 13 deletions(-)
❯ git push
Enter passphrase for key '/Users/henddher/.ssh/id_ed25519': 
husky > pre-push (node v24.2.0)

> [email protected] test:coverage
> npm test -- --coverage --collectCoverageFrom="src/**"


> [email protected] pretest
> npm run lint


> [email protected] lint
> eslint .


/Users/henddher/Documents/github/boardgame.io/src/server/api.test.ts
  1644:7  warning  Skipped test  jest/no-disabled-tests
  1660:7  warning  Skipped test  jest/no-disabled-tests

✖ 2 problems (0 errors, 2 warnings)


> [email protected] test
> cross-env NODE_ENV=test jest --coverage --collectCoverageFrom=src/**

 PASS  src/client/debug/utils/shortcuts.test.js
 PASS  src/client/react.ssr.test.tsx
 PASS  src/client/transport/socketio.test.ts
 PASS  src/client/client.test.ts
 PASS  src/server/api.test.ts
 PASS  src/core/flow.test.ts
 PASS  src/client/debug/tests/debug.test.ts
 PASS  src/client/react.test.tsx
 PASS  src/lobby/react.test.tsx
 PASS  src/server/index.test.ts
 PASS  src/client/react-native.test.js
 PASS  src/client/transport/local.test.ts
 PASS  src/plugins/main.test.ts
 PASS  src/lobby/client.test.ts
 PASS  src/server/db/flatfile.test.ts
 PASS  src/plugins/events/events.test.ts
 PASS  src/core/reducer.test.ts
 PASS  src/master/filter-player-view.test.ts
 PASS  src/core/turn-order.test.ts
 PASS  src/plugins/plugin-serializable.test.ts
 PASS  src/lobby/react.ssr.test.tsx
 PASS  src/lobby/connection.test.ts
 PASS  src/plugins/random/random.test.ts
 PASS  src/core/game.test.ts
 PASS  src/server/transport/socketio.test.ts
 PASS  src/plugins/plugin-log.test.ts
 PASS  src/core/player-view.test.ts
 PASS  src/server/auth.test.ts
 PASS  src/plugins/plugin-immer.test.ts
 PASS  src/server/db/localstorage.test.ts
 PASS  src/server/cors.test.ts
 PASS  src/plugins/plugin-player.test.ts
 PASS  src/server/transport/pubsub/in-memory-pub-sub.test.ts
 PASS  src/core/logger.test.js
 PASS  src/server/db/inmemory.test.ts
 PASS  src/testing/mock-random.test.ts
 PASS  src/server/db/index.test.ts
 PASS  src/client/transport/transport.test.ts
 PASS  src/ai/ai.test.ts
 PASS  src/server/transport/socketio-simultaneous.test.ts (5.153 s)
 PASS  src/master/master.test.ts (6.838 s)
-----------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                                                 
-----------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------
All files                    |   96.59 |    94.97 |   98.84 |   96.59 |                                                                                   
 ai                          |     100 |      100 |     100 |     100 |                                                                                   
  ai.ts                      |     100 |      100 |     100 |     100 |                                                                                   
  bot.ts                     |     100 |      100 |     100 |     100 |                                                                                   
  mcts-bot.ts                |     100 |      100 |     100 |     100 |                                                                                   
  random-bot.ts              |     100 |      100 |     100 |     100 |                                                                                   
 client                      |   99.91 |     99.4 |     100 |   99.91 |                                                                                   
  client.ts                  |     100 |      100 |     100 |     100 |                                                                                   
  manager.ts                 |   99.44 |    97.62 |     100 |   99.44 | 90                                                                                
  react-native.js            |     100 |      100 |     100 |     100 |                                                                                   
  react.tsx                  |     100 |      100 |     100 |     100 |                                                                                   
 client/transport            |     100 |    98.68 |     100 |     100 |                                                                                   
  local.ts                   |     100 |    97.67 |     100 |     100 | 39                                                                                
  socketio.ts                |     100 |      100 |     100 |     100 |                                                                                   
  transport.ts               |     100 |      100 |     100 |     100 |                                                                                   
 core                        |   92.88 |    87.22 |     100 |   92.88 |                                                                                   
  action-creators.ts         |     100 |      100 |     100 |     100 |                                                                                   
  action-types.ts            |     100 |      100 |     100 |     100 |                                                                                   
  backwards-compatibility.ts |   73.91 |       50 |     100 |   73.91 | 17-22                                                                             
  constants.ts               |     100 |      100 |     100 |     100 |                                                                                   
  errors.ts                  |     100 |      100 |     100 |     100 |                                                                                   
  flow.ts                    |   94.98 |    92.11 |     100 |   94.98 | 52-53,58-59,71-72,118-119,227-229,261-269,349-351,547-551,565-578,744,746-747     
  game-methods.ts            |     100 |      100 |     100 |     100 |                                                                                   
  game.ts                    |   91.23 |    88.57 |     100 |   91.23 | 61-62,64-65,69-70,104-107                                                         
  initialize.ts              |     100 |      100 |     100 |     100 |                                                                                   
  logger.ts                  |     100 |      100 |     100 |     100 |                                                                                   
  player-view.ts             |   94.87 |    33.33 |     100 |   94.87 | 26-27                                                                             
  reducer.ts                 |   90.79 |    77.27 |     100 |   90.79 | ...27-328,332-334,341-343,370-371,422-424,453-455,475-477,482-484,493-495,511-513 
  turn-order.ts              |   87.53 |    84.85 |     100 |   87.53 | 30-33,41-42,45-54,67-79,95-104,107-112,115-120,261-262,267-270,301-302            
 lobby                       |     100 |    98.94 |     100 |     100 |                                                                                   
  client.ts                  |     100 |    94.74 |     100 |     100 | 68-71                                                                             
  connection.ts              |     100 |      100 |     100 |     100 |                                                                                   
  create-match-form.tsx      |     100 |      100 |     100 |     100 |                                                                                   
  login-form.tsx             |     100 |      100 |     100 |     100 |                                                                                   
  match-instance.tsx         |     100 |      100 |     100 |     100 |                                                                                   
  react.tsx                  |     100 |      100 |     100 |     100 |                                                                                   
 master                      |   95.79 |    97.39 |     100 |   95.79 |                                                                                   
  filter-player-view.ts      |   75.49 |       80 |     100 |   75.49 | 28-38,77-78,89-100                                                                
  master.ts                  |     100 |      100 |     100 |     100 |                                                                                   
 plugins                     |   99.36 |    96.97 |     100 |   99.36 |                                                                                   
  main.ts                    |   98.73 |    92.68 |     100 |   98.73 | 287-290                                                                           
  plugin-events.ts           |     100 |      100 |     100 |     100 |                                                                                   
  plugin-immer.ts            |     100 |      100 |     100 |     100 |                                                                                   
  plugin-log.ts              |     100 |      100 |     100 |     100 |                                                                                   
  plugin-player.ts           |     100 |      100 |     100 |     100 |                                                                                   
  plugin-random.ts           |     100 |      100 |     100 |     100 |                                                                                   
  plugin-serializable.ts     |     100 |      100 |     100 |     100 |                                                                                   
 plugins/events              |   84.69 |    52.38 |     100 |   84.69 |                                                                                   
  events.ts                  |   84.69 |    52.38 |     100 |   84.69 | 145-146,149-150,159-175,182-183,193-201                                           
 plugins/random              |     100 |      100 |     100 |     100 |                                                                                   
  random.alea.ts             |     100 |      100 |     100 |     100 |                                                                                   
  random.ts                  |     100 |      100 |     100 |     100 |                                                                                   
 server                      |   98.82 |    99.42 |     100 |   98.82 |                                                                                   
  api.ts                     |   98.09 |    99.08 |     100 |   98.09 | 415-416,540-548                                                                   
  auth.ts                    |     100 |      100 |     100 |     100 |                                                                                   
  cors.ts                    |     100 |      100 |     100 |     100 |                                                                                   
  index.ts                   |     100 |      100 |     100 |     100 |                                                                                   
  util.ts                    |     100 |      100 |     100 |     100 |                                                                                   
 server/db                   |   90.18 |     97.7 |      90 |   90.18 |                                                                                   
  base.ts                    |   83.78 |      100 |      50 |   83.78 | 109-120,175-186,221-232,277-288                                                   
  flatfile.ts                |     100 |      100 |     100 |     100 |                                                                                   
  index.ts                   |     100 |      100 |     100 |     100 |                                                                                   
  inmemory.ts                |   83.92 |     91.3 |     100 |   83.92 | 106-107,117-137                                                                   
  localstorage.ts            |     100 |      100 |     100 |     100 |                                                                                   
 server/transport            |     100 |      100 |     100 |     100 |                                                                                   
  socketio.ts                |     100 |      100 |     100 |     100 |                                                                                   
 server/transport/pubsub     |   71.79 |    92.31 |      80 |   71.79 |                                                                                   
  generic-pub-sub.ts         |       0 |        0 |       0 |       0 | 1-11                                                                              
  in-memory-pub-sub.ts       |     100 |      100 |     100 |     100 |                                                                                   
 testing                     |     100 |      100 |     100 |     100 |                                                                                   
  mock-random.ts             |     100 |      100 |     100 |     100 |                                                                                   
-----------------------------|---------|----------|---------|---------|-----------------------------------------------------------------------------------

Test Suites: 41 passed, 41 total
Tests:       2 skipped, 798 passed, 800 total
Snapshots:   1 passed, 1 total
Time:        7.85 s
Ran all test suites.
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 10 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 779 bytes | 779.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:Henddher/boardgame.io.git
   6a7d210..3432cec  koa-to-express -> koa-to-express

@Henddher Henddher marked this pull request as ready for review June 15, 2025 17:09
@Henddher
Copy link
Author

Henddher commented Jun 21, 2025

Hi @delucis, thanks for allowing the workflow to run. Unfortunately, none of the other versions were tested as it failed with 10.x.

I upgraded react-scripts and removed node 10.x-16.x from the list of supported versions so I can eval if all works in the other versions listed - I added 18.x-24.x. Locally, I can only test node 18+. Maybe it's ok to remove all nodes < 18 ?

@delucis
Copy link
Member

delucis commented Jun 21, 2025

Hey @Henddher I’m not actively maintaining boardgame.io at the moment. I believe @benbot has been taking a look at maybe stepping up as a maintainer.

Because of that, I may be out of the loop, but I don’t see any discussion or issue where moving from Koa to Express was agreed?

@Henddher
Copy link
Author

Henddher commented Jun 21, 2025

Thanks @delucis
There was no issue per se about moving from koa to express. Just a couple of comments from @benbot about it, among other enhancements and maintenance work in #1192. I figured I could help out.

@delucis
Copy link
Member

delucis commented Jun 21, 2025

Thanks — missed that! Hopefully @benbot can take a look 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants