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

Epic: Testing #410

Closed
5 of 6 tasks
Tracked by #345 ...
lukekarrys opened this issue Nov 18, 2021 · 1 comment
Closed
5 of 6 tasks
Tracked by #345 ...

Epic: Testing #410

lukekarrys opened this issue Nov 18, 2021 · 1 comment
Assignees
Labels

Comments

@lukekarrys
Copy link
Contributor

lukekarrys commented Nov 18, 2021

Epic

This epic to to discuss our goals for testing within the cli and how and where we want to pay down tech debt w/r/t testing. Our overarching goal with this should be to test the cli as closely as possible to how it is used in practice. We can also have a sync meeting to go along with this issue for more in depth discussion.

Ideas/spikes/todos:

  • Port another command to sandbox to see if any issues come up
  • Port config test to mockNpm
  • Pass argv directly to config to avoid load then config dance we do currently
  • Remove last traces of fakenpmmock
  • Come up with recipes for more declarative testing. We should provide a way to test more scenarios in a more readable format. I attempted this somewhat with shrinkwrap tests
  • document in testing wiki
@lukekarrys
Copy link
Contributor Author

I created tap proposals for features that I think would help us create more declarative and flexible tests:

lukekarrys added a commit to npm/cli that referenced this issue Nov 30, 2021
This decouples the log file writing from the terminal logging. We now
open an append only file at the start of the process and stream logs to
it. We still only display the log file message in timing mode or if
there is an error, but the file is still written regardless.

All logging now goes through `proc-log` and his is the first step to
removing `npmlog`. For now `npmlog` is still used for the terminal
logging but with a shim in front of it to make it easier to test and
use in conjunction with `proc-log`. Ref: npm/statusboard#366

This also refactors many of the tests to always use an explicit
`t.testdir` for their cache since the file is opened on each `new Npm()`.
Tests are also refactored to use more of `MockNpm` with behavior to
add config items and load `npm` if necessary. A new fixture `mockGlobals`
was also added to make much of this for ergonomic. Ref: npm/statusboard#410

Closes npm/statusboard#411
Closes npm/statusboard#367
lukekarrys added a commit to npm/cli that referenced this issue Dec 1, 2021
This decouples the log file writing from the terminal logging. We now
open an append only file at the start of the process and stream logs to
it. We still only display the log file message in timing mode or if
there is an error, but the file is still written regardless.

All logging now goes through `proc-log` and this is the first step to
removing `npmlog`. For now `npmlog` is still used for the terminal
logging but with a shim in front of it to make it easier to test and
use in conjunction with `proc-log`. Ref: npm/statusboard#366

This also refactors many of the tests to always use an explicit
`t.testdir` for their cache since the file is opened on each `new Npm()`.
Tests are also refactored to use more of `MockNpm` with behavior to
add config items and load `npm` if necessary. A new fixture `mockGlobals`
was also added to make much of this more ergonomic. Ref: npm/statusboard#410

Closes npm/statusboard#411
Closes npm/statusboard#367
lukekarrys added a commit to npm/cli that referenced this issue Dec 2, 2021
This decouples the log file writing from the terminal logging. We now
open an append only file at the start of the process and stream logs to
it. We still only display the log file message in timing mode or if
there is an error, but the file is still written regardless.

All logging now goes through `proc-log` and this is the first step to
removing `npmlog`. For now `npmlog` is still used for the terminal
logging but with a shim in front of it to make it easier to test and
use in conjunction with `proc-log`. Ref: npm/statusboard#366

This also refactors many of the tests to always use an explicit
`t.testdir` for their cache since the file is opened on each `new Npm()`.
Tests are also refactored to use more of `MockNpm` with behavior to
add config items and load `npm` if necessary. A new fixture `mockGlobals`
was also added to make much of this more ergonomic. Ref: npm/statusboard#410

Closes npm/statusboard#411
Closes npm/statusboard#367

PR-URL: #4062
Credit: @lukekarrys
Close: #4062
Reviewed-by: @wraithgar
@darcyclarke darcyclarke mentioned this issue Mar 23, 2022
32 tasks
@darcyclarke darcyclarke changed the title Testing Epic Epic: Testing Mar 23, 2022
@darcyclarke darcyclarke mentioned this issue Aug 22, 2022
46 tasks
@lukekarrys lukekarrys self-assigned this Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant