Skip to content

Commit 2c16234

Browse files
chore: add jest global variables (freeCodeCamp#42573)
1 parent 42e8b22 commit 2c16234

File tree

82 files changed

+8
-114
lines changed

Some content is hidden

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

82 files changed

+8
-114
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"es6": true,
44
"browser": true,
55
"mocha": true,
6-
"node": true
6+
"node": true,
7+
"jest": true
78
},
89
"parser": "babel-eslint",
910
"root": true,

api-server/src/common/models/User-Identity.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import { ensureLowerCaseEmail } from './User-Identity';
32

43
test('returns lowercase email when one exists', () => {

api-server/src/server/boot_tests/certificate.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global it expect */
2-
31
import { getFallbackFrontEndDate } from '../boot/certificate';
42
import { fullStackChallenges } from './fixtures';
53

api-server/src/server/boot_tests/challenge.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe xdescribe it expect jest */
21
import { first, find } from 'lodash';
32

43
import {

api-server/src/server/boot_tests/fixtures.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global jest*/
21
import { isEqual } from 'lodash';
32
import { isEmail } from 'validator';
43

api-server/src/server/middlewares/request-authorization.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect jest */
21
import { mockReq as mockRequest, mockRes } from '../boot_tests/challenge.test';
32
import jwt from 'jsonwebtoken';
43

api-server/src/server/utils/date-utils.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe expect it */
21
import moment from 'moment-timezone';
32

43
import { dayCount } from './date-utils';

api-server/src/server/utils/donation.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/* eslint-disable camelcase */
2-
/* global describe it expect */
3-
/* global jest*/
4-
52
import axios from 'axios';
63
import keys from '../../../../config/secrets';
74
import {

api-server/src/server/utils/getSetAccessToken.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect */
21
import {
32
getAccessTokenFromRequest,
43
errorTypes,

api-server/src/server/utils/in-memory-cache.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe beforeEach expect it jest */
21
import inMemoryCache from './in-memory-cache';
32

43
describe('InMemoryCache', () => {

api-server/src/server/utils/redirection.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global describe expect it jest */
2-
31
const jwt = require('jsonwebtoken');
42

53
const { getReturnTo, normalizeParams } = require('./redirection');

api-server/src/server/utils/user-stats.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect jest */
21
import moment from 'moment-timezone';
32

43
import {

client/i18n/locales.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import {
32
availableLangs,
43
langDisplayNames,

client/src/__mocks__/react-i18nextMock.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable react/prop-types */
22
/* eslint-disable react/display-name */
3-
/* global jest */
43
import React from 'react';
54

65
const reactI18next = jest.genMockFromModule('react-i18next');

client/src/__tests__/integration/handled-error.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect */
21
import {
32
wrapHandledError,
43
unwrapHandledError

client/src/client-only-routes/ShowSettings.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global jest, expect */
21
import React from 'react';
32
import ShallowRenderer from 'react-test-renderer/shallow';
43
import envData from '../../../config/env.json';

client/src/components/Footer/Footer.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import React from 'react';
32
import renderer from 'react-test-renderer';
43

client/src/components/Header/Header.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import React from 'react';
32
import ShallowRenderer from 'react-test-renderer/shallow';
43

client/src/components/Intro/Intro.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import React from 'react';
32
import renderer from 'react-test-renderer';
43
import { Provider } from 'react-redux';

client/src/components/Map/Map.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import React from 'react';
42
import { useStaticQuery } from 'gatsby';
53
import { render } from '@testing-library/react';

client/src/components/createExternalRedirects.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import createExternalRedirect from './createExternalRedirects';
42

53
describe('createExternalRedirects', () => {

client/src/components/createLanguageRedirect.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import createLanguageRedirect from './createLanguageRedirect';
42

53
describe('createLanguageRedirect for clientLocale === english', () => {

client/src/components/formHelpers/BlockSaveButton.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53

client/src/components/formHelpers/BlockSaveWrapper.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53

client/src/components/formHelpers/Form.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global jest, expect */
2-
31
import React from 'react';
42
import { render, fireEvent } from '@testing-library/react';
53

client/src/components/helpers/Link.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import React from 'react';
32
import renderer from 'react-test-renderer';
43

client/src/components/helpers/Loader.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import React from 'react';
32
import { render, cleanup } from '@testing-library/react';
43

client/src/components/landing/Landing.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import React from 'react';
32
import ShallowRenderer from 'react-test-renderer/shallow';
43

client/src/components/profile/Profile.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53

client/src/components/profile/components/HeatMap.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53

client/src/components/profile/components/TimeLine.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53
import TimeLine from './TimeLine';

client/src/components/search/searchBar/SearchBar.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global jest, expect */
21
import React from 'react';
32
import ShallowRenderer from 'react-test-renderer/shallow';
43

client/src/components/settings/Certification.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import React from 'react';
42
import { render } from '@testing-library/react';
53
import { Provider } from 'react-redux';

client/src/components/settings/Honesty.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import React from 'react';
32
import ShallowRenderer from 'react-test-renderer/shallow';
43
import TestRenderer from 'react-test-renderer';

client/src/pages/challenges.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import toLearnPath from '../utils/to-learn-path';
32
import { withPrefix } from 'gatsby';
43

client/src/redux/failed-updates-epic.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import { Subject } from 'rxjs';
42
import { ActionsObservable, StateObservable } from 'redux-observable';
53
import failedUpdatesEpic from './failed-updates-epic';

client/src/redux/ga-saga.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global jest */
2-
31
import { types } from '.';
42
import { createGaSaga } from './ga-saga';
53
import ga from '../analytics';

client/src/templates/Challenges/components/ChallengeTitle.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import React from 'react';
42
import renderer from 'react-test-renderer';
53

client/src/templates/Challenges/components/CompletionModal.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect jest */
2-
31
import { getCompletedPercent } from './CompletionModal';
42

53
jest.mock('../../../analytics');

client/src/templates/Challenges/components/CompletionModalBody.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global jest, expect */
2-
31
import React from 'react';
42
import { render, fireEvent } from '@testing-library/react';
53

client/src/templates/Challenges/rechallenge/builders.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
import { findIndexHtml } from './builders.js';
32

43
const withHTML = [

client/src/templates/Challenges/redux/create-question-epic.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import { transformEditorLink } from '../utils';
42

53
describe('create-question-epic', () => {

client/src/templates/Challenges/utils/index.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import envData from '../../../../../config/env.json';
42

53
const { forumLocation } = envData;

client/src/templates/Challenges/utils/worker-executor.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect, jest */
2-
31
import createWorker from './worker-executor';
42

53
function mockWorker({ init, postMessage, terminate } = {}) {

client/src/utils/css-help.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect */
21
import { cssString } from './__fixtures/curriculum-helpers-css';
32
import CSSHelp from './css-help';
43

client/src/utils/curriculum-helpers.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global describe it expect */
2-
31
import __testHelpers, { removeJSComments } from './curriculum-helpers';
42
import jsTestValues from './__fixtures/curriculum-helpers-javascript';
53
import cssTestValues from './__fixtures/curriculum-helpers-css';

client/src/utils/format.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global expect BigInt */
1+
/* global BigInt */
22

33
const { format } = require('./format');
44

client/src/utils/handled-error.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import { isObject } from 'lodash-es';
32
import {
43
isHandledError,

client/utils/gatsby/layoutSelector.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect jest */
21
import React from 'react';
32
import { Provider } from 'react-redux';
43
import ShallowRenderer from 'react-test-renderer/shallow';

client/utils/tags.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
import { injectConditionalTags } from './tags';
42

53
describe('Tags', () => {

curriculum/getChallenges.acceptance.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
// TODO: reinstate these tests
32

43
// // TODO: update these to use the new parser

curriculum/getChallenges.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const path = require('path');
32

43
const {

curriculum/test/utils/extract-css-comments.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const extractCSSComments = require('./extract-css-comments');
32

43
const someHTMLWithCSS = `<body>

curriculum/test/utils/extract-html-comments.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const extractHTMLComments = require('./extract-html-comments');
32

43
const someHTML = `<body>

curriculum/test/utils/extract-js-comments.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const extractJSComments = require('./extract-js-comments');
32

43
const someJS = `

curriculum/test/utils/extract-jsx-comments.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const extractJSXComments = require('./extract-jsx-comments');
32

43
const someJSX = `<Link

curriculum/test/utils/extract-script-js-comments.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const extractScriptJSComments = require('./extract-script-js-comments');
32

43
const inlineComments = `<body>

curriculum/test/utils/sort-challenges.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global expect */
21
const { sortChallenges } = require('./sort-challenges');
32

43
const challenges = [

cypress/integration/learn/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cy expect */
1+
/* global cy */
22

33
const selectors = {
44
challengeMap: "[data-test-label='learn-curriculum-map']"

cypress/integration/learn/redirects/challenges.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cy expect */
1+
/* global cy */
22

33
const locations = {
44
chalSuper: '/challenges/responsive-web-design/',

cypress/integration/settings/certifications.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cy expect */
1+
/* global cy */
22

33
import '@testing-library/cypress/add-commands';
44

cypress/integration/settings/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cy expect */
1+
/* global cy */
22

33
describe('Settings', () => {
44
it('should be possible to reset your progress', () => {

cypress/integration/user/report-user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global cy expect */
1+
/* global cy */
22

33
describe('Report User', () => {
44
beforeEach(() => {

tools/challenge-parser/parser/index.acceptance.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global expect */
2-
31
const path = require('path');
42

53
const { parseMD } = require('.');

tools/challenge-parser/parser/plugins/add-frontmatter.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global describe it expect beforeEach */
2-
31
const { isObject } = require('lodash');
42

53
const mockAST = require('../__fixtures__/ast-yaml-challenge.json');

tools/challenge-parser/parser/plugins/add-seed.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect beforeEach */
21
const isArray = require('lodash/isArray');
32

43
const simpleAST = require('../__fixtures__/ast-simple.json');

tools/challenge-parser/parser/plugins/add-solution.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect beforeEach */
21
const mockAST = require('../__fixtures__/ast-simple.json');
32
const editableSolutionAST = require('../__fixtures__/ast-erm-in-solution.json');
43
const multiSolnsAST = require('../__fixtures__/ast-multiple-solutions.json');

tools/challenge-parser/parser/plugins/add-tests.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect beforeEach */
21
const simpleAST = require('../__fixtures__/ast-simple.json');
32
const brokenHintsAST = require('../__fixtures__/ast-broken-hints.json');
43
const addTests = require('./add-tests');

tools/challenge-parser/parser/plugins/add-text.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect */
21
const mockAST = require('../__fixtures__/ast-simple.json');
32
// eslint-disable-next-line max-len
43
const incorrectMarkersAST = require('../__fixtures__/ast-incorrect-markers.json');

tools/challenge-parser/parser/plugins/add-video-question.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect beforeEach */
21
const simpleAST = require('../__fixtures__/ast-simple.json');
32
const mockVideoAST = require('../__fixtures__/ast-video-challenge.json');
43
// eslint-disable-next-line max-len

tools/challenge-parser/parser/plugins/replace-imports.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect jest */
21
const path = require('path');
32
const cloneDeep = require('lodash/cloneDeep');
43
const toVfile = require('to-vfile');

tools/challenge-parser/parser/plugins/restore-directives.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global describe it expect */
21
const cloneDeep = require('lodash/cloneDeep');
32
const { selectAll } = require('unist-util-select');
43
const find = require('unist-util-find');

0 commit comments

Comments
 (0)