smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Tests fail if better-sqlite3 is not installed #9286

Closed monsanto closed 1 year ago

monsanto commented 1 year ago

To reproduce, delete node_modules/better-sqlite3 and run the tests, which will fail with

1) SQLite worker wrapper
     should support both statement strings and corresponding statement classes:
   TypeError: Cannot read properties of null (reading 'toString')
    at SQLDatabaseManager.run (dist\lib\sql.js:226:29)
    at Context.<anonymous> (test\lib\sql.js:24:18)

2) SQLite worker wrapper
     should support both inline and object params:
   TypeError: Cannot read properties of null (reading 'toString')
    at SQLDatabaseManager.run (dist\lib\sql.js:226:29)
    at Context.<anonymous> (test\lib\sql.js:28:18)

3) SQLite worker wrapper
     should retrieve one line from Database.get:
   TypeError: Cannot read properties of null (reading 'toString')
    at SQLDatabaseManager.get (dist\lib\sql.js:221:29)
    at Context.<anonymous> (test\lib\sql.js:32:33)
    at process.processImmediate (node:internal/timers:471:21)

Either the tests should not run or the library code should better handle the no-op case.

To truly fix this issue, the tests should also be run without better-sqlite3 in CI.

Also see discussion in #general-dev around this time.

mia-pi-git commented 1 year ago

Resolved in https://github.com/smogon/pokemon-showdown/commit/3bec1c0585694f38364204c3bd33b1a8c85ab099.