Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eugef/node-mocks-http
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.12.2
Choose a base ref
...
head repository: eugef/node-mocks-http
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Mar 25, 2023

  1. Update README.md

    eugef authored Mar 25, 2023
    Copy the full SHA
    40b6caf View commit details
  2. Update README.md

    eugef authored Mar 25, 2023
    Copy the full SHA
    7a63c1b View commit details
  3. Update CONTRIBUTING.md

    eugef authored Mar 25, 2023
    Copy the full SHA
    d42721f View commit details
  4. Update .travis.yml

    eugef authored Mar 25, 2023
    Copy the full SHA
    e95819c View commit details
  5. Copy the full SHA
    f0a95d6 View commit details
  6. Copy the full SHA
    f8fea0e View commit details
  7. Delete .travis.yml

    eugef authored Mar 25, 2023
    Copy the full SHA
    b2e0091 View commit details
  8. Delete dependency-review.yml

    eugef authored Mar 25, 2023
    Copy the full SHA
    1294143 View commit details
  9. Bump flat and gulp-mocha (#265)

    Removes [flat](https://github.com/hughsk/flat). It's no longer used after updating ancestor dependency [gulp-mocha](https://github.com/sindresorhus/gulp-mocha). These dependencies need to be updated together.
    
    
    Removes `flat`
    
    Updates `gulp-mocha` from 7.0.2 to 8.0.0
    - [Release notes](https://github.com/sindresorhus/gulp-mocha/releases)
    - [Commits](sindresorhus/gulp-mocha@v7.0.2...v8.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: flat
      dependency-type: indirect
    - dependency-name: gulp-mocha
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 25, 2023
    Copy the full SHA
    516d17b View commit details

Commits on Jul 19, 2023

  1. Bump word-wrap from 1.2.3 to 1.2.4 (#275)

    Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
    - [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
    - [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)
    
    ---
    updated-dependencies:
    - dependency-name: word-wrap
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 19, 2023
    Copy the full SHA
    5d97424 View commit details

Commits on Aug 9, 2023

  1. Bump node.js engine version

    eugef authored Aug 9, 2023
    Copy the full SHA
    7d5aafb View commit details

Commits on Aug 14, 2023

  1. Request async iterator (#278)

    * Update eslintrc and fix linter error.
    
    * Add async iterator support.
    hbgl authored Aug 14, 2023
    Copy the full SHA
    9a565e0 View commit details
  2. Bump node version

    eugef committed Aug 14, 2023
    Copy the full SHA
    ad145b9 View commit details
  3. Release 1.13.0

    eugef committed Aug 14, 2023
    Copy the full SHA
    08d98f4 View commit details

Commits on Nov 30, 2023

  1. Add testing capability in TypeScript (#282)

    * Move deprecated mocha.opts to .mocharc.js
    
    * Add typescript
    
    * add ts-node
    
    * Add and run dummy test in TypeScript
    
    * Make the first TypeScript test meaningful
    
    * Split the types of tests
    
    * restore ToC
    mhaligowski authored Nov 30, 2023
    Copy the full SHA
    79e42b2 View commit details

Commits on Dec 7, 2023

  1. Fix nodejs typing (#281)

    * [fix] Change the express parent type to NodeJS
    
    * [fix] Change the  too
    
    * Install tsd for testing the package definition
    
    * Disable emitting code at the run of tsc
    
    * have the test be happy with the compilation
    
    * Fix tests
    
    * minor fixes
    mhaligowski authored Dec 7, 2023
    Copy the full SHA
    8e92d5a View commit details

Commits on Dec 11, 2023

  1. Copy the full SHA
    6d0785c View commit details

Commits on Dec 12, 2023

  1. Update README.md

    eugef authored Dec 12, 2023
    Copy the full SHA
    19a85d7 View commit details
  2. Release 1.14.0

    eugef committed Dec 12, 2023
    Copy the full SHA
    15a2c6f View commit details

Commits on Dec 22, 2023

  1. Copy the full SHA
    89ed896 View commit details

Commits on Dec 28, 2023

  1. run tests in Node.js v 10

    eugef authored Dec 28, 2023
    Copy the full SHA
    b252130 View commit details

Commits on Dec 29, 2023

  1. Enable prettier (#286)

    * Enable prettier
    
    temporary disable eslint to avoid conflicts
    
    * adjust prettier config
    
    * configure husky
    
    * remove lint-staged
    
    * ignore lock file
    
    * change format for md files
    eugef authored Dec 29, 2023
    Copy the full SHA
    236d902 View commit details

Commits on Jan 3, 2024

  1. Move express and node types to prod deps (#290)

    * move express and node types to prod deps
    
    * fix url typo
    eugef authored Jan 3, 2024
    2
    Copy the full SHA
    153308f View commit details
  2. Release 1.14.1

    eugef committed Jan 3, 2024
    Copy the full SHA
    fbd60b9 View commit details

Commits on Jan 16, 2024

  1. WIP: enable eslint (#288)

    * enable eslint
    
    * fix more eslint errors
    
    * fix more eslint errors
    
    * fix more eslint errors
    
    * fix all eslint errors
    
    * run lint and prettier in ci
    
    * drop Node 14 support
    eugef authored Jan 16, 2024
    Copy the full SHA
    8a2570b View commit details

Commits on Jan 21, 2024

  1. Update test infra, get rid of gulp (#293)

    * Update test infra, get rdi of gulp
    
    * run test coverage in ci
    
    * report coverage
    eugef authored Jan 21, 2024
    1
    Copy the full SHA
    6683a83 View commit details
  2. Run type check

    eugef committed Jan 21, 2024
    1
    Copy the full SHA
    dd1fb05 View commit details

Commits on Apr 29, 2024

  1. Disable code coverage comment

    eugef authored Apr 29, 2024
    Copy the full SHA
    fbe4dfc View commit details
  2. add to write and end support of TypedArray (#300)

    Co-authored-by: Eugene Fidelin <eugene.fidelin@gmail.com>
    sedx and eugef authored Apr 29, 2024
    Copy the full SHA
    81c3c6c View commit details
  3. fix: return empty string when send was called with undefined (#298)

    Co-authored-by: Eugene Fidelin <eugene.fidelin@gmail.com>
    davidgf and eugef authored Apr 29, 2024
    Copy the full SHA
    6d2dd7e View commit details
  4. Copy the full SHA
    3ffa47a View commit details

Commits on Jun 21, 2024

  1. Release 1.15.0

    eugef committed Jun 21, 2024
    Copy the full SHA
    5ab3de2 View commit details

Commits on Jul 30, 2024

  1. Allowing @types/node v22 (and upgrading it internally) (#305)

    * Allowing @types/node v22 and upgrading it internally.
    
    * Star for @types/node.
    RobinTail authored Jul 30, 2024
    1
    Copy the full SHA
    58c3034 View commit details

Commits on Jul 31, 2024

  1. npm audit fix

    eugef committed Jul 31, 2024
    Copy the full SHA
    2b5a5d1 View commit details
  2. Release 1.15.1

    eugef committed Jul 31, 2024
    Copy the full SHA
    fa98050 View commit details

Commits on Aug 10, 2024

  1. Bump braces from 3.0.2 to 3.0.3 (#303)

    Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
    - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
    - [Commits](micromatch/braces@3.0.2...3.0.3)
    
    ---
    updated-dependencies:
    - dependency-name: braces
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Eugene Fidelin <eugene.fidelin@gmail.com>
    dependabot[bot] and eugef authored Aug 10, 2024
    Copy the full SHA
    73487d1 View commit details

Commits on Sep 9, 2024

  1. Add Fetch API types as accepted mock parameters (#291)

    * Add Fetch API types as accepted mock parameters
    
    * Ran the formatter
    
    ---------
    
    Co-authored-by: Eugene Fidelin <eugene.fidelin@gmail.com>
    mhaligowski and eugef authored Sep 9, 2024
    Copy the full SHA
    845ca93 View commit details
  2. Add appendHeader to MockResponse (#306)

    * Add the appendHeader function which is part of OutgoingMessage
    
    * Add a test for appendHeader
    
    * Fix function name
    
    ---------
    
    Co-authored-by: Eugene Fidelin <eugene.fidelin@gmail.com>
    bjarkebm and eugef authored Sep 9, 2024
    Copy the full SHA
    3a87b42 View commit details
  3. Release 1.16.0

    eugef committed Sep 9, 2024
    Copy the full SHA
    40e0e75 View commit details

Commits on Oct 4, 2024

  1. Moving types to peerDependencies and allowing express 5 (#309)

    * Moving types to peerDependencies, allowing express 5.
    
    * Testing on Node 22 as well.
    
    * Readme: adjusting installation instructions.
    
    * Ref: making those peers optional, only needed for those using TypeScript.
    RobinTail authored Oct 4, 2024
    Copy the full SHA
    fa4ae25 View commit details
  2. npm audit fix

    eugef committed Oct 4, 2024
    Copy the full SHA
    2529e00 View commit details
  3. Release 1.16.1

    eugef committed Oct 4, 2024
    Copy the full SHA
    7297984 View commit details

Commits on Dec 9, 2024

  1. Copy the full SHA
    8618dd8 View commit details

Commits on Dec 10, 2024

  1. npm audit fix

    eugef committed Dec 10, 2024
    Copy the full SHA
    9bd17ca View commit details
  2. Release 1.16.2

    eugef committed Dec 10, 2024
    Copy the full SHA
    306a8cf View commit details
Showing with 11,544 additions and 14,691 deletions.
  1. +50 −83 .eslintrc
  2. +35 −0 .github/workflows/node.js.yml
  3. +2 −0 .gitignore
  4. +1 −0 .husky/.gitignore
  5. +5 −0 .husky/pre-commit
  6. +9 −0 .mocharc.js
  7. +1 −0 .npmrc
  8. +4 −0 .prettierignore
  9. +14 −0 .prettierrc
  10. +0 −26 .travis.yml
  11. +1 −1 CODE_OF_CONDUCT.md
  12. +78 −78 CODING_RULES.md
  13. +75 −67 CONTRIBUTING.md
  14. +263 −255 HISTORY.md
  15. +144 −88 README.md
  16. +9 −15 examples/express-route.js
  17. +8 −13 examples/express-status-vs-json.js
  18. +0 −49 gulpfile.js
  19. +29 −27 lib/express/mock-application.js
  20. +13 −15 lib/express/mock-express.js
  21. +55 −51 lib/express/mock-request.js
  22. +0 −2 lib/express/utils/define-getter.js
  23. +171 −0 lib/http-mock.d.ts
  24. +7 −9 lib/http-mock.js
  25. +0 −168 lib/index.d.ts
  26. +9 −11 lib/mockEventEmitter.js
  27. +198 −90 lib/mockRequest.js
  28. +138 −141 lib/mockResponse.js
  29. +4 −6 lib/mockWritableStream.js
  30. +29 −26 lib/node/_http_incoming.js
  31. +1 −3 lib/node/_http_server.js
  32. +2 −3 lib/node/http.js
  33. +6 −6 lib/utils.js
  34. +7,237 −10,766 package-lock.json
  35. +51 −20 package.json
  36. +0 −10 test/.eslintrc
  37. +0 −21 test/lib/http-mock.spec.js
  38. +31 −0 test/lib/http-mock.test-d.ts
  39. +46 −49 test/lib/mockEventEmitter.spec.js
  40. +17 −19 test/lib/mockExpressResponse.spec.js
  41. +0 −996 test/lib/mockRequest.spec.js
  42. +1,157 −0 test/lib/mockRequest.spec.ts
  43. +1,492 −1,544 test/lib/mockResponse.spec.js
  44. +28 −30 test/lib/mockWritableStream.spec.js
  45. +14 −0 test/lib/node-http-mock.spec.js
  46. +0 −3 test/mocha.opts
  47. +110 −0 tsconfig.json
133 changes: 50 additions & 83 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,83 +1,50 @@
env:
node: true

rules:
comma-dangle: 2
no-alert: 2
no-array-constructor: 2
no-caller: 2
no-catch-shadow: 2
no-control-regex: 2
no-debugger: 2
no-div-regex: 2
no-dupe-keys: 2
no-else-return: 2
no-empty: 2
no-empty-character-class: 2
no-eq-null: 2
no-eval: 2
no-ex-assign: 2
no-func-assign: 0
no-floating-decimal: 2
no-implied-eval: 2
no-with: 2
no-fallthrough: 2
no-unreachable: 2
no-undef: 2
no-undef-init: 2
no-unused-expressions: 2
no-octal: 2
no-octal-escape: 2
no-obj-calls: 2
no-multi-str: 2
no-new-wrappers: 2
no-new: 2
no-new-func: 2
no-native-reassign: 2
no-delete-var: 2
no-return-assign: 2
no-new-object: 2
no-label-var: 2
no-self-compare: 2
no-sync: 2
no-loop-func: 2
no-labels: 2
no-unused-vars: 1
no-script-url: 2
no-proto: 2
no-iterator: 2
no-mixed-requires:
- 0
- false
no-extra-parens: 2
no-shadow: 2
no-use-before-define: 2
no-redeclare: 2
no-regex-spaces: 2
no-mixed-spaces-and-tabs: 2
no-underscore-dangle: 0

brace-style: 2
camelcase: 2
consistent-this:
- 2
- self
curly: 2
dot-notation: 2
eqeqeq: 2
new-cap: 2
new-parens: 2
quotes:
- 2
- single
semi: 2
strict:
- 2
- global
use-isnan: 2
valid-typeof: 2
wrap-iife: 2
indent:
- 1
- 4
- SwitchCase: 1
{
"extends": [
"airbnb-base",
"prettier"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-underscore-dangle": "off",
"no-console": "off",
"no-plusplus": "off",
"func-names": [
"warn",
"as-needed"
],
"prefer-destructuring": [
"error",
{
"object": true,
"array": false
}
],
"no-prototype-builtins": "warn",
"no-restricted-syntax": [
"error",
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
]
},
"overrides": [
{
"files": [
"test/**/*.js",
"test/**/*.ts"
],
"rules": {
"no-unused-expressions": "off"
},
"env": {
"mocha": true
}
}
],
"root": true
}
35 changes: 35 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run check
- run: npm run coverage
# - name: Code Coverage Report
# uses: romeovs/lcov-reporter-action@v0.3.1
# if: ${{ matrix.node-version == '20.x' }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,3 +6,5 @@ test/results
npm-debug.log
TAGS
/.idea/
.nyc_output
.DS_Store
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run check

9 changes: 9 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

module.exports = {
recursive: true,
reporter: 'spec',
extension: ['js', 'ts'],
require: 'ts-node/register',
ui: 'bdd'
};
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.github/
/.vscode/
/.idea/
.eslintrc
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"trailingComma": "none",
"singleQuote": true,
"tabWidth": 4,
"overrides": [
{
"files": ["package.json", "package-lock.json"],
"options": {
"tabWidth": 2
}
}
]
}
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -10,4 +10,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
Loading