remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.31k stars 1.73k forks source link

Ignoring "tests/" works different way than others #2089

Closed marekszczepansky closed 1 year ago

marekszczepansky commented 1 year ago

Hello I'm struggling with ignoring any tests folder in my tree.

Expected behaviour

I expect all tests folders to be ignored -> tests/**/* pattern

Actual behaviour

It works as expected for other folders but tests. Nodemon adds ./ to the pattern and ignores only the root tests folder:

$ nodemon ./server/server.js --exec 'node --inspect -r ts-node/register -r @babel/register' long-timeout
[nodemon] 2.0.20
[nodemon] reading config ./nodemon.json
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 77641 to restart
[nodemon] ignoring: locales/*-*/**/* __tests__/**/* ./tests/**/* test-data/**/* ./app/**/*
[nodemon] watching path(s): app/**/* config/**/* server/**/* shared/**/* locales/all/**/* server.js
[nodemon] watching extensions: js,jsx,ts,tsx,json,hbs
[nodemon] bind restart -> `echo restarted > nodemon-restarted`
[nodemon] starting `node --inspect -r ts-node/register -r @babel/register ./server/server.js long-timeout`
[nodemon] spawning
[nodemon] child pid: 77643

Steps to reproduce

  1. prepare config nodemon.json
    {
    "restartable": "rs",
    "ignore": [
    "locales/*-*/",
    "__tests__/",
    "tests/",
    "test-data/",
    "./app"
    ],
    "verbose": true,
    "execMap": {
    "ts": "node --require ts-node/register/transpile-only"
    },
    "watch": [
    "app/",
    "config/",
    "server/",
    "shared/",
    "locales/all/",
    "server.js"
    ],
    "ext": "js,jsx,ts,tsx,json,hbs",
    "events": {
    "restart": "echo restarted > nodemon-restarted"
    }
    }
  2. run nodemon -V and check ignoring: line or prepare a project tree having many tests folders and verify if nodemon ignores changes in included files.

--------------
node: v14.17.6
nodemon: 2.0.20
command: /Users/marek/.nvm/versions/node/v14.17.6/bin/node /opt/homebrew/bin/nodemon ./server/server.js --exec node --inspect -r ts-node/register -r @babel/register --dump long-timeout
cwd: /Users/marek/work/Projects/redacted
OS: darwin x64
--------------
{
  run: false,
  system: { cwd: '/Users/marek/work/Projects/redacted' },
  required: false,
  dirs: [
    '/Users/marek/work/Projects/redacted/app',
    '/Users/marek/work/Projects/redacted/config',
    '/Users/marek/work/Projects/redacted/server',
    '/Users/marek/work/Projects/redacted/shared',
    '/Users/marek/work/Projects/redacted/locales/all'
  ],
  timeout: 1000,
  options: {
    exec: 'node --inspect -r ts-node/register -r @babel/register',
    dump: true,
    restartable: 'rs',
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      'locales/*-*/',
      '__tests__/',
      'tests/',
      'test-data/',
      './app',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*|locales\/.*\-.*\/|__tests__\/|tests\/|test\-data\/|\.\/app/
    ],
    verbose: true,
    execMap: {
      ts: 'node --require ts-node/register/transpile-only',
      py: 'python',
      rb: 'ruby'
    },
    watch: [
      'app/',
      'config/',
      'server/',
      'shared/',
      'locales/all/',
      'server.js',
      re: /app\/|config\/|server\/|shared\/|locales\/all\/|server\.js/
    ],
    events: { restart: 'echo restarted > nodemon-restarted' },
    monitor: [
      '/Users/marek/work/Projects/redacted/app/**/*',
      '/Users/marek/work/Projects/redacted/config/**/*',
      '/Users/marek/work/Projects/redacted/server/**/*',
      '/Users/marek/work/Projects/redacted/shared/**/*',
      '/Users/marek/work/Projects/redacted/locales/all/**/*',
      'server.js',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**',
      '!locales/*-*/**/*',
      '!__tests__/**/*',
      '!/Users/marek/work/Projects/redacted/tests/**/*',
      '!test-data/**/*',
      '!/Users/marek/work/Projects/redacted/app/**/*'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    colours: true,
    stdin: true,
    runOnChangeOnly: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: './server/server.js',
      exec: 'node --inspect -r ts-node/register -r @babel/register',
      args: [ 'long-timeout' ],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'js,jsx,ts,tsx,json,hbs',
      env: {}
    }
  },
  load: [Function (anonymous)],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ '/Users/marek/work/Projects/redacted/nodemon.json' ],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: {
      executable: 'node --inspect -r ts-node/register -r @babel/register',
      args: [ './server/server.js', 'long-timeout' ]
    },
    string: 'node --inspect -r ts-node/register -r @babel/register ./server/server.js long-timeout'
  }
}
--------------
github-actions[bot] commented 1 year ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

github-actions[bot] commented 1 year ago

Automatically closing this issue due to lack of activity