Skip to content

Help testing, improving and suggesting improvements for MySQL driver support branch

Uncategorized
1 1 0
  • I have a pull request:
    https://github.com/NodeBB/NodeBB/pull/13413

    Everything seems to work for me with my MySQL setup.
    12364dbf-4a0b-4d0f-93bb-9e470bd16b54-image.png
    All 4947 tests are passing.

    That is more than the current test setup.
    b3f272ca-1805-418e-9fa0-522dbd4bf8d1-image.png
    I fixed some wrong test discovery phase workarounds so there are more tests running now.
    I solved it with top-level await to init the database in top-level instead of in before, because some describes depend on a running database in the test discovery phase. The workaround with putting a describe in an it doesn't work.

    I translated many CommonJS test files to ESM files because the require('mocks/databasemock.mjs') doesn't work, because it contains now the top-level await. Requiring mjs files from cjs files is only allowed if the mjs doesn't contain any top-level await. Requiring mjs files is only possible without workarounds since Node.js version 20.19 (https://github.com/nodejs/node/pull/56927). So I changed the recommended Node.js version in package.json to >= 20.19.0. I then found a workaround to abuse the test loading of mocha to load mocks/databasemock.mjs as a test before any other test and then it works because mocha can load cjs and mjs tests and the mjs tests are allowed to have top-level await and they are dynamically imported correctly from mocha.

    Right now only MySQL 8.0 works. MariaDB doesn't work. At least I got an error when trying to use MariaDB and I didn't spend time fixing it.

    Please help with suggestions for improvement, manual tests, ...!

  • support@community.nodebb.orgS support@community.nodebb.org shared this topic