mirror of
https://github.com/hanzoai/jest.git
synced 2026-09-24 16:59:57 +00:00
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import {dirname, normalize, resolve} from 'node:path';
|
|
import {fileURLToPath} from 'node:url';
|
|
import {glob} from 'glob';
|
|
import fs from 'graceful-fs';
|
|
|
|
const excludedModules = [
|
|
'e2e/global-setup-node-modules/node_modules/',
|
|
'e2e/native-esm-js-esm-syntax-fallback/node_modules/',
|
|
'e2e/presets/cjs/node_modules/',
|
|
'e2e/presets/js/node_modules/',
|
|
'e2e/presets/js-type-module/node_modules/',
|
|
'e2e/presets/json/node_modules/',
|
|
'e2e/presets/mjs/node_modules/',
|
|
'e2e/resolve-conditions/node_modules/',
|
|
'e2e/retain-all-files/node_modules/',
|
|
].map(dir => normalize(dir));
|
|
|
|
const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
|
|
const e2eNodeModules = glob.sync('e2e/{*,*/*}/node_modules/', {
|
|
absolute: true,
|
|
cwd: rootDir,
|
|
ignore: excludedModules,
|
|
});
|
|
|
|
for (const dir of e2eNodeModules) {
|
|
fs.rmSync(dir, {force: true, recursive: true});
|
|
}
|