Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,5 @@ module.exports = {
'@typescript-eslint/sort-type-union-intersection-members': 'error',
},
},
{
files: '**/__tests__/*-test.js',
env: { jest: true },
},
],
};
22 changes: 14 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
tests:
strategy:
matrix:
node: ['14.15.0', '16', '18']
node: ['14.17.0', '16', '18']
os: ['ubuntu']
include:
- os: macos
Expand All @@ -37,19 +37,19 @@ jobs:
node-version: ${{ matrix.node }}
cache: 'yarn'

- uses: actions/cache@v3
name: Cache jest cache
with:
path: .jest-cache
key: ${{ runner.os }}-${{ matrix.node }}-jest

- name: Install dependencies
run: yarn install --immutable

- name: Unit tests with coverage
if: '${{ matrix.node == env.NODE_VERSION }}'
run: yarn test --coverage

- name: Unit tests
run: yarn test:ci
if: '${{ matrix.node != env.NODE_VERSION }}'
run: yarn test

- name: Upload coverage to Codecov
if: '${{ matrix.node == env.NODE_VERSION }}'
uses: codecov/codecov-action@v3

lint:
Expand Down Expand Up @@ -90,6 +90,9 @@ jobs:
- name: Install dependencies
run: yarn install --immutable

- name: Build
run: yarn build

- name: Build website
run: yarn website:build

Expand All @@ -114,6 +117,9 @@ jobs:
run: yarn install --immutable

- name: Build
run: yarn build

- name: Build website
run: yarn website:build

- name: Deploy
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
dist
node_modules/
.idea/
.jest-cache/
coverage/
yarn-error.log
.pnp.*
Expand Down
4 changes: 2 additions & 2 deletions benchmark/__fixtures__/CircularProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { chainPropTypes } from '@material-ui/utils';
import withStyles from '../styles/withStyles';
import { capitalize } from '../utils/helpers';
import withStyles from '../styles/withStyles.js';
import { capitalize } from '../utils/helpers.js';

const SIZE = 44;

Expand Down
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"private": true,
"engines": {
"node": ">=14.15.0",
"node": ">=14.17.0",
"yarn": ">=3.2.2"
},
"scripts": {
"build": "yarn --verbose workspaces foreach --exclude 'benchmark' --exclude 'website' -p run build",
"build": "yarn --verbose workspaces foreach --exclude 'benchmark' --exclude 'website' run build",
"watch": "yarn --verbose workspaces foreach --exclude 'benchmark' --exclude 'website' -p run watch",
"lint": "eslint . --ext .js,.ts --report-unused-disable-directives",
"fix": "eslint . --ext .js,.ts --fix --report-unused-disable-directives",
"test": "yarn build && jest",
"test:ci": "yarn build && jest --ci --cacheDirectory $(pwd)/.jest-cache/ --coverage",
"test": "yarn build && vitest run",
"test:dev": "vitest",
"website:build": "yarn workspace website run build",
"website:start": "yarn workspace website run start"
},
Expand All @@ -21,22 +22,18 @@
],
"devDependencies": {
"@types/cross-spawn": "6.0.2",
"@types/jest": "29.2.3",
"@types/rimraf": "3.0.2",
"@typescript-eslint/eslint-plugin": "5.44.0",
"@typescript-eslint/parser": "5.44.0",
"cross-spawn": "7.0.3",
"@vitest/coverage-c8": "0.25.3",
"eslint": "8.28.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
"jest": "29.3.1",
"jest-diff": "29.3.1",
"jest-matcher-utils": "29.3.1",
"prettier": "2.8.0",
"rimraf": "3.0.2",
"tempy": "1.0.1",
"ts-jest": "29.0.3",
"typescript": "4.9.3"
"typescript": "4.9.3",
"vitest": "0.25.3"
},
"packageManager": "yarn@3.3.0"
}
10 changes: 0 additions & 10 deletions packages/react-docgen-cli/jest.config.mjs

This file was deleted.

