99x / dynamodb-localhost

Dynamodb localhost runner for development and testing
MIT License
35 stars 92 forks source link

unwanted console.log[s] in integration tests output #54

Open davidecavaliere opened 5 years ago

davidecavaliere commented 5 years ago

Running the following test:


describe('DynamodbService', () => {
  let instance: UserPersistenceService;

  beforeEach(() => {
    instance = new UserPersistenceService();
    dynamodb.install();
    dynamodb.start({
      port: 8000
    });
  });

  it('can be instantiated', () => {

    expect(instance instanceof UserPersistenceService).toBeTruthy();
  });

  afterEach(() => {
    dynamodb.stop({
      port: 8000
    })
  });
});

produces the following output in tests results:

 PASS  packages/datagator/src/lib/dynamodb/dynamodb.service.spec.ts (6.001s)
  ● Console

    console.log node_modules/dynamodb-localhost/dynamodb/installer.js:12
      Started downloading dynamodb-local from http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz into /home/developer/src/microgamma/node_modules/dynamodb-localhost/dynamodb/bin. Process may take few minutes.
    console.log node_modules/dynamodb-localhost/index.js:30
      Dynamodb Local Started, Visit: http://localhost:8000/shell

I expect the output to be clean and to still be able to get debugging info if wanted using DEBUG=dynamodb-localhost:* environment variable

hntrl commented 5 years ago

I'll do you one better. I get 7000+ lines of nothing from using the install handler.

codan84 commented 3 years ago

+1.
Any logging to the console should be an option! Can we please be able to switch that one off?
For now I run install in a child_process.fork with silent: true (https://nodejs.org/docs/latest/api/child_process.html#child_process_child_process_fork_modulepath_args_options). Unfortunately due to how stopping of the DB works we can't do the same with start