Skip to content

Commit 685426d

Browse files
armano2ljharb
authored andcommitted
test: align usage of jest expect across tests
1 parent c460a8b commit 685426d

File tree

61 files changed

+44
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+44
-89
lines changed

.eslintrc

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
{
2-
extends: [
2+
"extends": [
33
"airbnb-base",
44
"plugin:flowtype/recommended"
55
],
6-
parser: "@babel/eslint-parser",
7-
plugins: [
8-
"flowtype"
6+
"parser": "@babel/eslint-parser",
7+
"plugins": [
8+
"flowtype",
99
],
10-
rules: {
11-
'max-len': 'off',
12-
'no-template-curly-in-string': 'off',
10+
"rules": {
11+
"max-len": "off",
12+
"no-template-curly-in-string": "off",
1313
},
1414
"overrides": [
1515
{
16-
"files": ["src/rules/*.js"],
16+
"files": ["src/rules/*"],
1717
"extends": ["plugin:eslint-plugin/rules-recommended"],
1818
"rules": {
1919
"eslint-plugin/require-meta-docs-url": [
2020
"error",
21-
{ "pattern": "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/{{name}}.md" }
21+
{ "pattern": "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/{{name}}.md" },
2222
],
23-
"eslint-plugin/require-meta-type": "off"
24-
}
23+
"eslint-plugin/require-meta-type": "off",
24+
},
2525
},
2626
{
2727
"files": ["__tests__/src/rules/*.js"],
28-
"extends": ["plugin:eslint-plugin/tests-recommended"]
29-
}
30-
]
28+
"extends": ["plugin:eslint-plugin/tests-recommended"],
29+
},
30+
{
31+
"files": ["__tests__/**/*"],
32+
"env": {
33+
"jest": true,
34+
},
35+
},
36+
],
3137
}

__tests__/index-test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/* eslint-env jest */
21
/* eslint global-require: 0 */
32

4-
import assert from 'assert';
53
import fs from 'fs';
64
import path from 'path';
5+
import expect from 'expect';
76
import plugin from '../src';
87

98
const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/'))
@@ -12,8 +11,7 @@ const rules = fs.readdirSync(path.resolve(__dirname, '../src/rules/'))
1211
describe('all rule files should be exported by the plugin', () => {
1312
rules.forEach((ruleName) => {
1413
it(`should export ${ruleName}`, () => {
15-
assert.equal(
16-
plugin.rules[ruleName],
14+
expect(plugin.rules[ruleName]).toEqual(
1715
require(path.join('../src/rules', ruleName)) // eslint-disable-line
1816
);
1917
});
@@ -22,7 +20,7 @@ describe('all rule files should be exported by the plugin', () => {
2220

2321
describe('configurations', () => {
2422
it('should export a \'recommended\' configuration', () => {
25-
assert(plugin.configs.recommended);
23+
expect(plugin.configs.recommended).toBeDefined();
2624
});
2725
});
2826

@@ -33,7 +31,7 @@ describe('schemas', () => {
3331
const schema = rule.meta && rule.meta.schema && rule.meta.schema[0];
3432
const { type } = schema;
3533

36-
assert.deepEqual(type, 'object');
34+
expect(type).toEqual('object');
3735
});
3836
});
3937
});

__tests__/src/rules/accessible-emoji-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce <marquee> elements are not used.
43
* @author Ethan Cohen

__tests__/src/rules/alt-text-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce all elements that require alternative text have it.
43
* @author Ethan Cohen

__tests__/src/rules/anchor-has-content-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce anchor elements to contain accessible content.
43
* @author Lisa Ring & Niklas Holmberg

__tests__/src/rules/anchor-is-valid-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Performs validity check on anchor hrefs. Warns when anchors are used as buttons.
43
* @author Almero Steyn

__tests__/src/rules/aria-props-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce all aria-* properties are valid.
43
* @author Ethan Cohen

__tests__/src/rules/aria-proptypes-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce ARIA state and property values are valid.
43
* @author Ethan Cohen
@@ -10,6 +9,7 @@
109

1110
import { aria } from 'aria-query';
1211
import { RuleTester } from 'eslint';
12+
import expect from 'expect';
1313
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
1414
import rule from '../../../src/rules/aria-proptypes';
1515

__tests__/src/rules/aria-role-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce aria role attribute is valid.
43
* @author Ethan Cohen

__tests__/src/rules/aria-unsupported-elements-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-env jest */
21
/**
32
* @fileoverview Enforce that elements that do not support ARIA roles,
43
* states and properties do not have those attributes.

0 commit comments

Comments
 (0)