From 1402d762eddcbb652e078c549d34c542d1feaebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 26 Oct 2022 15:09:25 +0800 Subject: [PATCH] chore: warning of enzyme adapter --- package.json | 1 + src/index.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ec54f6..23ebafd 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@umijs/fabric": "^3.0.0", "babel-plugin-module-resolver": "^4.1.0", "babel-preset-umi": "^1.8.4", + "chalk": "^5.1.2", "core-js": "^3.25.5", "fs-extra": "^10.1.0", "jest": "^29.2.1", diff --git a/src/index.ts b/src/index.ts index e5a7391..39957d9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ +import chalk from 'chalk'; +import fs from 'fs-extra'; import { runCLI } from 'jest'; import path from 'path'; -import fs from 'fs-extra'; const ALIAS = { t: 'testNamePattern', @@ -15,6 +16,16 @@ export function getConfig() { const setupFiles = [require.resolve('./setup.js')]; if (pkg.devDependencies['enzyme']) { + if ( + !pkg.dependencies['enzyme-adapter-react-16'] && + !pkg.devDependencies['enzyme-adapter-react-16'] + ) { + console.log( + chalk.red( + '[rc-test] Legacy "enzyme-adapter-react-16" is not in the deps. Please install in dev deps!', + ), + ); + } setupFiles.push(require.resolve('./setupEnzyme.js')); }