Skip to content

Test suite follow-ups from the assertion audit #18521

Open

Description

@wikirik-agent

While auditing the test suite for assertions that cannot fail (#18509, #18520), we found more things that make tests weaker than they look. #18520 deliberately left these out, because they are judgement calls or need decisions per dialect rather than being plain bugs.

We haven't decided yet which of these, if any, we want to fix. This issue tracks the candidates so they don't get lost. Decide per item before opening a PR.

Line numbers are as of 241ba93. Some files are also touched by #18520, so lines may shift.

1. Tests that return early instead of skipping

62 tests return from inside the it() when a dialect doesn't support something. Mocha reports them as passed, although they ran nothing. Calling this.skip(), or moving the guard outside the it(), would report them as pending instead. Most are if (dialect.supports.schemas) return in unit/query-generator/*.

Full list
test/unit/pool.test.ts:76 | dialectName !== 'postgres'
test/unit/transaction.test.ts:95 | !sequelize.dialect.supports.savepoints
test/integration/instance.test.js:90 | !Support.sequelize.dialect.supports.upserts
test/integration/json.test.ts:67 | dialect.name === 'oracle' && !(await isOracleJSONConstraintsSupported())
test/integration/json.test.ts:163 | dialectName !== 'mariadb'
test/integration/json.test.ts:353 | ['mariadb', 'mysql', 'mssql'].includes(dialectName)
test/integration/configuration.test.ts:148 | dialectName !== 'sqlite3'
test/integration/model.test.js:1708 | !dialect.supports.dataTypes.BIGINT
test/unit/utils/sql.test.ts:252 | !supportsNonStandardConformingStrings()
test/unit/utils/sql.test.ts:661 | !supportsNonStandardConformingStrings()
test/unit/utils/sql.test.ts:940 | !supportsNonStandardConformingStrings()
test/integration/model/findOne.test.js:56 | dialectName === 'sqlite3'
test/integration/model/json.test.js:287 | dialect.name === 'oracle' && !(await Support.isOracleJSONConstraintsSupported())
test/integration/model/sync.test.js:543 | !sequelize.dialect.supports.schemas
test/integration/model/internals.test.ts:33 | dialectName === 'sqlite3'
test/integration/model/internals.test.ts:68 | dialectName === 'sqlite3'
test/integration/model/internals.test.ts:101 | dialectName === 'sqlite3'
test/integration/model/create.test.js:497 | ['sqlite3', 'mssql', 'db2', 'ibmi', 'oracle'].includes(dialectName)
test/integration/model/create.test.js:536 | dialectName === 'sqlite3'
test/integration/model/create.test.js:590 | dialectName === 'sqlite3'
test/integration/model/create.test.js:1016 | dialectName.startsWith('postgres')
test/integration/model/paranoid.test.js:125 | dialect.name === 'oracle' && !(await Support.isOracleJSONConstraintsSupported())
test/integration/sequelize/drop.test.ts:44 | !sequelize.dialect.supports.dropTable.cascade
test/integration/data-types/methods.test.ts:187 | !dialect.supports.upserts
test/integration/data-types/data-types.test.ts:1114 | dialect.name === 'mssql'
test/unit/model/validation.test.js:364 | !dialect.supports.dataTypes.ARRAY
test/unit/sql/literal.test.ts:169 | !dialect.supports.dataTypes.ARRAY
test/unit/query-interface/create-table.test.ts:124 | !dialect.supports.dataTypes.JSON
test/unit/query-interface/upsert.test.ts:30 | dialectName === 'oracle'
test/unit/query-interface/upsert.test.ts:113 | sequelize.dialect.supports.returnIntoValues
test/unit/query-interface/upsert.test.ts:174 | sequelize.dialect.supports.returnIntoValues
test/unit/query-interface/insert.test.ts:25 | dialect.supports.returnIntoValues
test/unit/query-interface/insert.test.ts:84 | dialect.supports.returnIntoValues
test/unit/query-interface/insert.test.ts:120 | dialect.supports.returnIntoValues
test/unit/query-generator/get-constraint-snippet.test.ts:179 | dialect.supports.schemas
test/unit/query-generator/get-constraint-snippet.test.ts:311 | dialect.supports.schemas
test/unit/query-generator/get-constraint-snippet.test.ts:445 | dialect.supports.schemas
test/unit/query-generator/get-constraint-snippet.test.ts:661 | dialect.supports.schemas
test/unit/query-generator/get-constraint-snippet.test.ts:811 | dialect.supports.schemas
test/unit/query-generator/describe-table-query.test.ts:486 | dialect.supports.schemas
test/unit/query-generator/create-table-query.test.ts:99 | dialect.supports.schemas
test/unit/query-generator/create-table-query.test.ts:339 | !dialect.supports.dataTypes.ARRAY
test/unit/query-generator/truncate-table-query.test.ts:130 | dialect.supports.schemas
test/unit/query-generator/truncate-table-query.test.ts:149 | dialect.supports.schemas
test/unit/query-generator/bulk-delete-query.test.ts:151 | dialect.supports.schemas
test/unit/query-generator/bulk-insert-query.test.ts:21 | dialect === 'oracle'
test/unit/query-generator/add-constraint-query.test.ts:182 | dialect.supports.schemas
test/unit/query-generator/add-constraint-query.test.ts:321 | dialect.supports.schemas
test/unit/query-generator/add-constraint-query.test.ts:468 | dialect.supports.schemas
test/unit/query-generator/add-constraint-query.test.ts:697 | dialect.supports.schemas
test/unit/query-generator/add-constraint-query.test.ts:858 | dialect.supports.schemas
test/unit/query-generator/table-exists-query.test.ts:90 | dialect.supports.schemas
test/unit/query-generator/remove-column-query.test.ts:88 | dialect.supports.schemas
test/unit/query-generator/rename-table-query.test.ts:131 | dialect.supports.schemas
test/unit/query-generator/remove-constraint-query.test.ts:122 | dialect.supports.schemas
test/unit/query-generator/show-constraints-query.test.ts:150 | dialect.supports.schemas
test/unit/query-generator/show-indexes-query.test.ts:213 | dialect.supports.schemas
test/unit/query-generator/drop-table-query.test.ts:74 | dialect.supports.schemas
test/unit/query-generator/insert-query.test.ts:132 | !dialect.supports.returnIntoValues
test/unit/query-generator/insert-query.test.ts:152 | !sequelize.dialect.supports.dataTypes.ARRAY
test/unit/query-generator/insert-query.test.ts:202 | dialect.supports.returnIntoValues
test/unit/query-generator/insert-query.test.ts:234 | dialect.supports.returnIntoValues

2. Tests that assert nothing on some dialects that run them

  • integration/model/create.test.js:1016 "is possible to use functions as default values": only asserts on postgres and sqlite3. mysql, mariadb, mssql, db2, ibmi, oracle and snowflake run it but check nothing.
  • integration/query-interface/describeTable.test.js:68: only asserts on postgres, mysql and mssql. mariadb and db2 return column comments as well, so they could probably be added.
  • integration/query-interface/createTable.test.js:17: asserts nothing on sqlite3, db2, ibmi, oracle or snowflake.
  • integration/query-interface/createTable.test.js enum tests (105, 116, 129, 144, 167, 182): only postgres asserts anything. mysql and mariadb could check that the column type contains ENUM(.

3. Assertions without an error class or message

These pass if the code fails for an unrelated reason. None is known to be wrong today.

  • 131 bare .to.be.rejected (including 3 .eventually.be.rejected). 62 of them are in integration/data-types/data-types.test.ts, 13 in instance.validations.test.js and 8 in hooks/bulkOperation.test.js.
  • 30 bare .to.throw(): decorator tests in attribute.test.ts/table.test.ts, postgres range-data-type.test.ts, BOOLEAN/STRING validate, @sequelize/utils parsers and predicates, sequelize.test.ts:98, and the clone helpers.

4. Smaller items

  • integration/dialects/postgres/query.test.js:407 "supports alias minification with long model names in joins" queries empty tables, so it can't detect a wrong alias mapping, only a SQL error.
  • integration/json.test.ts: the findOne(...) + .to.exist tests only have a matching row. A where that is ignored would still pass.
  • integration/model/attributes/types.test.js: this.sqlAssert is a spy since meta: fix test assertions that cannot fail and lint for them #18520, but the bulkCreate and exclude tests still don't check that it was called.
  • integration/model/findAll.test.js "should return raw data when raw is true" asserts on users[0] inside the loop instead of on user.
  • unit/transaction.test.ts:85: the try block has no failure path, so the test would pass if snowflake stopped throwing.
  • The mssql package doesn't load chai-as-promised, so its tests can't use rejectedWith.
  • Redundant checks that add noise but no coverage:
    • .not.to.be.null right after create()/findAll(): geography/geometry tests, searchPath.test.js, schema.test.js, sequelize.test.js:307,312,328, bulk-create.test.js:405, BLOB tests in model.test.js, postgres connection-manager.test.ts:25.
    • expect(error).to.be.instanceOf(X) right after rejectedWith(X), kept in meta: fix test assertions that cannot fail and lint for them #18520 to keep its diff small.
  • include/findAll.test.js and include/schema.test.js each contain two tests with the same title.

🤖 Generated with Claude Code

Activity

  1. added
    pending-approvalBug reports that have not been verified yet, or feature requests that have not been accepted yet
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-approvalBug reports that have not been verified yet, or feature requests that have not been accepted yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions