• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

platinumazure / eslint-plugin-qunit / 4748569255

pending completion
4748569255

push

github

GitHub
Upgrade: Bump eslint from 8.36.0 to 8.38.0 (#335)

653 of 653 branches covered (100.0%)

878 of 878 relevant lines covered (100.0%)

82.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/rules/no-assert-ok.js
1
/**
2
 * @fileoverview Forbid the use of assert.ok/assert.notOk and suggest other assertions.
3
 * @author ventuno
4
 */
5
"use strict";
6

7
//------------------------------------------------------------------------------
8
// Requirements
9
//------------------------------------------------------------------------------
10

11
const utils = require("../utils");
1✔
12

13
//------------------------------------------------------------------------------
14
// Rule Definition
15
//------------------------------------------------------------------------------
16

17
const GLOBAL_ERROR_MESSAGE_ID = "unexpectedGlobalOkNotOk";
1✔
18
const LOCAL_ERROR_MESSAGE_ID = "unexpectedLocalOkNotOk";
1✔
19
const assertions = ["ok", "notOk"];
1✔
20
const ERROR_MESSAGE_CONFIG = {
1✔
21
    ok: { unexpectedGlobalAssertionMessageId: GLOBAL_ERROR_MESSAGE_ID,
22
        unexpectedLocalAssertionMessageId: LOCAL_ERROR_MESSAGE_ID },
23
    notOk: { unexpectedGlobalAssertionMessageId: GLOBAL_ERROR_MESSAGE_ID,
24
        unexpectedLocalAssertionMessageId: LOCAL_ERROR_MESSAGE_ID }
25
};
26

27
/** @type {import('eslint').Rule.RuleModule} */
28
module.exports = {
1✔
29
    meta: {
30
        type: "suggestion",
31
        docs: {
32
            description: "disallow the use of assert.ok/assert.notOk",
33
            category: "Best Practices"
34
        },
35
        messages: {
36
            [GLOBAL_ERROR_MESSAGE_ID]: "Unexpected {{assertion}}. Use strictEqual, deepEqual, or propEqual.",
37
            [LOCAL_ERROR_MESSAGE_ID]: "Unexpected {{assertVar}}.{{assertion}}. Use {{assertVar}}.strictEqual, {{assertVar}}.deepEqual, or {{assertVar}}.propEqual."
38
        },
39
        schema: []
40
    },
41

42
    create: utils.createAssertionCheck(assertions, ERROR_MESSAGE_CONFIG)
43
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc