| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,14 +76,32 @@ test-domain-throw-error-then-throw-from-uncaught-exception-handler: PASS, FLAKY | |||
| 76 | 76 | test-domain-with-abort-on-uncaught-exception: PASS, FLAKY | |
| 77 | 77 | # https://github.com/nodejs/node/issues/54346 | |
| 78 | 78 | test-esm-loader-hooks-inspect-wait: PASS, FLAKY | |
| 79 | + # https://github.com/nodejs/node/issues/61520 | ||
| 79 | 80 | test-fs-promises-watch-iterator: SKIP | |
| 81 | + test-fs-promises-watch-ignore-function: SKIP | ||
| 82 | + test-fs-promises-watch-ignore-glob: SKIP | ||
| 83 | + test-fs-promises-watch-ignore-mixed: SKIP | ||
| 84 | + test-fs-promises-watch-ignore-regexp: SKIP | ||
| 85 | + test-fs-watch-ignore-function: SKIP | ||
| 86 | + test-fs-watch-ignore-glob: SKIP | ||
| 87 | + test-fs-watch-ignore-mixed: SKIP | ||
| 88 | + test-fs-watch-ignore-regexp: SKIP | ||
| 80 | 89 | # https://github.com/nodejs/node/issues/50050 | |
| 81 | 90 | test-tick-processor-arguments: SKIP | |
| 82 | 91 | ||
| 83 | 92 | [$system==freebsd] | |
| 84 | 93 | # https://github.com/nodejs/node/issues/54346 | |
| 85 | 94 | test-esm-loader-hooks-inspect-wait: PASS, FLAKY | |
| 95 | + # https://github.com/nodejs/node/issues/61520 | ||
| 86 | 96 | test-fs-promises-watch-iterator: SKIP | |
| 97 | + test-fs-promises-watch-ignore-function: SKIP | ||
| 98 | + test-fs-promises-watch-ignore-glob: SKIP | ||
| 99 | + test-fs-promises-watch-ignore-mixed: SKIP | ||
| 100 | + test-fs-promises-watch-ignore-regexp: SKIP | ||
| 101 | + test-fs-watch-ignore-function: SKIP | ||
| 102 | + test-fs-watch-ignore-glob: SKIP | ||
| 103 | + test-fs-watch-ignore-mixed: SKIP | ||
| 104 | + test-fs-watch-ignore-regexp: SKIP | ||
| 87 | 105 | ||
| 88 | 106 | [$system==aix] | |
| 89 | 107 | # https://github.com/nodejs/node/issues/54346 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,46 @@ | |||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + import { skipIfNoWatch } from '../common/watch.js'; | ||
| 3 | + | ||
| 4 | + skipIfNoWatch(); | ||
| 5 | + | ||
| 6 | + const assert = await import('node:assert'); | ||
| 7 | + const path = await import('node:path'); | ||
| 8 | + const tmpdir = await import('../common/tmpdir.js'); | ||
| 9 | + const { setTimeout } = await import('node:timers/promises'); | ||
| 10 | + const { watch } = await import('node:fs/promises'); | ||
| 11 | + const { writeFileSync } = await import('node:fs'); | ||
| 12 | + | ||
| 13 | + tmpdir.refresh(); | ||
| 14 | + | ||
| 15 | + const testDir = tmpdir.resolve(); | ||
| 16 | + const keepFile = 'visible.txt'; | ||
| 17 | + const ignoreFile = '.hidden'; | ||
| 18 | + const keepFilePath = path.join(testDir, keepFile); | ||
| 19 | + const ignoreFilePath = path.join(testDir, ignoreFile); | ||
| 20 | + | ||
| 21 | + async function watchDir() { | ||
| 22 | + const watcher = watch(testDir, { | ||
| 23 | + ignore: (filename) => filename.startsWith('.'), | ||
| 24 | + }); | ||
| 25 | + | ||
| 26 | + for await (const { filename } of watcher) { | ||
| 27 | + assert.notStrictEqual(filename, ignoreFile); | ||
| 28 | + | ||
| 29 | + if (filename === keepFile) { | ||
| 30 | + break; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + async function writeFiles() { | ||
| 36 | + if (common.isMacOS) { | ||
| 37 | + // Do the write with a delay to ensure that the OS is ready to notify us. | ||
| 38 | + // See https://github.com/nodejs/node/issues/52601. | ||
| 39 | + await setTimeout(common.platformTimeout(100)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + writeFileSync(ignoreFilePath, 'ignored'); | ||
| 43 | + writeFileSync(keepFilePath, 'content'); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + await Promise.all([watchDir(), writeFiles()]); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + import { skipIfNoWatch } from '../common/watch.js'; | ||
| 3 | + | ||
| 4 | + skipIfNoWatch(); | ||
| 5 | + | ||
| 6 | + const assert = await import('node:assert'); | ||
| 7 | + const path = await import('node:path'); | ||
| 8 | + const tmpdir = await import('../common/tmpdir.js'); | ||
| 9 | + const { setTimeout } = await import('node:timers/promises'); | ||
| 10 | + const { watch } = await import('node:fs/promises'); | ||
| 11 | + const { writeFileSync } = await import('node:fs'); | ||
| 12 | + | ||
| 13 | + tmpdir.refresh(); | ||
| 14 | + | ||
| 15 | + const testDir = tmpdir.resolve(); | ||
| 16 | + const keepFile = 'keep.txt'; | ||
| 17 | + const ignoreFile = 'ignore.log'; | ||
| 18 | + const keepFilePath = path.join(testDir, keepFile); | ||
| 19 | + const ignoreFilePath = path.join(testDir, ignoreFile); | ||
| 20 | + | ||
| 21 | + async function watchDir() { | ||
| 22 | + const watcher = watch(testDir, { ignore: '*.log' }); | ||
| 23 | + | ||
| 24 | + for await (const { filename } of watcher) { | ||
| 25 | + assert.notStrictEqual(filename, ignoreFile); | ||
| 26 | + | ||
| 27 | + if (filename === keepFile) { | ||
| 28 | + break; | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + async function writeFiles() { | ||
| 34 | + if (common.isMacOS) { | ||
| 35 | + // Do the write with a delay to ensure that the OS is ready to notify us. | ||
| 36 | + // See https://github.com/nodejs/node/issues/52601. | ||
| 37 | + await setTimeout(common.platformTimeout(100)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + writeFileSync(ignoreFilePath, 'ignored'); | ||
| 41 | + writeFileSync(keepFilePath, 'content'); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + await Promise.all([watchDir(), writeFiles()]); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import { skipIfNoWatch } from '../common/watch.js'; | ||
| 3 | + | ||
| 4 | + skipIfNoWatch(); | ||
| 5 | + | ||
| 6 | + const assert = await import('node:assert'); | ||
| 7 | + const { watch } = await import('node:fs/promises'); | ||
| 8 | + | ||
| 9 | + await assert.rejects( | ||
| 10 | + async () => { | ||
| 11 | + const watcher = watch('.', { ignore: 123 }); | ||
| 12 | + // eslint-disable-next-line no-unused-vars | ||
| 13 | + for await (const _ of watcher) { | ||
| 14 | + // Will throw before yielding | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 19 | + name: 'TypeError', | ||
| 20 | + } | ||
| 21 | + ); | ||
| 22 | + | ||
| 23 | + await assert.rejects( | ||
| 24 | + async () => { | ||
| 25 | + const watcher = watch('.', { ignore: '' }); | ||
| 26 | + // eslint-disable-next-line no-unused-vars | ||
| 27 | + for await (const _ of watcher) { | ||
| 28 | + // Will throw before yielding | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + code: 'ERR_INVALID_ARG_VALUE', | ||
| 33 | + name: 'TypeError', | ||
| 34 | + } | ||
| 35 | + ); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,53 @@ | |||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + import { skipIfNoWatch } from '../common/watch.js'; | ||
| 3 | + | ||
| 4 | + skipIfNoWatch(); | ||
| 5 | + | ||
| 6 | + const assert = await import('node:assert'); | ||
| 7 | + const path = await import('node:path'); | ||
| 8 | + const tmpdir = await import('../common/tmpdir.js'); | ||
| 9 | + const { setTimeout } = await import('node:timers/promises'); | ||
| 10 | + const { watch } = await import('node:fs/promises'); | ||
| 11 | + const { writeFileSync } = await import('node:fs'); | ||
| 12 | + | ||
| 13 | + tmpdir.refresh(); | ||
| 14 | + | ||
| 15 | + const testDir = tmpdir.resolve(); | ||
| 16 | + const keepFile = 'keep.txt'; | ||
| 17 | + const ignoreLog = 'debug.log'; | ||
| 18 | + const ignoreTmp = 'temp.tmp'; | ||
| 19 | + const keepFilePath = path.join(testDir, keepFile); | ||
| 20 | + const ignoreLogPath = path.join(testDir, ignoreLog); | ||
| 21 | + const ignoreTmpPath = path.join(testDir, ignoreTmp); | ||
| 22 | + | ||
| 23 | + async function watchDir() { | ||
| 24 | + const watcher = watch(testDir, { | ||
| 25 | + ignore: [ | ||
| 26 | + '*.log', | ||
| 27 | + /\.tmp$/, | ||
| 28 | + ], | ||
| 29 | + }); | ||
| 30 | + | ||
| 31 | + for await (const { filename } of watcher) { | ||
| 32 | + assert.notStrictEqual(filename, ignoreLog); | ||
| 33 | + assert.notStrictEqual(filename, ignoreTmp); | ||
| 34 | + | ||
| 35 | + if (filename === keepFile) { | ||
| 36 | + break; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + async function writeFiles() { | ||
| 42 | + if (common.isMacOS) { | ||
| 43 | + // Do the write with a delay to ensure that the OS is ready to notify us. | ||
| 44 | + // See https://github.com/nodejs/node/issues/52601. | ||
| 45 | + await setTimeout(common.platformTimeout(100)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + writeFileSync(ignoreLogPath, 'ignored'); | ||
| 49 | + writeFileSync(ignoreTmpPath, 'ignored'); | ||
| 50 | + writeFileSync(keepFilePath, 'content'); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + await Promise.all([watchDir(), writeFiles()]); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + import * as common from '../common/index.mjs'; | ||
| 2 | + import { skipIfNoWatch } from '../common/watch.js'; | ||
| 3 | + | ||
| 4 | + skipIfNoWatch(); | ||
| 5 | + | ||
| 6 | + const assert = await import('node:assert'); | ||
| 7 | + const path = await import('node:path'); | ||
| 8 | + const tmpdir = await import('../common/tmpdir.js'); | ||
| 9 | + const { setTimeout } = await import('node:timers/promises'); | ||
| 10 | + const { watch } = await import('node:fs/promises'); | ||
| 11 | + const { writeFileSync } = await import('node:fs'); | ||
| 12 | + | ||
| 13 | + tmpdir.refresh(); | ||
| 14 | + | ||
| 15 | + const testDir = tmpdir.resolve(); | ||
| 16 | + const keepFile = 'keep.txt'; | ||
| 17 | + const ignoreFile = 'ignore.tmp'; | ||
| 18 | + const keepFilePath = path.join(testDir, keepFile); | ||
| 19 | + const ignoreFilePath = path.join(testDir, ignoreFile); | ||
| 20 | + | ||
| 21 | + async function watchDir() { | ||
| 22 | + const watcher = watch(testDir, { ignore: /\.tmp$/ }); | ||
| 23 | + | ||
| 24 | + for await (const { filename } of watcher) { | ||
| 25 | + assert.notStrictEqual(filename, ignoreFile); | ||
| 26 | + | ||
| 27 | + if (filename === keepFile) { | ||
| 28 | + break; | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + async function writeFiles() { | ||
| 34 | + if (common.isMacOS) { | ||
| 35 | + // Do the write with a delay to ensure that the OS is ready to notify us. | ||
| 36 | + // See https://github.com/nodejs/node/issues/52601. | ||
| 37 | + await setTimeout(common.platformTimeout(100)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + writeFileSync(ignoreFilePath, 'ignored'); | ||
| 41 | + writeFileSync(keepFilePath, 'content'); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + await Promise.all([watchDir(), writeFiles()]); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const { skipIfNoWatch } = require('../common/watch.js'); | ||
| 5 | + | ||
| 6 | + skipIfNoWatch(); | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const path = require('path'); | ||
| 10 | + const fs = require('fs'); | ||
| 11 | + | ||
| 12 | + const tmpdir = require('../common/tmpdir'); | ||
| 13 | + | ||
| 14 | + tmpdir.refresh(); | ||
| 15 | + | ||
| 16 | + const testFileName = 'visible.txt'; | ||
| 17 | + const testFilePath = path.join(tmpdir.path, testFileName); | ||
| 18 | + const ignoredFileName = '.hidden'; | ||
| 19 | + const ignoredFilePath = path.join(tmpdir.path, ignoredFileName); | ||
| 20 | + | ||
| 21 | + const watcher = fs.watch(tmpdir.path, { | ||
| 22 | + ignore: (filename) => filename.startsWith('.'), | ||
| 23 | + }); | ||
| 24 | + | ||
| 25 | + watcher.on('change', common.mustCallAtLeast((event, filename) => { | ||
| 26 | + assert.notStrictEqual(filename, ignoredFileName); | ||
| 27 | + | ||
| 28 | + if (filename === testFileName) { | ||
| 29 | + watcher.close(); | ||
| 30 | + } | ||
| 31 | + }, 1)); | ||
| 32 | + | ||
| 33 | + function writeFiles() { | ||
| 34 | + fs.writeFileSync(ignoredFilePath, 'ignored'); | ||
| 35 | + fs.writeFileSync(testFilePath, 'content'); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + if (common.isMacOS) { | ||
| 39 | + // Do the write with a delay to ensure that the OS is ready to notify us. See | ||
| 40 | + // https://github.com/nodejs/node/issues/52601. | ||
| 41 | + setTimeout(writeFiles, common.platformTimeout(100)); | ||
| 42 | + } else { | ||
| 43 | + writeFiles(); | ||
| 44 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const { skipIfNoWatch } = require('../common/watch.js'); | ||
| 5 | + | ||
| 6 | + skipIfNoWatch(); | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const path = require('path'); | ||
| 10 | + const fs = require('fs'); | ||
| 11 | + | ||
| 12 | + const tmpdir = require('../common/tmpdir'); | ||
| 13 | + | ||
| 14 | + tmpdir.refresh(); | ||
| 15 | + | ||
| 16 | + const testFileName = 'file.txt'; | ||
| 17 | + const testFilePath = path.join(tmpdir.path, testFileName); | ||
| 18 | + const ignoredFileName = 'file.log'; | ||
| 19 | + const ignoredFilePath = path.join(tmpdir.path, ignoredFileName); | ||
| 20 | + | ||
| 21 | + const watcher = fs.watch(tmpdir.path, { | ||
| 22 | + ignore: '*.log', | ||
| 23 | + }); | ||
| 24 | + | ||
| 25 | + watcher.on('change', common.mustCallAtLeast((event, filename) => { | ||
| 26 | + assert.notStrictEqual(filename, ignoredFileName); | ||
| 27 | + | ||
| 28 | + if (filename === testFileName) { | ||
| 29 | + watcher.close(); | ||
| 30 | + } | ||
| 31 | + }, 1)); | ||
| 32 | + | ||
| 33 | + function writeFiles() { | ||
| 34 | + fs.writeFileSync(ignoredFilePath, 'ignored'); | ||
| 35 | + fs.writeFileSync(testFilePath, 'content'); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + if (common.isMacOS) { | ||
| 39 | + // Do the write with a delay to ensure that the OS is ready to notify us. See | ||
| 40 | + // https://github.com/nodejs/node/issues/52601. | ||
| 41 | + setTimeout(writeFiles, common.platformTimeout(100)); | ||
| 42 | + } else { | ||
| 43 | + writeFiles(); | ||
| 44 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,41 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + const { skipIfNoWatch } = require('../common/watch.js'); | ||
| 5 | + | ||
| 6 | + skipIfNoWatch(); | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const fs = require('fs'); | ||
| 10 | + | ||
| 11 | + assert.throws( | ||
| 12 | + () => fs.watch('.', { ignore: 123 }), | ||
| 13 | + { | ||
| 14 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 15 | + name: 'TypeError', | ||
| 16 | + } | ||
| 17 | + ); | ||
| 18 | + | ||
| 19 | + assert.throws( | ||
| 20 | + () => fs.watch('.', { ignore: '' }), | ||
| 21 | + { | ||
| 22 | + code: 'ERR_INVALID_ARG_VALUE', | ||
| 23 | + name: 'TypeError', | ||
| 24 | + } | ||
| 25 | + ); | ||
| 26 | + | ||
| 27 | + assert.throws( | ||
| 28 | + () => fs.watch('.', { ignore: [123] }), | ||
| 29 | + { | ||
| 30 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 31 | + name: 'TypeError', | ||
| 32 | + } | ||
| 33 | + ); | ||
| 34 | + | ||
| 35 | + assert.throws( | ||
| 36 | + () => fs.watch('.', { ignore: [''] }), | ||
| 37 | + { | ||
| 38 | + code: 'ERR_INVALID_ARG_VALUE', | ||
| 39 | + name: 'TypeError', | ||
| 40 | + } | ||
| 41 | + ); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments