refactor(@vant/cli): migrate to ESM package

This commit is contained in:
chenjiahan
2021-10-28 20:09:00 +08:00
committed by neverland
parent eec2ac4c0f
commit 1b45f38133
50 changed files with 255 additions and 196 deletions
+12 -7
View File
@@ -1,7 +1,11 @@
import { runCLI } from 'jest';
import { setNodeEnv } from '../common';
import { genPackageEntry } from '../compiler/gen-package-entry';
import { ROOT, JEST_CONFIG_FILE, PACKAGE_ENTRY_FILE } from '../common/constant';
import jest from 'jest';
import { setNodeEnv } from '../common/index.js';
import { genPackageEntry } from '../compiler/gen-package-entry.js';
import {
ROOT,
JEST_CONFIG_FILE,
PACKAGE_ENTRY_FILE,
} from '../common/constant.js';
export function test(command: any) {
setNodeEnv('test');
@@ -13,18 +17,19 @@ export function test(command: any) {
const config = {
rootDir: ROOT,
watch: command.watch,
debug: command.debug,
config: JEST_CONFIG_FILE,
runInBand: command.runInBand,
clearCache: command.clearCache,
changedSince: command.changedSince,
logHeapUsage: command.logHeapUsage,
runInBand: command.runInBand,
debug: command.debug,
// make jest tests faster
// see: https://ivantanev.com/make-jest-faster/
maxWorkers: '50%',
} as any;
runCLI(config, [ROOT])
jest
.runCLI(config, [ROOT])
.then((response) => {
if (!response.results.success && !command.watch) {
process.exit(1);