Skip to content

Commit

Permalink
Go all-in with Jest ESM migration
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jan 18, 2024
1 parent cb13b1c commit a3baaa6
Show file tree
Hide file tree
Showing 180 changed files with 342 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
"overrides": [
{
"files": ["**/*.test.js", "**/tests/**/*.js", "setup.jest.js"],
"env": {
"jest": true
},
"rules": {
"import/no-extraneous-dependencies": 0
}
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/adjust.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import adjust from '../src/adjust';

const add = v => v + 1;
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/capitalize.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import capitalize from '../src/capitalize';

describe('capitalize', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/castArray.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import castArray from '../src/castArray';

describe('castArray', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/compose.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import compose from '../src/compose';

describe('compose', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/dropLast.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import dropLast from '../src/dropLast';

describe('dropLast', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/evolve.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import evolve from '../src/evolve';

const add = a => b => a + b;
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/get.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import get from '../src/get';

describe('get', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/fns/tests/isNil.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-void */
import { describe, expect, test } from '@jest/globals';

import isNil from '../src/isNil';

Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/last.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import last from '../src/last';

describe('last', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/matchPercent.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import matchPercent from '../src/matchPercent';

describe('match percent', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/omit.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import omit from '../src/omit';

describe('omit', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/pick.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import pick from '../src/pick';

describe('pick', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/reverse.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import reverse from '../src/reverse';

describe('reverse', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fns/tests/upperFirst.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import upperFirst from '../src/upperFirst';

describe('upperFirst', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/image/tests/cache.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import createCache from '../src/cache';

describe('Background', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/image/tests/resolve.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach, describe, expect, test } from '@jest/globals';
import fs from 'fs';
import path from 'path';
import url from 'url';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/image/getSource.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getSource from '../../src/image/getSource';

const VALUE = 'gotcha';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/image/resolveSource.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from '@jest/globals';

import resolveSource from '../../src/image/resolveSource';

const SOURCE_URL = 'gotcha';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getBorderWidth.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import Yoga from '../../yoga';

import getBorderWidth from '../../src/node/getBorderWidth';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getDimension.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getDimension from '../../src/node/getDimension';

const getComputedWidth = () => 10;
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getMargin.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import Yoga from '../../yoga';

import getMargin from '../../src/node/getMargin';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getOrigin.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getOrigin from '../../src/node/getOrigin';

describe('node getOrigin', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getPadding.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import Yoga from '../../yoga';

import getPadding from '../../src/node/getPadding';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/getPosition.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getPosition from '../../src/node/getPosition';

const getComputedTop = () => 10;
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/removePaddings.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import removePaddings from '../../src/node/removePaddings';

describe('node removePaddings', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setAlignContent.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setAlignContent from '../../src/node/setAlignContent';
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setAlignItems.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setAlignItems from '../../src/node/setAlignItems';
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setAlignSelf.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setAlignSelf from '../../src/node/setAlignSelf';
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tests/node/setAspectRatio.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import setAspectRatio from '../../src/node/setAspectRatio';

describe('node setAspectRatio', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setBorderWidth.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setBorder, {
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tests/node/setDimension.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import {
setWidth,
setMinWidth,
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setDisplay.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setDisplay from '../../src/node/setDisplay';
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tests/node/setFlexBasis.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import setFlexBasis from '../../src/node/setFlexBasis';

describe('node setFlexBasis', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setFlexDirection.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setFlexDirection from '../../src/node/setFlexDirection';
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tests/node/setFlexGrow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import setFlexGrow from '../../src/node/setFlexGrow';

describe('node setFlexGrow', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/tests/node/setFlexShrink.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import setFlexShrink from '../../src/node/setFlexShrink';

describe('node setFlexShrink', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setFlexWrap.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setFlexWrap from '../../src/node/setFlexWrap';
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setJustifyContent.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setJustifyContent from '../../src/node/setJustifyContent';
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setMargin.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setMargin, {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setOverflow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setOverflow from '../../src/node/setOverflow';
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setPadding.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setPadding, {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setPosition.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setPosition, {
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/node/setPositionType.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { beforeEach, describe, expect, jest, test } from '@jest/globals';

import Yoga from '../../yoga';

import setPositionType from '../../src/node/setPositionType';
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/node/shouldBreak.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import * as P from '@react-pdf/primitives';
import shouldBreak from '../../src/node/shouldBreak';

Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/page/getOrientation.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getOrientation from '../../src/page/getOrientation';

describe('page getOrientation', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/page/getSize.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import getSize from '../../src/page/getSize';

describe('page getSize', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/page/isHeightAuto.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import isHeightAuto from '../../src/page/isHeightAuto';

describe('page isHeightAuto', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/page/isLandscape.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import isLandscape from '../../src/page/isLandscape';

describe('page isLandscape', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/page/isPortrait.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import isPortrait from '../../src/page/isPortrait';

describe('page isPortrait', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveBookmarks.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveBookmarks from '../../src/steps/resolveBookmarks';

describe('layout resolveBookmarks', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveInhritance.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveInheritance from '../../src/steps/resolveInheritance';

describe('layout resolveInheritance', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveLinkSubstitution.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveLinkSubstitution from '../../src/steps/resolveLinkSubstitution';

describe('layout resolveStyles', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveOrigins.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveOrigins from '../../src/steps/resolveOrigins';

describe('layout resolveOrigins', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolvePagePaddings.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolvePagePaddings from '../../src/steps/resolvePagePaddings';

describe('layout resolvePagePaddings', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolvePageSizes.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolvePageSizes from '../../src/steps/resolvePageSizes';

describe('layout resolvePageSizes', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolvePagination.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolvePagination from '../../src/steps/resolvePagination';
import resolveDimensions from '../../src/steps/resolveDimensions';

Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolvePercentHeight.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolvePercentHeight from '../../src/steps/resolvePercentHeight';

describe('layout resolvePercentHeight', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveStyles.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveStyles from '../../src/steps/resolveStyles';

describe('layout resolveStyles', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/steps/resolveTextLayout.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import resolveTextLayout from '../../src/steps/resolveTextLayout';
import resolveDimensions from '../../src/steps/resolveDimensions';

Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/text/fromFragments.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import fromFragments from '../../src/text/fromFragments';

describe('attributeString fromFragments operator', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/layout/tests/text/heightAtLineIndex.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals';

import heightAtLineIndex from '../../src/text/heightAtLineIndex';

const TEST_LINE = { box: { height: 25 } };
Expand Down
3 changes: 2 additions & 1 deletion packages/layout/tests/text/layoutText.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals';
import { describe, expect, jest, test } from '@jest/globals';

import * as P from '@react-pdf/primitives';

import layoutText from '../../src/text/layoutText';
Expand Down
Loading

0 comments on commit a3baaa6

Please sign in to comment.