pax_global_header00006660000000000000000000000064135277441330014523gustar00rootroot0000000000000052 comment=557c1fad9651405992b8358035eda504973a1124 del-5.1.0/000077500000000000000000000000001352774413300122725ustar00rootroot00000000000000del-5.1.0/.editorconfig000066400000000000000000000002571352774413300147530ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 del-5.1.0/.gitattributes000066400000000000000000000000231352774413300151600ustar00rootroot00000000000000* text=auto eol=lf del-5.1.0/.github/000077500000000000000000000000001352774413300136325ustar00rootroot00000000000000del-5.1.0/.github/funding.yml000066400000000000000000000001551352774413300160100ustar00rootroot00000000000000github: sindresorhus open_collective: sindresorhus tidelift: npm/del custom: https://sindresorhus.com/donate del-5.1.0/.github/security.md000066400000000000000000000002631352774413300160240ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. del-5.1.0/.gitignore000066400000000000000000000000271352774413300142610ustar00rootroot00000000000000node_modules yarn.lock del-5.1.0/.npmrc000066400000000000000000000000231352774413300134050ustar00rootroot00000000000000package-lock=false del-5.1.0/.travis.yml000066400000000000000000000001271352774413300144030ustar00rootroot00000000000000os: - linux - osx - windows language: node_js node_js: - '12' - '10' - '8' del-5.1.0/benchmark.js000066400000000000000000000032671352774413300145720ustar00rootroot00000000000000'use strict'; const path = require('path'); const Benchmark = require('benchmark'); const makeDir = require('make-dir'); const tempy = require('tempy'); const del = require('.'); const suite = new Benchmark.Suite('concurrency'); const tempDir = tempy.directory(); const fixtures = Array.from({length: 2000}, (_, index) => { return path.resolve(tempDir, (index + 1).toString()); }); function createFixtures() { for (const fixture of fixtures) { makeDir.sync(path.resolve(tempDir, fixture)); } } const concurrencies = [ 1, 3, 5, 10, 15, 20, 50, 100, 200, 300, 400, 500, 1000, Infinity ]; for (const concurrency of concurrencies) { const name = `concurrency: ${concurrency.toString()}`; suite.add({ name, defer: true, setup() {}, // This line breaks async await async fn(deferred) { // Can't use `setup()` because it isn't called after every // defer and it breaks using `async` keyword here. // https://github.com/bestiejs/benchmark.js/issues/136 createFixtures(); const removedFiles = await del(['**/*'], { cwd: tempDir, concurrency }); if (removedFiles.length !== fixtures.length) { const error = new Error( `"${name}": files removed: ${removedFiles.length}, expected: ${fixtures.length}`, ); console.error(error); del.sync(tempDir, {cwd: tempDir, force: true}); // eslint-disable-next-line unicorn/no-process-exit process.exit(1); } deferred.resolve(); } }); } suite .on('cycle', event => { console.log(String(event.target)); }) .on('complete', function () { console.log(`Fastest is ${this.filter('fastest').map('name')}`); del.sync(tempDir, {cwd: tempDir, force: true}); }) .run({async: true}); del-5.1.0/index.d.ts000066400000000000000000000056311352774413300142000ustar00rootroot00000000000000import {GlobbyOptions} from 'globby'; declare namespace del { interface Options extends GlobbyOptions { /** Allow deleting the current working directory and outside. @default false */ readonly force?: boolean; /** See what would be deleted. @default false @example ``` import del = require('del'); (async () => { const deletedPaths = await del(['temp/*.js'], {dryRun: true}); console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); })(); ``` */ readonly dryRun?: boolean; /** Concurrency limit. Minimum: `1`. @default Infinity */ readonly concurrency?: number; } } declare const del: { /** Delete files and directories using glob patterns. Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). - [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) - [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) @param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. @returns The deleted paths. @example ``` import del = require('del'); (async () => { const deletedPaths = await del(['temp/*.js', '!temp/unicorn.js']); console.log('Deleted files and directories:\n', deletedPaths.join('\n')); })(); ``` */ ( patterns: string | readonly string[], options?: del.Options ): Promise; /** Synchronously delete files and directories using glob patterns. Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). - [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) - [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) @param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. @returns The deleted paths. */ sync( patterns: string | readonly string[], options?: del.Options ): string[]; }; export = del; del-5.1.0/index.js000066400000000000000000000052641352774413300137460ustar00rootroot00000000000000'use strict'; const {promisify} = require('util'); const path = require('path'); const globby = require('globby'); const isGlob = require('is-glob'); const slash = require('slash'); const gracefulFs = require('graceful-fs'); const isPathCwd = require('is-path-cwd'); const isPathInside = require('is-path-inside'); const rimraf = require('rimraf'); const pMap = require('p-map'); const rimrafP = promisify(rimraf); const rimrafOptions = { glob: false, unlink: gracefulFs.unlink, unlinkSync: gracefulFs.unlinkSync, chmod: gracefulFs.chmod, chmodSync: gracefulFs.chmodSync, stat: gracefulFs.stat, statSync: gracefulFs.statSync, lstat: gracefulFs.lstat, lstatSync: gracefulFs.lstatSync, rmdir: gracefulFs.rmdir, rmdirSync: gracefulFs.rmdirSync, readdir: gracefulFs.readdir, readdirSync: gracefulFs.readdirSync }; function safeCheck(file, cwd) { if (isPathCwd(file)) { throw new Error('Cannot delete the current working directory. Can be overridden with the `force` option.'); } if (!isPathInside(file, cwd)) { throw new Error('Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.'); } } function normalizePatterns(patterns) { patterns = Array.isArray(patterns) ? patterns : [patterns]; patterns = patterns.map(pattern => { if (process.platform === 'win32' && isGlob(pattern) === false) { return slash(pattern); } return pattern; }); return patterns; } module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { options = { expandDirectories: false, onlyFiles: false, followSymbolicLinks: false, cwd, ...options }; patterns = normalizePatterns(patterns); const files = (await globby(patterns, options)) .sort((a, b) => b.localeCompare(a)); const mapper = async file => { file = path.resolve(cwd, file); if (!force) { safeCheck(file, cwd); } if (!dryRun) { await rimrafP(file, rimrafOptions); } return file; }; const removedFiles = await pMap(files, mapper, options); removedFiles.sort((a, b) => a.localeCompare(b)); return removedFiles; }; module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => { options = { expandDirectories: false, onlyFiles: false, followSymbolicLinks: false, cwd, ...options }; patterns = normalizePatterns(patterns); const files = globby.sync(patterns, options) .sort((a, b) => b.localeCompare(a)); const removedFiles = files.map(file => { file = path.resolve(cwd, file); if (!force) { safeCheck(file, cwd); } if (!dryRun) { rimraf.sync(file, rimrafOptions); } return file; }); removedFiles.sort((a, b) => a.localeCompare(b)); return removedFiles; }; del-5.1.0/index.test-d.ts000066400000000000000000000013731352774413300151540ustar00rootroot00000000000000import {expectType} from 'tsd'; import del = require('.'); const paths = [ 'temp/*.js', '!temp/unicorn.js' ]; // Del expectType>(del('temp/*.js')); expectType>(del(paths)); expectType>(del(paths, {force: true})); expectType>(del(paths, {dryRun: true})); expectType>(del(paths, {concurrency: 20})); expectType>(del(paths, {cwd: ''})); // Del (sync) expectType(del.sync('tmp/*.js')); expectType(del.sync(paths)); expectType(del.sync(paths, {force: true})); expectType(del.sync(paths, {dryRun: true})); expectType(del.sync(paths, {concurrency: 20})); expectType(del.sync(paths, {cwd: ''})); del-5.1.0/license000066400000000000000000000021251352774413300136370ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. del-5.1.0/package.json000066400000000000000000000020501352774413300145550ustar00rootroot00000000000000{ "name": "del", "version": "5.1.0", "description": "Delete files and directories", "license": "MIT", "repository": "sindresorhus/del", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd", "bench": "node benchmark.js" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "delete", "files", "folders", "directories", "remove", "destroy", "trash", "unlink", "clean", "cleaning", "cleanup", "rm", "rmrf", "rimraf", "rmdir", "glob", "gulpfriendly", "file", "folder", "directory", "fs", "filesystem" ], "dependencies": { "globby": "^10.0.1", "graceful-fs": "^4.2.2", "is-glob": "^4.0.1", "is-path-cwd": "^2.2.0", "is-path-inside": "^3.0.1", "p-map": "^3.0.0", "rimraf": "^3.0.0", "slash": "^3.0.0" }, "devDependencies": { "ava": "^2.3.0", "benchmark": "^2.1.4", "make-dir": "^3.0.0", "tempy": "^0.3.0", "tsd": "^0.7.4", "xo": "^0.24.0" } } del-5.1.0/readme.md000066400000000000000000000066751352774413300140670ustar00rootroot00000000000000# del [![Build Status](https://travis-ci.org/sindresorhus/del.svg?branch=master)](https://travis-ci.org/sindresorhus/del) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) > Delete files and directories using [globs](https://github.com/sindresorhus/globby#globbing-patterns) Similar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API and support for multiple files and globbing. It also protects you against deleting the current working directory and above. ## Install ``` $ npm install del ``` ## Usage ```js const del = require('del'); (async () => { const deletedPaths = await del(['temp/*.js', '!temp/unicorn.js']); console.log('Deleted files and directories:\n', deletedPaths.join('\n')); })(); ``` ## Beware The glob pattern `**` matches all children and *the parent*. So this won't work: ```js del.sync(['public/assets/**', '!public/assets/goat.png']); ``` You have to explicitly ignore the parent directories too: ```js del.sync(['public/assets/**', '!public/assets', '!public/assets/goat.png']); ``` Suggestions on how to improve this welcome! ## API Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. ### del(patterns, options?) Returns `Promise` with the deleted paths. ### del.sync(patterns, options?) Returns `string[]` with the deleted paths. #### patterns Type: `string | string[]` See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). - [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) - [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) #### options Type: `object` You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the below options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. ##### force Type: `boolean`
Default: `false` Allow deleting the current working directory and outside. ##### dryRun Type: `boolean`
Default: `false` See what would be deleted. ```js const del = require('del'); (async () => { const deletedPaths = await del(['temp/*.js'], {dryRun: true}); console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); })(); ``` ##### concurrency Type: `number`
Default: `Infinity`
Minimum: `1` Concurrency limit. ## CLI See [del-cli](https://github.com/sindresorhus/del-cli) for a CLI for this module and [trash-cli](https://github.com/sindresorhus/trash-cli) for a safe version that is suitable for running by hand. ## Related - [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed - [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching ---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
del-5.1.0/test.js000066400000000000000000000225521352774413300136150ustar00rootroot00000000000000import path from 'path'; import fs from 'fs'; import {serial as test} from 'ava'; import tempy from 'tempy'; import makeDir from 'make-dir'; import del from '.'; const processCwd = process.cwd(); function exists(t, files) { for (const file of files) { t.true(fs.existsSync(path.join(t.context.tmp, file))); } } function notExists(t, files) { for (const file of files) { t.false(fs.existsSync(path.join(t.context.tmp, file))); } } const fixtures = [ '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp' ]; test.beforeEach(t => { t.context.tmp = tempy.directory(); for (const fixture of fixtures) { makeDir.sync(path.join(t.context.tmp, fixture)); } }); test('delete files - async', async t => { await del(['*.tmp', '!1*'], {cwd: t.context.tmp}); exists(t, ['1.tmp', '.dot.tmp']); notExists(t, ['2.tmp', '3.tmp', '4.tmp']); }); test('delete files - sync', t => { del.sync(['*.tmp', '!1*'], {cwd: t.context.tmp}); exists(t, ['1.tmp', '.dot.tmp']); notExists(t, ['2.tmp', '3.tmp', '4.tmp']); }); test('take options into account - async', async t => { await del(['*.tmp', '!1*'], { cwd: t.context.tmp, dot: true }); exists(t, ['1.tmp']); notExists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); }); test('take options into account - sync', t => { del.sync(['*.tmp', '!1*'], { cwd: t.context.tmp, dot: true }); exists(t, ['1.tmp']); notExists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); }); test('return deleted files - async', async t => { t.deepEqual( await del('1.tmp', {cwd: t.context.tmp}), [path.join(t.context.tmp, '1.tmp')] ); }); test('return deleted files - sync', t => { t.deepEqual( del.sync('1.tmp', {cwd: t.context.tmp}), [path.join(t.context.tmp, '1.tmp')] ); }); test('don\'t delete files, but return them - async', async t => { const deletedFiles = await del(['*.tmp', '!1*'], { cwd: t.context.tmp, dryRun: true }); exists(t, ['1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); t.deepEqual(deletedFiles, [ path.join(t.context.tmp, '2.tmp'), path.join(t.context.tmp, '3.tmp'), path.join(t.context.tmp, '4.tmp') ]); }); test('don\'t delete files, but return them - sync', t => { const deletedFiles = del.sync(['*.tmp', '!1*'], { cwd: t.context.tmp, dryRun: true }); exists(t, ['1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); t.deepEqual(deletedFiles, [ path.join(t.context.tmp, '2.tmp'), path.join(t.context.tmp, '3.tmp'), path.join(t.context.tmp, '4.tmp') ]); }); // Currently this is only testable locally on macOS. // https://github.com/sindresorhus/del/issues/68 test('does not throw EINVAL - async', async t => { await del('**/*', { cwd: t.context.tmp, dot: true }); const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); const totalAttempts = 200; let count = 0; while (count !== totalAttempts) { makeDir.sync(nestedFile); // eslint-disable-next-line no-await-in-loop const removed = await del('**/*', { cwd: t.context.tmp, dot: true }); const expected = [ path.resolve(t.context.tmp, 'a'), path.resolve(t.context.tmp, 'a/b'), path.resolve(t.context.tmp, 'a/b/c'), path.resolve(t.context.tmp, 'a/b/c/nested.js') ]; t.deepEqual(removed, expected); count += 1; } notExists(t, [...fixtures, 'a']); t.is(count, totalAttempts); }); test('does not throw EINVAL - sync', t => { del.sync('**/*', { cwd: t.context.tmp, dot: true }); const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); const totalAttempts = 200; let count = 0; while (count !== totalAttempts) { makeDir.sync(nestedFile); const removed = del.sync('**/*', { cwd: t.context.tmp, dot: true }); const expected = [ path.resolve(t.context.tmp, 'a'), path.resolve(t.context.tmp, 'a/b'), path.resolve(t.context.tmp, 'a/b/c'), path.resolve(t.context.tmp, 'a/b/c/nested.js') ]; t.deepEqual(removed, expected); count += 1; } notExists(t, [...fixtures, 'a']); t.is(count, totalAttempts); }); test('delete relative files outside of process.cwd using cwd - async', async t => { await del(['1.tmp'], {cwd: t.context.tmp}); exists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); notExists(t, ['1.tmp']); }); test('delete relative files outside of process.cwd using cwd - sync', t => { del.sync(['1.tmp'], {cwd: t.context.tmp}); exists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); notExists(t, ['1.tmp']); }); test('delete absolute files outside of process.cwd using cwd - async', async t => { const absolutePath = path.resolve(t.context.tmp, '1.tmp'); await del([absolutePath], {cwd: t.context.tmp}); exists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); notExists(t, ['1.tmp']); }); test('delete absolute files outside of process.cwd using cwd - sync', t => { const absolutePath = path.resolve(t.context.tmp, '1.tmp'); del.sync([absolutePath], {cwd: t.context.tmp}); exists(t, ['2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); notExists(t, ['1.tmp']); }); test('cannot delete actual working directory without force: true - async', async t => { process.chdir(t.context.tmp); await t.throwsAsync(del([t.context.tmp]), { instanceOf: Error, message: 'Cannot delete the current working directory. Can be overridden with the `force` option.' }); exists(t, ['', '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('cannot delete actual working directory without force: true - sync', t => { process.chdir(t.context.tmp); t.throws(() => { del.sync([t.context.tmp]); }, { instanceOf: Error, message: 'Cannot delete the current working directory. Can be overridden with the `force` option.' }); exists(t, ['', '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('cannot delete actual working directory with cwd option without force: true - async', async t => { process.chdir(t.context.tmp); await t.throwsAsync(del([t.context.tmp], {cwd: __dirname}), { instanceOf: Error, message: 'Cannot delete the current working directory. Can be overridden with the `force` option.' }); exists(t, ['', '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('cannot delete actual working directory with cwd option without force: true - sync', t => { process.chdir(t.context.tmp); t.throws(() => { del.sync([t.context.tmp], {cwd: __dirname}); }, { instanceOf: Error, message: 'Cannot delete the current working directory. Can be overridden with the `force` option.' }); exists(t, ['', '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('cannot delete files outside cwd without force: true - async', async t => { const absolutePath = path.resolve(t.context.tmp, '1.tmp'); await t.throwsAsync(del([absolutePath]), { instanceOf: Error, message: 'Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.' }); exists(t, ['1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); }); test('cannot delete files outside cwd without force: true - sync', t => { const absolutePath = path.resolve(t.context.tmp, '1.tmp'); t.throws(() => { del.sync([absolutePath]); }, { instanceOf: Error, message: 'Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.' }); exists(t, ['', '1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); }); test('cannot delete files inside process.cwd when outside cwd without force: true - async', async t => { process.chdir(t.context.tmp); const removeFile = path.resolve(t.context.tmp, '2.tmp'); const cwd = path.resolve(t.context.tmp, '1.tmp'); await t.throwsAsync(del([removeFile], {cwd}), { instanceOf: Error, message: 'Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.' }); exists(t, ['1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('cannot delete files inside process.cwd when outside cwd without force: true - sync', t => { process.chdir(t.context.tmp); const removeFile = path.resolve(t.context.tmp, '2.tmp'); const cwd = path.resolve(t.context.tmp, '1.tmp'); t.throws(() => { del.sync([removeFile], {cwd}); }, { instanceOf: Error, message: 'Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.' }); exists(t, ['1.tmp', '2.tmp', '3.tmp', '4.tmp', '.dot.tmp']); process.chdir(processCwd); }); test('windows can pass absolute paths with "\\" - async', async t => { const filePath = path.resolve(t.context.tmp, '1.tmp'); const removeFiles = await del([filePath], {cwd: t.context.tmp, dryRun: true}); t.deepEqual(removeFiles, [filePath]); }); test('windows can pass absolute paths with "\\" - sync', t => { const filePath = path.resolve(t.context.tmp, '1.tmp'); const removeFiles = del.sync([filePath], {cwd: t.context.tmp, dryRun: true}); t.deepEqual(removeFiles, [filePath]); }); test('windows can pass relative paths with "\\" - async', async t => { const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); makeDir.sync(nestedFile); const removeFiles = await del([nestedFile], {cwd: t.context.tmp, dryRun: true}); t.deepEqual(removeFiles, [nestedFile]); }); test('windows can pass relative paths with "\\" - sync', t => { const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); makeDir.sync(nestedFile); const removeFiles = del.sync([nestedFile], {cwd: t.context.tmp, dryRun: true}); t.deepEqual(removeFiles, [nestedFile]); });