gulpjs / gulpjs/glob-parent

Incorrect identification of the static part of the pattern for the disk root on Windows

Open
#63 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
82
Forks
51
PR merge metrics
No merged PRs in 30d

Description

### What were you expecting to happen?

```js
expect(gp('C:/', { flipBackslashes: false })).toEqual('C:/');
expect(gp('C:/.', { flipBackslashes: false })).toEqual('C:/');
expect(gp('C:/*', { flipBackslashes: false })).toEqual('C:/');
expect(gp('C:/./*', { flipBackslashes: false })).toEqual('C:/.');
expect(gp('C://', { flipBackslashes: false })).toEqual('C:/');
expect(gp('C://*', { flipBackslashes: false })).toEqual('C:/');
```

### What actually happened?

```js
expect(gp('C:/', { flipBackslashes: false })).toEqual('C:'); // 🔴 C: instead of C:/
expect(gp('C:/.', { flipBackslashes: false })).toEqual('C:'); // 🔴 C: instead of C:/
expect(gp('C:/*', { flipBackslashes: false })).toEqual('C:'); // 🔴 C: instead of C:/
expect(gp('C:/./*', { flipBackslashes: false })).toEqual('C:/.'); // 🟢
expect(gp('C://', { flipBackslashes: false })).toEqual('C:/'); // 🟢
expect(gp('C://*', { flipBackslashes: false })).toEqual('C:/'); // 🟢
```

### Please give us a sample of your gulpfile

The examples above are tests for this repository.

### Please provide the following information:

* OS & version [e.g. MacOS Catalina 10.15.4]: Windows 11 PRO 22H2
* node version (run `node -v`): `v20.0.0`
* npm version (run `npm -v`): `9.6.4`
* gulp version (run `gulp -v`): nope

### Additional information

The current result is not correct because its use leads to incorrect results in standard Node methods.like `path.*` or `fs.*`:

```js
CWD: D:\\OpenSource\\glob-parent

const path = require('path');

path.win32.resolve('D:'); // CWD
path.win32.resolve('D:/'); // D:\\

const fs = require('fs');

fs.readdirSync('D:'); // list CWD
fs.readdirSync('D:/'); // list D:\\
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.