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

platinumazure / eslint-plugin-qunit / 5244492784

pending completion
5244492784

push

github

web-flow
Upgrade: Bump release-it from 15.10.1 to 15.11.0

Bumps [release-it](https://github.com/release-it/release-it) from 15.10.1 to 15.11.0.
- [Release notes](https://github.com/release-it/release-it/releases)
- [Changelog](https://github.com/release-it/release-it/blob/main/CHANGELOG.md)
- [Commits](https://github.com/release-it/release-it/compare/15.10.1...15.11.0)

---
updated-dependencies:
- dependency-name: release-it
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

653 of 653 branches covered (100.0%)

878 of 878 relevant lines covered (100.0%)

661.49 hits per line

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

100.0
/lib/rules/assert-args.js
1
/**
2
 * @fileoverview Check the number of arguments to QUnit's assertion functions.
3
 * @author Kevin Partington
4
 */
5
"use strict";
6

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

11
const assert = require("assert"),
8✔
12
    utils = require("../utils");
8✔
13

14
//------------------------------------------------------------------------------
15
// Rule Definition
16
//------------------------------------------------------------------------------
17

18
/** @type {import('eslint').Rule.RuleModule} */
19
module.exports = {
8✔
20
    meta: {
21
        type: "problem",
22
        docs: {
23
            description: "enforce that the correct number of assert arguments are used",
24
            category: "Possible Errors",
25
            url: "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/assert-args.md"
26
        },
27
        messages: {
28
            unexpectedArgCount: "Unexpected call to {{callee}} with {{argCount}} arguments.",
29
            unexpectedArgCountNoMessage: "Unexpected call to {{callee}} with {{argCount}} arguments and no error message."
30
        },
31
        schema: []
32
    },
33

34
    create: function (context) {
35
        const testStack = [],
1,320✔
36
            sourceCode = context.getSourceCode();
1,320✔
37

38
        function isPossibleMessage(argNode) {
39
            // For now, we will allow all nodes. Hoping to allow user-driven
40
            // configuration later.
41
            // E.g., to allow string literals only:
42
            // return lastArg.type === "Literal" && typeof lastArg.value === "string";
43

44
            // For now, allowing all nodes to be possible messages.
45
            return argNode;
1,056✔
46
        }
47

48
        function getAssertContext() {
49
            assert.ok(testStack.length);
2,600✔
50

51
            return testStack[testStack.length - 1].assertContextVar;
2,600✔
52
        }
53

54
        function checkAssertArity(callExpressionNode) {
55
            const allowedArities = utils.getAllowedArities(callExpressionNode.callee, getAssertContext()),
1,280✔
56
                assertArgs = callExpressionNode.arguments,
1,280✔
57
                lastArg = assertArgs[assertArgs.length - 1],
1,280✔
58
                mayHaveMessage = lastArg && isPossibleMessage(lastArg);
1,280✔
59

60
            const definitelyTooFewArgs = allowedArities.every(function (arity) {
1,280✔
61
                return assertArgs.length < arity;
1,312✔
62
            });
63

64
            if (mayHaveMessage && allowedArities.includes(assertArgs.length - 1)) {
1,280✔
65
                return;
528✔
66
            } else if (allowedArities.includes(assertArgs.length)) {
752✔
67
                return;
192✔
68
            }
69

70
            context.report({
560✔
71
                node: callExpressionNode,
72
                messageId: mayHaveMessage && !definitelyTooFewArgs ? "unexpectedArgCount" : "unexpectedArgCountNoMessage",
1,456✔
73
                data: {
74
                    callee: sourceCode.getText(callExpressionNode.callee),
75
                    argCount: assertArgs.length
76
                }
77
            });
78
        }
79

80
        return {
1,320✔
81
            "CallExpression": function (node) {
82
                if (utils.isTest(node.callee)) {
2,640✔
83
                    testStack.push({
1,312✔
84
                        assertContextVar: utils.getAssertContextNameForTest(node.arguments)
85
                    });
86
                } else if (testStack.length > 0 && utils.isAssertion(node.callee, getAssertContext())) {
1,328✔
87
                    checkAssertArity(node);
1,280✔
88
                }
89
            },
90

91
            "CallExpression:exit": function (node) {
92
                if (utils.isTest(node.callee)) {
2,640✔
93
                    testStack.pop();
1,312✔
94
                }
95
            }
96
        };
97
    }
98
};
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

© 2026 Coveralls, Inc