Commit 559b567e authored by Nathan Friend's avatar Nathan Friend

Merge branch 'vs-enable-jest-config' into 'master'

Enable our Jest configuration

See merge request gitlab-org/gitlab!31090
parents b8a955f5 7ff7d838
---
env:
jest/globals: true
plugins:
- jest
extends:
- 'plugin:jest/recommended'
- 'plugin:@gitlab/jest'
settings:
# We have to teach eslint-plugin-import what node modules we use
# otherwise there is an error when it tries to resolve them
......@@ -20,3 +16,12 @@ globals:
loadFixtures: false
preloadFixtures: false
setFixtures: false
rules:
jest/expect-expect:
- off
- assertFunctionNames:
- 'expect*'
- 'assert*'
- 'testAction'
jest/no-test-callback:
- off
......@@ -41,7 +41,6 @@ describe('New discussion', () => {
describe('Get note', () => {
beforeEach(() => {
expect(Object.keys(CommentsStore.state).length).toBe(0);
createDiscussion();
});
......@@ -55,7 +54,6 @@ describe('Get note', () => {
describe('Delete discussion', () => {
beforeEach(() => {
expect(Object.keys(CommentsStore.state).length).toBe(0);
createDiscussion();
});
......@@ -81,7 +79,6 @@ describe('Delete discussion', () => {
describe('Update note', () => {
beforeEach(() => {
expect(Object.keys(CommentsStore.state).length).toBe(0);
createDiscussion();
});
......@@ -96,7 +93,6 @@ describe('Update note', () => {
describe('Discussion resolved', () => {
beforeEach(() => {
expect(Object.keys(CommentsStore.state).length).toBe(0);
createDiscussion();
});
......
// eslint-disable-next-line jest/no-export
export default class ClassSpecHelper {
static itShouldBeAStaticMethod(base, method) {
return it('should be a static method', () => {
......
......@@ -11,6 +11,7 @@ describe('axios_utils', () => {
mock = new AxiosMockAdapter(axios);
mock.onAny('/ok').reply(200);
mock.onAny('/err').reply(500);
// eslint-disable-next-line jest/no-standalone-expect
expect(axios.countActiveRequests()).toBe(0);
});
......
......@@ -20,7 +20,6 @@ describe('Release detail mutations', () => {
release = convertObjectPropsToCamelCase(originalRelease);
});
// eslint-disable-next-line jest/valid-describe
describe(types.REQUEST_RELEASE, () => {
it('set state.isFetchingRelease to true', () => {
mutations[types.REQUEST_RELEASE](state);
......@@ -29,7 +28,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.RECEIVE_RELEASE_SUCCESS, () => {
it('handles a successful response from the server', () => {
mutations[types.RECEIVE_RELEASE_SUCCESS](state, release);
......@@ -44,7 +42,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.RECEIVE_RELEASE_ERROR, () => {
it('handles an unsuccessful response from the server', () => {
const error = { message: 'An error occurred!' };
......@@ -58,7 +55,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.UPDATE_RELEASE_TITLE, () => {
it("updates the release's title", () => {
state.release = release;
......@@ -69,7 +65,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.UPDATE_RELEASE_NOTES, () => {
it("updates the release's notes", () => {
state.release = release;
......@@ -80,7 +75,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.REQUEST_UPDATE_RELEASE, () => {
it('set state.isUpdatingRelease to true', () => {
mutations[types.REQUEST_UPDATE_RELEASE](state);
......@@ -89,7 +83,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.RECEIVE_UPDATE_RELEASE_SUCCESS, () => {
it('handles a successful response from the server', () => {
mutations[types.RECEIVE_UPDATE_RELEASE_SUCCESS](state, release);
......@@ -100,7 +93,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.RECEIVE_UPDATE_RELEASE_ERROR, () => {
it('handles an unsuccessful response from the server', () => {
const error = { message: 'An error occurred!' };
......@@ -112,7 +104,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.ADD_EMPTY_ASSET_LINK, () => {
it('adds a new, empty link object to the release', () => {
state.release = release;
......@@ -132,7 +123,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.UPDATE_ASSET_LINK_URL, () => {
it('updates an asset link with a new URL', () => {
state.release = release;
......@@ -148,7 +138,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.UPDATE_ASSET_LINK_NAME, () => {
it('updates an asset link with a new name', () => {
state.release = release;
......@@ -164,7 +153,6 @@ describe('Release detail mutations', () => {
});
});
// eslint-disable-next-line jest/valid-describe
describe(types.REMOVE_ASSET_LINK, () => {
it('removes an asset link from the release', () => {
state.release = release;
......
......@@ -56,13 +56,8 @@ describe('date time picker lib', () => {
describe('stringToISODate', () => {
['', 'null', undefined, 'abc'].forEach(input => {
it(`throws error for invalid input like ${input}`, done => {
try {
dateTimePickerLib.stringToISODate(input);
} catch (e) {
expect(e).toBeDefined();
done();
}
it(`throws error for invalid input like ${input}`, () => {
expect(() => dateTimePickerLib.stringToISODate(input)).toThrow();
});
});
[
......
......@@ -4385,11 +4385,6 @@ eslint-plugin-jasmine@^4.1.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-jasmine/-/eslint-plugin-jasmine-4.1.0.tgz#4f6d41b1a8622348c97559cbcd29badffa74dbfa"
integrity sha512-Vfuk2Sm1ULR7MqGjVIOOEdQWyoFBfSwvwUeo9MrajVGJB3C24c9Mmj1Cgf8Qwmf3aS2bezPt1sckpKXWpd74Dw==
eslint-plugin-jest@^22.3.0:
version "22.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.3.0.tgz#a10f10dedfc92def774ec9bb5bfbd2fb8e1c96d2"
integrity sha512-P1mYVRNlOEoO5T9yTqOfucjOYf1ktmJ26NjwjH8sxpCFQa6IhBGr5TpKl3hcAAT29hOsRJVuMWmTsHoUVo9FoA==
eslint-plugin-jest@^23.8.2:
version "23.8.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz#6f28b41c67ef635f803ebd9e168f6b73858eb8d4"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment