Skip to content

Commit

Permalink
test(*): update eslint-plugin-jest and enable recommended rules (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Feb 3, 2019
1 parent f35c20b commit f856e76
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
15 changes: 11 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,26 @@
"overrides": [
{
"files": [
"packages/eslint-plugin-tslint/**/*.ts",
"packages/eslint-plugin/**/*.js",
"packages/parser/**/*.ts",
"packages/typescript-estree/**/*.ts"
"packages/eslint-plugin-tslint/tests/**/*.ts",
"packages/eslint-plugin/tests/**/*.js",
"packages/parser/tests/**/*.ts",
"packages/typescript-estree/tests/**/*.ts"
],
"env": {
"jest/globals": true
},
"rules": {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-alias-methods": "error",
"jest/no-identical-title": "error",
"jest/no-jasmine-globals": "error",
"jest/no-jest-import": "error",
"jest/no-test-prefixes": "error",
"jest/no-test-callback": "error",
"jest/no-test-return-statement": "error",
"jest/prefer-to-have-length": "warn",
"jest/prefer-spy-on": "error",
"jest/valid-expect": "error"
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"cz-conventional-changelog": "2.1.0",
"eslint": "^5.12.1",
"eslint-plugin-eslint-plugin": "^2.0.1",
"eslint-plugin-jest": "^22.1.3",
"eslint-plugin-jest": "^22.2.2",
"glob": "7.1.2",
"husky": "^1.3.1",
"jest": "23.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/tests/lib/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('parser', () => {
sourceType: 'script',
useJSXTextNode: true
});
expect(spyScope).toHaveBeenCalledWith(jasmine.any(Object), {
expect(spyScope).toHaveBeenCalledWith(expect.any(Object), {
ecmaFeatures: {},
sourceType: 'script'
});
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-estree/tests/lib/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('parse()', () => {
});

expect(spy).toHaveBeenCalledWith(
jasmine.any(Object),
expect.any(Object),
{
code: 'let foo = bar;',
comment: true,
Expand All @@ -96,8 +96,8 @@ describe('parse()', () => {
projects: [],
range: true,
strict: false,
tokens: jasmine.any(Array),
tsconfigRootDir: jasmine.any(String),
tokens: expect.any(Array),
tsconfigRootDir: expect.any(String),
useJSXTextNode: false
},
false
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-estree/tests/lib/semanticInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('semanticInfo', () => {
badConfig.project = './tsconfigs.json';
expect(() =>
parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig)
).toThrowError(/File .+tsconfigs\.json' not found/);
).toThrow(/File .+tsconfigs\.json' not found/);
});

it('fail to read project file', () => {
Expand All @@ -188,7 +188,7 @@ describe('semanticInfo', () => {
badConfig.project = '.';
expect(() =>
parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig)
).toThrowError(/File .+semanticInfo' not found/);
).toThrow(/File .+semanticInfo' not found/);
});

it('malformed project file', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Warn on unsupported TypeScript version', () => {

it('should warn the user if they are using an unsupported TypeScript version', () => {
(semver.satisfies as jest.Mock).mockReturnValue(false);
console.log = jest.fn();
jest.spyOn(console, 'log').mockImplementation();
parser.parse('');
expect(console.log).toHaveBeenCalledWith(
expect.stringContaining(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2378,10 +2378,10 @@ eslint-plugin-eslint-plugin@^2.0.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.0.1.tgz#d275434969dbde3da1d4cb7a121dc8d88457c786"
integrity sha512-kJ5TZsRJH/xYstG07v3YeOy/W5SDAEzV+bvvoL0aiG1HtqDmg4mJvNPnn/JngANMmsx8oXlJrIcBTCpJzm+9kg==

eslint-plugin-jest@^22.1.3:
version "22.1.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.1.3.tgz#4444108dfcddc5d2117ed6dc551f529d7e73a99e"
integrity sha512-JTZTI6WQoNruAugNyCO8fXfTONVcDd5i6dMRFA5g3rUFn1UDDLILY1bTL6alvNXbW2U7Sc2OSpi8m08pInnq0A==
eslint-plugin-jest@^22.2.2:
version "22.2.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.2.2.tgz#2a80d70a20c27dfb1503a6f32cdcb647fe5476df"
integrity sha512-hnWgh9o39VJfz6lJEyQJdTW7dN2yynlGkmPOlU/oMHh+d7WVMsJP1GeDTB520VCDljEdKExCwD5IBpQIUl4mJg==

eslint-scope@^4.0.0:
version "4.0.0"
Expand Down

0 comments on commit f856e76

Please sign in to comment.