Skip to content

Commit 553f8fa

Browse files
committed
fix: fix types build in babel-plugin package, move jest to vitest
1 parent d7f4974 commit 553f8fa

File tree

7 files changed

+4782
-5373
lines changed

7 files changed

+4782
-5373
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"prepare": "husky",
1313
"test": "pnpm --recursive test",
14-
"lint": "TIMING=1 eslint --format codeframe docs packages examples",
14+
"lint": "TIMING=1 eslint --format codeframe .",
1515
"purge": "pnpm -r clean && echo 'removing node_modules ...' && rm -rf .site {.,docs}/node_modules {examples,packages}/*/node_modules",
1616
"build:packages": "pnpm --filter './packages/*' build",
1717
"build:examples": "pnpm --filter './examples/*' build",

packages/babel-plugin/jest.config.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/babel-plugin/package.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dist"
2828
],
2929
"scripts": {
30-
"test": "jest --passWithNoTests",
30+
"test": "vitest run",
3131
"gen:test-outputs": "tsx scripts/gen-test-outputs.ts",
3232
"clean": "rimraf coverage dist es lib build",
3333
"build:esm": "tsc -p tsconfig.esm.json",
@@ -38,28 +38,25 @@
3838
"node": ">=12.0.0"
3939
},
4040
"dependencies": {
41-
"@babel/core": "^7.23.5",
42-
"@babel/generator": "^7.23.5",
43-
"@babel/parser": "^7.23.5",
44-
"@babel/traverse": "^7.23.5",
45-
"@babel/types": "7.20.5"
41+
"@babel/core": "^7.27.1",
42+
"@babel/generator": "^7.27.1",
43+
"@babel/parser": "^7.27.1",
44+
"@babel/traverse": "^7.27.1",
45+
"@babel/types": "^7.27.1"
4646
},
4747
"devDependencies": {
48-
"@types/babel-plugin-tester": "9.0.5",
49-
"@types/babel__core": "7.1.20",
50-
"@types/babel__generator": "7.6.4",
51-
"@types/babel__traverse": "7.18.3",
48+
"@types/babel__core": "7.20.5",
49+
"@types/babel__generator": "7.27.0",
50+
"@types/babel__traverse": "7.20.7",
5251
"@types/node": "20.12.10",
5352
"@zthxxx/tsconfig": "1.0.5",
54-
"babel-plugin-tester": "10.1.0",
53+
"babel-plugin-tester": "11.0.4",
5554
"fs-extra": "11.1.0",
5655
"globby": "11.1.0",
57-
"jest": "29.6.1",
5856
"npm-run-all": "4.1.5",
5957
"rimraf": "3.0.2",
60-
"ts-jest": "29.1.1",
61-
"ts-node": "10.9.1",
6258
"tsx": "4.16.0",
63-
"typescript": "5.2.2"
59+
"typescript": "5.2.2",
60+
"vitest": "1.1.1"
6461
}
6562
}

packages/babel-plugin/src/tests/babel-plugin.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pluginTester({
4040
.sync(`${fixturesDir}/layouts/**/*.(ts|tsx)`)
4141
.map((filePath) => path.relative(fixturesDir, filePath))
4242
.map((asset) => ({
43+
title: asset,
4344
fixture: path.join(cwd, fixturesDir, asset),
4445
outputFixture: path.join(cwd, outputsDir, asset),
4546
})),

packages/babel-plugin/src/tests/outputs/layouts/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import React from 'react';
22
import { Global } from '@emotion/react';
3-
import { Inspector } from 'react-dev-inspector';
4-
import type { InspectParams } from 'react-dev-inspector';
3+
import { Inspector, type InspectParams } from 'react-dev-inspector';
54
import { Title } from './components/Title';
65
import { Slogan } from './components/Slogan';
76
import { KeyPad, Keypress } from './components/Keypress';
87
import * as S from './styles';
98
const projectRepo = 'https://github.com/zthxxx/react-dev-inspector';
109
const isDev = process.env.NODE_ENV === 'development';
1110
export const HomePage = () => {
12-
return <Inspector data-inspector-line="16" data-inspector-column="4" data-inspector-relative-path="src/tests/fixtures/layouts/index.tsx" disableLaunchEditor={!isDev} onClickElement={(inspect: InspectParams) => {
11+
return <Inspector data-inspector-line="15" data-inspector-column="4" data-inspector-relative-path="src/tests/fixtures/layouts/index.tsx" disableLaunchEditor={!isDev} onClickElement={(inspect: InspectParams) => {
1312
console.debug(inspect);
1413
if (isDev || !inspect.codeInfo?.relativePath) return;
1514
const {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from 'vitest/config'
2+
3+
export default defineConfig({
4+
test: {
5+
environment: 'node',
6+
testTimeout: 20000,
7+
globals: true,
8+
include: ['src/**/*.test.(ts|tsx)'],
9+
exclude: [
10+
'**/node_modules/**',
11+
'**/templates/**',
12+
'**/coverage/**',
13+
'**/dist/**',
14+
'**/lib/**',
15+
'**/es/**',
16+
],
17+
coverage: {
18+
enabled: false,
19+
include: [
20+
'**/src/**/*.{ts,tsx}',
21+
],
22+
exclude: [
23+
'**/node_modules/**',
24+
'**/coverage/**',
25+
'**/*.mock.ts',
26+
'**/mocks/**',
27+
'**/dist/**',
28+
'**/lib/**',
29+
'**/es/**',
30+
],
31+
},
32+
},
33+
})

0 commit comments

Comments
 (0)