chore: add jest global variables (#42573)

This commit is contained in:
Huyen Nguyen
2021-06-20 14:14:42 +07:00
committed by GitHub
parent 42e8b2247e
commit 2c16234853
82 changed files with 8 additions and 114 deletions

View File

@ -3,7 +3,8 @@
"es6": true,
"browser": true,
"mocha": true,
"node": true
"node": true,
"jest": true
},
"parser": "babel-eslint",
"root": true,

View File

@ -1,4 +1,3 @@
/* global expect */
import { ensureLowerCaseEmail } from './User-Identity';
test('returns lowercase email when one exists', () => {

View File

@ -1,5 +1,3 @@
/* global it expect */
import { getFallbackFrontEndDate } from '../boot/certificate';
import { fullStackChallenges } from './fixtures';

View File

@ -1,4 +1,3 @@
/* global describe xdescribe it expect jest */
import { first, find } from 'lodash';
import {

View File

@ -1,4 +1,3 @@
/* global jest*/
import { isEqual } from 'lodash';
import { isEmail } from 'validator';

View File

@ -1,4 +1,3 @@
/* global describe it expect jest */
import { mockReq as mockRequest, mockRes } from '../boot_tests/challenge.test';
import jwt from 'jsonwebtoken';

View File

@ -1,4 +1,3 @@
/* global describe expect it */
import moment from 'moment-timezone';
import { dayCount } from './date-utils';

View File

@ -1,7 +1,4 @@
/* eslint-disable camelcase */
/* global describe it expect */
/* global jest*/
import axios from 'axios';
import keys from '../../../../config/secrets';
import {

View File

@ -1,4 +1,3 @@
/* global describe it expect */
import {
getAccessTokenFromRequest,
errorTypes,

View File

@ -1,4 +1,3 @@
/* global describe beforeEach expect it jest */
import inMemoryCache from './in-memory-cache';
describe('InMemoryCache', () => {

View File

@ -1,5 +1,3 @@
/* global describe expect it jest */
const jwt = require('jsonwebtoken');
const { getReturnTo, normalizeParams } = require('./redirection');

View File

@ -1,4 +1,3 @@
/* global describe it expect jest */
import moment from 'moment-timezone';
import {

View File

@ -1,4 +1,3 @@
/* global expect */
import {
availableLangs,
langDisplayNames,

View File

@ -1,6 +1,5 @@
/* eslint-disable react/prop-types */
/* eslint-disable react/display-name */
/* global jest */
import React from 'react';
const reactI18next = jest.genMockFromModule('react-i18next');

View File

@ -1,4 +1,3 @@
/* global describe it expect */
import {
wrapHandledError,
unwrapHandledError

View File

@ -1,4 +1,3 @@
/* global jest, expect */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import envData from '../../../config/env.json';

View File

@ -1,4 +1,3 @@
/* global expect */
import React from 'react';
import renderer from 'react-test-renderer';

View File

@ -1,4 +1,3 @@
/* global expect jest */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';

View File

@ -1,4 +1,3 @@
/* global expect jest */
import React from 'react';
import renderer from 'react-test-renderer';
import { Provider } from 'react-redux';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import React from 'react';
import { useStaticQuery } from 'gatsby';
import { render } from '@testing-library/react';

View File

@ -1,5 +1,3 @@
/* global expect */
import createExternalRedirect from './createExternalRedirects';
describe('createExternalRedirects', () => {

View File

@ -1,5 +1,3 @@
/* global expect */
import createLanguageRedirect from './createLanguageRedirect';
describe('createLanguageRedirect for clientLocale === english', () => {

View File

@ -1,5 +1,3 @@
/* global expect */
import React from 'react';
import { render } from '@testing-library/react';

View File

@ -1,5 +1,3 @@
/* global expect */
import React from 'react';
import { render } from '@testing-library/react';

View File

@ -1,5 +1,3 @@
/* global jest, expect */
import React from 'react';
import { render, fireEvent } from '@testing-library/react';

View File

@ -1,4 +1,3 @@
/* global expect */
import React from 'react';
import renderer from 'react-test-renderer';

View File

@ -1,4 +1,3 @@
/* global expect */
import React from 'react';
import { render, cleanup } from '@testing-library/react';

View File

@ -1,4 +1,3 @@
/* global expect jest */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import React from 'react';
import { render } from '@testing-library/react';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import React from 'react';
import { render } from '@testing-library/react';

View File

@ -1,5 +1,3 @@
/* global expect */
import React from 'react';
import { render } from '@testing-library/react';
import TimeLine from './TimeLine';

View File

@ -1,4 +1,3 @@
/* global jest, expect */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import React from 'react';
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';

View File

@ -1,4 +1,3 @@
/* global expect jest */
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import TestRenderer from 'react-test-renderer';

View File

@ -1,4 +1,3 @@
/* global expect */
import toLearnPath from '../utils/to-learn-path';
import { withPrefix } from 'gatsby';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import { Subject } from 'rxjs';
import { ActionsObservable, StateObservable } from 'redux-observable';
import failedUpdatesEpic from './failed-updates-epic';

View File

@ -1,5 +1,3 @@
/* global jest */
import { types } from '.';
import { createGaSaga } from './ga-saga';
import ga from '../analytics';

View File

@ -1,5 +1,3 @@
/* global expect */
import React from 'react';
import renderer from 'react-test-renderer';

View File

@ -1,5 +1,3 @@
/* global expect jest */
import { getCompletedPercent } from './CompletionModal';
jest.mock('../../../analytics');

View File

@ -1,5 +1,3 @@
/* global jest, expect */
import React from 'react';
import { render, fireEvent } from '@testing-library/react';

View File

@ -1,4 +1,3 @@
/* global expect */
import { findIndexHtml } from './builders.js';
const withHTML = [

View File

@ -1,5 +1,3 @@
/* global expect */
import { transformEditorLink } from '../utils';
describe('create-question-epic', () => {

View File

@ -1,5 +1,3 @@
/* global expect */
import envData from '../../../../../config/env.json';
const { forumLocation } = envData;

View File

@ -1,5 +1,3 @@
/* global expect, jest */
import createWorker from './worker-executor';
function mockWorker({ init, postMessage, terminate } = {}) {

View File

@ -1,4 +1,3 @@
/* global describe it expect */
import { cssString } from './__fixtures/curriculum-helpers-css';
import CSSHelp from './css-help';

View File

@ -1,5 +1,3 @@
/* global describe it expect */
import __testHelpers, { removeJSComments } from './curriculum-helpers';
import jsTestValues from './__fixtures/curriculum-helpers-javascript';
import cssTestValues from './__fixtures/curriculum-helpers-css';

View File

@ -1,4 +1,4 @@
/* global expect BigInt */
/* global BigInt */
const { format } = require('./format');

View File

@ -1,4 +1,3 @@
/* global expect jest */
import { isObject } from 'lodash-es';
import {
isHandledError,

View File

@ -1,4 +1,3 @@
/* global expect jest */
import React from 'react';
import { Provider } from 'react-redux';
import ShallowRenderer from 'react-test-renderer/shallow';

View File

@ -1,5 +1,3 @@
/* global expect */
import { injectConditionalTags } from './tags';
describe('Tags', () => {

View File

@ -1,4 +1,3 @@
/* global expect */
// TODO: reinstate these tests
// // TODO: update these to use the new parser

View File

@ -1,4 +1,3 @@
/* global expect */
const path = require('path');
const {

View File

@ -1,4 +1,3 @@
/* global expect */
const extractCSSComments = require('./extract-css-comments');
const someHTMLWithCSS = `<body>

View File

@ -1,4 +1,3 @@
/* global expect */
const extractHTMLComments = require('./extract-html-comments');
const someHTML = `<body>

View File

@ -1,4 +1,3 @@
/* global expect */
const extractJSComments = require('./extract-js-comments');
const someJS = `

View File

@ -1,4 +1,3 @@
/* global expect */
const extractJSXComments = require('./extract-jsx-comments');
const someJSX = `<Link

View File

@ -1,4 +1,3 @@
/* global expect */
const extractScriptJSComments = require('./extract-script-js-comments');
const inlineComments = `<body>

View File

@ -1,4 +1,3 @@
/* global expect */
const { sortChallenges } = require('./sort-challenges');
const challenges = [

View File

@ -1,4 +1,4 @@
/* global cy expect */
/* global cy */
const selectors = {
challengeMap: "[data-test-label='learn-curriculum-map']"

View File

@ -1,4 +1,4 @@
/* global cy expect */
/* global cy */
const locations = {
chalSuper: '/challenges/responsive-web-design/',

View File

@ -1,4 +1,4 @@
/* global cy expect */
/* global cy */
import '@testing-library/cypress/add-commands';

View File

@ -1,4 +1,4 @@
/* global cy expect */
/* global cy */
describe('Settings', () => {
it('should be possible to reset your progress', () => {

View File

@ -1,4 +1,4 @@
/* global cy expect */
/* global cy */
describe('Report User', () => {
beforeEach(() => {

View File

@ -1,5 +1,3 @@
/* global expect */
const path = require('path');
const { parseMD } = require('.');

View File

@ -1,5 +1,3 @@
/* global describe it expect beforeEach */
const { isObject } = require('lodash');
const mockAST = require('../__fixtures__/ast-yaml-challenge.json');

View File

@ -1,4 +1,3 @@
/* global describe it expect beforeEach */
const isArray = require('lodash/isArray');
const simpleAST = require('../__fixtures__/ast-simple.json');

View File

@ -1,4 +1,3 @@
/* global describe it expect beforeEach */
const mockAST = require('../__fixtures__/ast-simple.json');
const editableSolutionAST = require('../__fixtures__/ast-erm-in-solution.json');
const multiSolnsAST = require('../__fixtures__/ast-multiple-solutions.json');

View File

@ -1,4 +1,3 @@
/* global describe it expect beforeEach */
const simpleAST = require('../__fixtures__/ast-simple.json');
const brokenHintsAST = require('../__fixtures__/ast-broken-hints.json');
const addTests = require('./add-tests');

View File

@ -1,4 +1,3 @@
/* global describe it expect */
const mockAST = require('../__fixtures__/ast-simple.json');
// eslint-disable-next-line max-len
const incorrectMarkersAST = require('../__fixtures__/ast-incorrect-markers.json');

View File

@ -1,4 +1,3 @@
/* global describe it expect beforeEach */
const simpleAST = require('../__fixtures__/ast-simple.json');
const mockVideoAST = require('../__fixtures__/ast-video-challenge.json');
// eslint-disable-next-line max-len

View File

@ -1,4 +1,3 @@
/* global describe it expect jest */
const path = require('path');
const cloneDeep = require('lodash/cloneDeep');
const toVfile = require('to-vfile');

View File

@ -1,4 +1,3 @@
/* global describe it expect */
const cloneDeep = require('lodash/cloneDeep');
const { selectAll } = require('unist-util-select');
const find = require('unist-util-find');

View File

@ -1,4 +1,3 @@
/* global expect*/
const isArray = require('lodash/isArray');
const find = require('unist-util-find');
const { root } = require('mdast-builder');

View File

@ -1,4 +1,3 @@
/* global expect*/
const getId = require('./get-id');
const idNode = require('./__fixtures__/id-node.json');
const imageNode = require('./__fixtures__/image-node.json');

View File

@ -1,4 +1,3 @@
/* global expect*/
const mdastToHTML = require('./mdast-to-html');
const mdastMixedNodes = require('./__fixtures__/mdast-mixed-nodes.json');
const mdastWithEmNode = require('./__fixtures__/mdast-with-em.json');

View File

@ -1,4 +1,3 @@
/* global expect jest */
const {
translateComments,
translateCommentsInChallenge,

View File

@ -1,4 +1,3 @@
/* global describe it expect jest beforeEach */
const path = require('path');
const lint = require('.');

View File

@ -1,6 +1,3 @@
/* global expect */
/* global jest */
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

View File

@ -1,5 +1,3 @@
/* global describe expect it */
const { getLines } = require('./get-lines');
const content = 'one\ntwo\nthree';

View File

@ -1,5 +1,3 @@
/* global describe expect it */
const slugs = require('./slugs');
describe('dasherize', () => {

View File

@ -1,5 +1,3 @@
/* global expect */
const { toSortedArray } = require('./sort-files');
const { challengeFiles } = require('./__fixtures__/challenges');

View File

@ -1,5 +1,3 @@
/* global describe expect it */
const {
isValidUsername,
usernameTooShort,