5 changes: 3 additions & 2 deletions packages/react-docgen-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"version": "6.0.0-alpha.3",
"description": "A CLI and toolkit to extract information from React components for documentation generation.",
"repository": "reactjs/react-docgen",
"type": "module",
"bin": {
"react-docgen": "bin/react-docgen.js"
},
"files": [
"bin"
],
"engines": {
"node": ">=14.15.0"
"node": ">=14.17.0"
},
"scripts": {
"build": "echo 'done'",
"test": "yarn build && jest"
"watch": "echo 'done'"
},
"keywords": [
"react",
Expand Down
45 changes: 23 additions & 22 deletions packages/react-docgen-cli/src/__tests__/react-docgen-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import path from 'path';
import rimraf from 'rimraf';
import { directory as tempDirectory, file as tempFile } from 'tempy';
import spawn from 'cross-spawn';
import { afterEach, describe, expect, test } from 'vitest';

const { writeFile, mkdir } = promises;

Expand Down Expand Up @@ -85,7 +86,7 @@ describe.skip('react-docgen CLI', () => {
tempNoComponents = [];
}, TEST_TIMEOUT);

it(
test(
'reads from stdin',
async () => {
return run([], component).then(([stdout, stderr]) => {
Expand All @@ -96,7 +97,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'reads files provided as command line arguments',
async () => {
await createTempfiles();
Expand All @@ -110,7 +111,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'reads directories provided as command line arguments',
async () => {
await createTempfiles();
Expand All @@ -122,7 +123,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'considers js and jsx by default',
async () => {
await createTempfiles();
Expand All @@ -141,7 +142,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'considers files with the specified extension',
async () => {
await createTempfiles('foo');
Expand All @@ -162,7 +163,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'considers files with the specified extension shortcut',
async () => {
await createTempfiles('foo');
Expand All @@ -179,7 +180,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores files in node_modules, __tests__ and __mocks__ by default',
async () => {
await createTempfiles(undefined, 'node_modules');
Expand All @@ -194,7 +195,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores specified folders',
async () => {
await createTempfiles(undefined, 'foo');
Expand All @@ -207,7 +208,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores specified folders shortcut',
async () => {
await createTempfiles(undefined, 'foo');
Expand All @@ -220,7 +221,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'writes to stdout',
async () => {
const [stdout, stderr] = await run([], component);
Expand All @@ -231,7 +232,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'writes to stderr',
async () => {
const [stdout, stderr] = await run([], '{}');
Expand All @@ -242,7 +243,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'writes to a file if provided',
async () => {
const outFile = tempFile();
Expand All @@ -257,7 +258,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'writes to a file if provided shortcut',
async () => {
const outFile = tempFile();
Expand All @@ -274,7 +275,7 @@ describe.skip('react-docgen CLI', () => {

describe('--resolver', () => {
describe('accepts the names of built in resolvers', () => {
it(
test(
'findExportedComponentDefinition (default)',
async () => {
// No option passed: same as --resolver=findExportedComponentDefinition
Expand All @@ -287,7 +288,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'findExportedComponentDefinition',
async () => {
const [stdout] = await run([
Expand All @@ -300,7 +301,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'findAllComponentDefinitions',
async () => {
const [stdout] = await run([
Expand All @@ -314,7 +315,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'findAllExportedComponentDefinitions',
async () => {
const [stdout] = await run([
Expand All @@ -329,7 +330,7 @@ describe.skip('react-docgen CLI', () => {
);
});

it(
test(
'accepts a path to a resolver function',
async () => {
const [stdout] = await run([
Expand All @@ -347,7 +348,7 @@ describe.skip('react-docgen CLI', () => {
});

describe('--exclude/-e', () => {
it(
test(
'ignores files by name',
async () => {
await createTempfiles(undefined, 'foo');
Expand All @@ -365,7 +366,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores files by name shortcut',
async () => {
await createTempfiles(undefined, 'foo');
Expand All @@ -385,7 +386,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores files by regex',
async () => {
await createTempfiles(undefined, 'foo');
Expand All @@ -402,7 +403,7 @@ describe.skip('react-docgen CLI', () => {
TEST_TIMEOUT,
);

it(
test(
'ignores files by regex shortcut',
async () => {
await createTempfiles(undefined, 'foo');
Expand Down
12 changes: 0 additions & 12 deletions packages/react-docgen/jest.config.mjs

This file was deleted.

Loading