Skip to content

Commit

Permalink
wip: make sure this compiles and fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Dec 12, 2022
1 parent 5065a5d commit aa1630a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"target_name": "watcher",
"defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ],
"sources": [ "src/binding.cc", "src/Watcher.cc", "src/Backend.cc", "src/DirTree.cc" ],
"sources": [ "src/binding.cc", "src/Watcher.cc", "src/Backend.cc", "src/DirTree.cc", "src/Glob.cc" ],
"include_dirs" : ["<!(node -p \"require('node-addon-api').include_dir\")"],
"dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
'cflags!': [ '-fno-exceptions' ],
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ function normalizeOptions(dir, opts = {}) {
opts.ignoreGlobs = [];
}

opts.ignoreGlobs.push(micromatch.makeRe(value).toString());
const regex = micromatch.makeRe(value).toString();
opts.ignoreGlobs.push(regex.substring(1, regex.length - 1));
} else {
if (!opts.ignorePaths) {
opts.ignorePaths = [];
Expand Down
6 changes: 3 additions & 3 deletions test/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ describe('watcher', () => {
ignoreDir = getFilename();
ignoreFile = getFilename();
ignoreGlobDir = getFilename();
await fs.mkdir(ignoreGlobDir);
await fs.mkdir(path.join(ignoreGlobDir, 'ignore'));
fileToRename = getFilename();
dirToRename = getFilename();
fs.writeFileSync(fileToRename, 'hi');
Expand Down Expand Up @@ -518,9 +520,7 @@ describe('watcher', () => {
assert.deepEqual(res, [{type: 'create', path: f1}]);
});

it('should ignore globs', async () => {
await fs.mkdir(path.join(ignoreGlobDir, 'ignore'));

it.only('should ignore globs', async () => {

This comment has been minimized.

Copy link
@bpasero

bpasero Dec 12, 2022

Contributor

fyi only

fs.writeFile(path.join(ignoreGlobDir, 'test.txt'), 'hello');
fs.writeFile(path.join(ignoreGlobDir, 'test.ignore'), 'hello');
fs.writeFile(path.join(ignoreGlobDir, 'ignore', 'test.txt'), 'hello');
Expand Down

0 comments on commit aa1630a

Please sign in to comment.