Source code
Revision control
Copy as Markdown
Other Tools
/* Any copyright is dedicated to the Public Domain.
"use strict";
// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------
var rule = require("../lib/rules/use-chromeutils-import");
var RuleTester = require("eslint").RuleTester;
const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: "latest" } });
// ------------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------------
function callError(messageId) {
return [{ messageId, type: "CallExpression" }];
}
ruleTester.run("use-chromeutils-import", rule, {
valid: [
`ChromeUtils.defineModuleGetter(this, "AppConstants",
],
invalid: [
{
errors: callError("useChromeUtilsImport"),
},
{
errors: callError("useChromeUtilsImport"),
},
{
errors: callError("useChromeUtilsImport"),
},
],
});