Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add include and exclude options to instrument command #1007

Merged

Commits on Mar 1, 2019

  1. Added include and exclude options for instrument command

    This allows you to better select which files are instrumented when running the instrument command.  It's a pretty minimal implementation to make it as easy as possible to integrate with other proposed changes.  Test support is included with this change.
    Andrew Finlay committed Mar 1, 2019
    Copy the full SHA
    d576e44 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2019

  1. Merge branch 'master' into instrument-include-exclude-option

    # Conflicts:
    #	lib/commands/instrument.js
    Andrew Finlay committed Mar 7, 2019
    Copy the full SHA
    39db2cc View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2019

  1. Merge branch 'master' into instrument-include-exclude-option

    # Conflicts:
    #	lib/commands/instrument.js
    Andrew Finlay committed Mar 11, 2019
    Copy the full SHA
    880ccde View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2019

  1. Merge branch 'master' into instrument-include-exclude-option

    # Conflicts:
    #	index.js
    #	lib/commands/instrument.js
    #	test/nyc-integration.js
    Andrew Finlay committed Mar 20, 2019
    Copy the full SHA
    5f76838 View commit details
    Browse the repository at this point in the history
  2. nyc instrument copies all files to an output directory, then adds i…

    …nstrumented versions where needed
    
    So I've implemented this using `fs-extra`, not sure if that's the module you wish to go with here.
    This is now relying on `testExclude.globSync` to get the correct files for instrumentation, so no more `shouldInstrument`
    There's quite a few test changes in here, as `fs-extra.copySync` won't let you copy from `./` to `./outputMkdirHere`, but they're probably for the best anyway.
    This also means that any attempt to store the instrumentation result in a subdir of the input dir will fail.
    Andrew Finlay committed Mar 20, 2019
    Copy the full SHA
    5174d12 View commit details
    Browse the repository at this point in the history
  3. Use var cov_ rather than _cov in tests

    Andrew Finlay committed Mar 20, 2019
    Copy the full SHA
    bd25a38 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2019

  1. nyc instrument now copies all files, with permissions, from input t…

    …o `output` dir
    
    It ignores files in the `.git` folder and copies empty directories
    Unfortunately I had to keep `fs-extra`, although this should be easy to drop when the project moves to node 8+ when `fs.copyFileSync` is made available.
    We need to use `fs.chmodSync` to set the mode as any `write` mode flags get filtered when trying to set them through `fs.writeFileSync`.
    
    What's missing?
     * No check to see where the working directory is relative to the project root directory
     * Tests confirming includes/excludes can be set in a config file or stanza and are observed by the instrument command
     * Tests confirming file permissions match between files in the input and output directories
     * Tests confirming we can't instrument outside of the project root directory
    Andrew Finlay committed Mar 22, 2019
    Copy the full SHA
    02bc210 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2019

  1. Update tests, prevent in place instrumentation and instrumentation ou…

    …tside of cwd
    
    Tests include
      * using a `.nycrc` file to specify excludes
      * checking that file mode is preserved after instrumentation,
      * copying all uninstrumented files across to the output directory
      * Ensure that we can't instrument in place, overwriting the existing source
      * Ensure that we can't instrument source from outside the project root directory
    Andrew Finlay committed Mar 25, 2019
    Copy the full SHA
    b2eb670 View commit details
    Browse the repository at this point in the history
  2. Include missing test files

    A file `node_modules` file involved in the tests was being git ignored
    Andrew Finlay committed Mar 25, 2019
    Copy the full SHA
    995aa1a View commit details
    Browse the repository at this point in the history
  3. Ignore file permissions test if running on Windows

    Andrew Finlay committed Mar 25, 2019
    Copy the full SHA
    5a28941 View commit details
    Browse the repository at this point in the history
  4. Use process.platform instead of os.platform

    Andrew Finlay committed Mar 25, 2019
    Copy the full SHA
    d22c585 View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2019

  1. Merge branch 'master' into instrument-include-exclude-option

    # Conflicts:
    #	index.js
    Andrew Finlay committed Mar 28, 2019
    Copy the full SHA
    fd69f9a View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2019

  1. Clean up copy remaining files for nyc instrument command

    In the last attempt at this I was jumping through hoops trying to maintain empty folders and structure etc.  Turns out none of that is necessary.
    So this change runs the instrumentation process over the included files, then copies across anything remaining excluding freshly created output directory.
    Andrew Finlay committed Apr 2, 2019
    Copy the full SHA
    1fbc204 View commit details
    Browse the repository at this point in the history
  2. Make sure we can instrument the root directory

    And a test to prove it!
    Andrew Finlay committed Apr 2, 2019
    Copy the full SHA
    e1a1b94 View commit details
    Browse the repository at this point in the history
  3. Merge in master, update test title

    Andrew Finlay committed Apr 2, 2019
    Copy the full SHA
    17e4736 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2019

  1. Copy the full SHA
    6852bbf View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2019

  1. Split PR such that this only handles `nyc instrument --include --excl…

    …ude`
    
    Previously this was adding `nyc instrument` full copy of `src` to `dst` as well as `include`/`exclude`
    The full copy work was proving troublesome so it's been moved to it's own branch/PR
    This commit removes the full copy, removes now unused dependencies, and updates tests accordingly
    Andrew Finlay committed Apr 4, 2019
    Copy the full SHA
    8903365 View commit details
    Browse the repository at this point in the history