{"id":17172221,"url":"https://github.com/lucasconstantino/now-we-test","last_synced_at":"2025-10-19T04:15:23.495Z","repository":{"id":56504714,"uuid":"163018625","full_name":"lucasconstantino/now-we-test","owner":"lucasconstantino","description":"Test your Now deployed Node.js lambdas locally","archived":false,"fork":false,"pushed_at":"2019-04-16T16:52:38.000Z","size":304,"stargazers_count":50,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T22:02:14.671Z","etag":null,"topics":["lambda","local","now","serve","testing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucasconstantino.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-24T19:26:37.000Z","updated_at":"2021-03-04T04:03:06.000Z","dependencies_parsed_at":"2022-08-15T20:00:46.434Z","dependency_job_id":null,"html_url":"https://github.com/lucasconstantino/now-we-test","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fnow-we-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fnow-we-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fnow-we-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasconstantino%2Fnow-we-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasconstantino","download_url":"https://codeload.github.com/lucasconstantino/now-we-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248743666,"owners_count":21154716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lambda","local","now","serve","testing"],"created_at":"2024-10-14T23:36:26.565Z","updated_at":"2025-10-19T04:15:18.443Z","avatar_url":"https://github.com/lucasconstantino.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Now we test\n\n[![Build Status](https://travis-ci.org/lucasconstantino/now-we-test.svg?branch=master)](https://travis-ci.org/lucasconstantino/now-we-test)\n[![coverage](https://img.shields.io/codecov/c/github/lucasconstantino/now-we-test.svg?style=flat-square)](https://codecov.io/github/lucasconstantino/now-we-test)\n[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![npm version](https://img.shields.io/npm/v/now-we-test.svg?style=flat-square)](https://www.npmjs.com/package/now-we-test)\n\nTemporary lib to help test [Now.sh](https://zeit.co/now) lambdas written in Node.js. It was created with the purpose to eventually be deprecated when [`now dev` command](https://github.com/zeit/now-cli/issues/1681) is released.\n\n## Purpose\n\nHelp unit test and locally serve lambdas written to deploy using Now.\n\n## Installation\n\n`yarn add now-we-test --dev`\n\n## Usage\n\n### For unit tests\n\nIn your unit tests, you can use the `simulator` helper to simulate a lambda execution environment without needing a running server:\n\n```js\nimport { simulator } from 'now-we-test'\nimport func from '../your-lambda-implementation'\n\nconst app = simulator(func)\n\ndescribe('func', () =\u003e {\n  it('should do something', async () =\u003e {\n    const result = await app.get('/')\n\n    expect(result.text).toBe('[the value returned by the lambda]')\n  })\n})\n```\n\nSignature:\n\n```\nsimulator(\n  fn: Function,\n  [builder=\"@now/node\"]: String\n)\n```\n\nAlternatively to the default `@now/node` building evironment, you can also simulate a [`now-micro`](https://github.com/lucasconstantino/now-micro) passing it as second parameter.\n\n\u003e The result of the invokation of `simulator` helper is a [SuperTest](https://github.com/visionmedia/supertest) instance, so please refer to that documentation for details on possible assertions and usage.\n\n### For locally serving lambdas\n\n_Now we test_ provides a simple CLI to serve your lambdas locally - useful for testing integration with other tools.\n\n\u003e Keep in mind there is only so much it can do in terms of simulation, so you should never completelly trust what works locally would necessarily work on Now.sh environment.\n\n#### Commands\n\n- [`now-we-test serve`](#now-we-test-serve)\n- [`now-we-test help [COMMAND]`](#now-we-test-help-command)\n\n##### `now-we-test serve`\n\nServes the lambdas locally\n\n```\nUSAGE\n  $ now-we-test serve [PATH]\n\nARGUMENTS\n  PATH  [default: .] The path to the directory where now.json stands\n\nOPTIONS\n  -f, --format=format  [default: combined] logger format (morgan compliant)\n  -p, --port=port      [default: 3000] port to use\n```\n\n_See code: [lib/commands/serve.js](https://github.com/lucasconstantino/now-we-test/blob/v0.0.0/src/commands/serve.js)_\n\n\u003e Only `@now/node`, `@now/static`, and `now-micro` builders are available so far.\n\n##### `now-we-test help [COMMAND]`\n\ndisplay help for a now-we-test command\n\n```\nUSAGE\n  $ now-we-test help [COMMAND]\n\nARGUMENTS\n  COMMAND  command to show help for\n\nOPTIONS\n  --all  see all commands in CLI\n```\n\n_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.4/src/commands/help.ts)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasconstantino%2Fnow-we-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasconstantino%2Fnow-we-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasconstantino%2Fnow-we-test/lists"}