nock 11.3.6 → 11.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +9 -0
  2. package/index.js +2 -0
  3. package/lib/common.js +33 -9
  4. package/lib/delayed_body.js +1 -1
  5. package/lib/intercept.js +41 -40
  6. package/lib/intercepted_request_router.js +10 -14
  7. package/lib/interceptor.js +10 -4
  8. package/lib/match_body.js +2 -5
  9. package/lib/playback_interceptor.js +9 -10
  10. package/lib/recorder.js +27 -30
  11. package/lib/scope.js +3 -2
  12. package/lib/socket.js +16 -0
  13. package/package.json +14 -6
  14. package/types/index.d.ts +2 -0
  15. package/.all-contributorsrc +0 -123
  16. package/.eslintignore +0 -3
  17. package/.eslintrc.yml +0 -34
  18. package/.github/FUNDING.yml +0 -1
  19. package/.github/ISSUE_TEMPLATE/01_bug_report.md +0 -26
  20. package/.github/ISSUE_TEMPLATE/02_feature_request.md +0 -20
  21. package/.github/ISSUE_TEMPLATE/03_support.md +0 -10
  22. package/.github/ISSUE_TEMPLATE/04_thanks.md +0 -20
  23. package/.github/lock.yml +0 -19
  24. package/.github/stale.yml +0 -25
  25. package/.github/toc.yml +0 -1
  26. package/.istanbul.yml +0 -5
  27. package/.prettierignore +0 -5
  28. package/.prettierrc.yml +0 -4
  29. package/.travis.yml +0 -47
  30. package/CODE_OF_CONDUCT.md +0 -46
  31. package/CONTRIBUTING.md +0 -164
  32. package/assets/reply_file_1.txt +0 -1
  33. package/assets/reply_file_2.txt.gz +0 -0
  34. package/examples/.eslintrc.yml +0 -3
  35. package/examples/_log.js +0 -12
  36. package/examples/delay-connection.js +0 -15
  37. package/examples/delay-response.js +0 -15
  38. package/examples/net-connect-default-no-mock.js +0 -18
  39. package/examples/net-connect-default-other-mock.js +0 -23
  40. package/examples/net-connect-disabled-different-host.js +0 -26
  41. package/examples/net-connect-mock-same-host-different-path.js +0 -24
  42. package/examples/socket-delay-abort.js +0 -19
  43. package/examples/socket-delay-no-abort.js +0 -15
  44. package/rfcs/rfc-001.md +0 -43
  45. package/types/tests.ts +0 -810
  46. package/types/tsconfig.json +0 -11
  47. package/types/tslint.json +0 -6
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "11.3.6",
10
+ "version": "11.7.0",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -31,28 +31,30 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "assert-rejects": "^1.0.0",
34
+ "dirty-chai": "^2.0.1",
34
35
  "dtslint": "^0.9.1",
35
36
  "eslint": "^6.0.0",
36
37
  "eslint-config-prettier": "^6.0.0",
37
38
  "eslint-config-standard": "^14.0.0",
38
39
  "eslint-plugin-import": "^2.16.0",
40
+ "eslint-plugin-mocha": "^6.2.0",
39
41
  "eslint-plugin-node": "^10.0.0",
40
42
  "eslint-plugin-promise": "^4.1.1",
41
43
  "eslint-plugin-standard": "^4.0.0",
42
44
  "got": "^9.6.0",
43
- "hyperquest": "^2.1.3",
44
45
  "isomorphic-fetch": "^2.2.0",
45
- "lolex": "^4.0.1",
46
+ "lolex": "^5.0.0",
47
+ "mocha": "^6.2.2",
46
48
  "needle": "^2.3.0",
47
49
  "npm-run-all": "^4.1.5",
48
50
  "nyc": "^14.0.0",
49
51
  "prettier": "1.18.2",
50
52
  "proxyquire": "^2.1.0",
51
53
  "request": "^2.83.0",
52
- "restify-clients": "^2.2.0",
53
54
  "rimraf": "^3.0.0",
54
55
  "semantic-release": "^16.0.0-beta.22",
55
- "sinon": "^7.3.1",
56
+ "sinon": "^7.5.0",
57
+ "sinon-chai": "^3.3.0",
56
58
  "superagent": "^5.0.2",
57
59
  "tap": "^14.0.0"
58
60
  },
@@ -62,6 +64,7 @@
62
64
  "test": "npm run -s unit",
63
65
  "posttest": "npm run -s prettier:check",
64
66
  "coverage": "tap --coverage-report=html && open coverage/lcov-report/index.html",
67
+ "mocha": "nyc mocha $(grep -lr '^\\s*it(' tests)",
65
68
  "lint": "eslint \"**/*.js\"",
66
69
  "prettier": "prettier --write \"**/*.@(js|json|md|ts|yml)\"",
67
70
  "prettier:check": "prettier --check \"**/*.@(js|json|md|ts|yml)\"",
@@ -77,5 +80,10 @@
77
80
  "tests/"
78
81
  ]
79
82
  },
80
- "license": "MIT"
83
+ "license": "MIT",
84
+ "files": [
85
+ "index.js",
86
+ "lib",
87
+ "types/index.d.ts"
88
+ ]
81
89
  }
package/types/index.d.ts CHANGED
@@ -26,6 +26,7 @@ declare namespace nock {
26
26
  function loadDefs(path: string): Definition[]
27
27
  function define(defs: Definition[]): Scope[]
28
28
  function restore(): void
29
+ function abortPendingRequests(): void
29
30
 
30
31
  let back: Back
31
32
  let emitter: NodeJS.EventEmitter
@@ -243,6 +244,7 @@ declare namespace nock {
243
244
  type BackMode = 'wild' | 'dryrun' | 'record' | 'lockdown'
244
245
 
245
246
  interface Back {
247
+ currentMode: BackMode
246
248
  fixtures: string
247
249
  setMode(mode: BackMode): void
248
250
 
@@ -1,123 +0,0 @@
1
- {
2
- "projectName": "nock",
3
- "projectOwner": "nock",
4
- "repoType": "github",
5
- "repoHost": "https://github.com",
6
- "files": [
7
- "README.md"
8
- ],
9
- "imageSize": 100,
10
- "commit": false,
11
- "contributors": [
12
- {
13
- "login": "pgte",
14
- "name": "Pedro Teixeira",
15
- "avatar_url": "https://avatars1.githubusercontent.com/u/47910?v=4",
16
- "profile": "http://pgte.me",
17
- "contributions": [
18
- "code",
19
- "maintenance"
20
- ]
21
- },
22
- {
23
- "login": "n30n0v",
24
- "name": "n30n0v",
25
- "avatar_url": "https://avatars3.githubusercontent.com/u/10771967?v=4",
26
- "profile": "https://github.com/n30n0v",
27
- "contributions": [
28
- "code"
29
- ]
30
- },
31
- {
32
- "login": "RichardLitt",
33
- "name": "Richard Littauer",
34
- "avatar_url": "https://avatars3.githubusercontent.com/u/910753?v=4",
35
- "profile": "https://burntfen.com",
36
- "contributions": [
37
- "maintenance",
38
- "code",
39
- "blog"
40
- ]
41
- },
42
- {
43
- "login": "ianwsperber",
44
- "name": "Ian Walker-Sperber",
45
- "avatar_url": "https://avatars1.githubusercontent.com/u/3731165?v=4",
46
- "profile": "http://ianwsperber.com",
47
- "contributions": [
48
- "code"
49
- ]
50
- },
51
- {
52
- "login": "ierceg",
53
- "name": "Ivan Erceg",
54
- "avatar_url": "https://avatars2.githubusercontent.com/u/1505203?v=4",
55
- "profile": "http://ilovacha.com",
56
- "contributions": [
57
- "code",
58
- "maintenance"
59
- ]
60
- },
61
- {
62
- "login": "paulmelnikow",
63
- "name": "Paul Melnikow",
64
- "avatar_url": "https://avatars2.githubusercontent.com/u/1487036?v=4",
65
- "profile": "https://twitter.com/paulmelnikow",
66
- "contributions": [
67
- "code",
68
- "maintenance"
69
- ]
70
- },
71
- {
72
- "login": "gr2m",
73
- "name": "Gregor Martynus",
74
- "avatar_url": "https://avatars3.githubusercontent.com/u/39992?v=4",
75
- "profile": "https://twitter.com/gr2m",
76
- "contributions": [
77
- "code",
78
- "maintenance",
79
- "business",
80
- "financial",
81
- "blog"
82
- ]
83
- },
84
- {
85
- "login": "hutson",
86
- "name": "Hutson Betts",
87
- "avatar_url": "https://avatars1.githubusercontent.com/u/6701030?v=4",
88
- "profile": "https://gitlab.com/hutson",
89
- "contributions": [
90
- "financial"
91
- ]
92
- },
93
- {
94
- "login": "jlilja",
95
- "name": "Jonas Lilja",
96
- "avatar_url": "https://avatars2.githubusercontent.com/u/6105119?v=4",
97
- "profile": "http://lilja.io",
98
- "contributions": [
99
- "financial",
100
- "code"
101
- ]
102
- },
103
- {
104
- "login": "benrki",
105
- "name": "Benjamin Ki",
106
- "avatar_url": "https://avatars0.githubusercontent.com/u/4446950?v=4",
107
- "profile": "https://github.com/benrki",
108
- "contributions": [
109
- "financial"
110
- ]
111
- },
112
- {
113
- "login": "chadfawcett",
114
- "name": "Chad Fawcett",
115
- "avatar_url": "https://avatars2.githubusercontent.com/u/3250463?v=4",
116
- "profile": "http://chadf.ca",
117
- "contributions": [
118
- "financial"
119
- ]
120
- }
121
- ],
122
- "contributorsPerLine": 7
123
- }
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- /coverage
2
- /tests/browserify-public/browserify-bundle.js
3
- node_modules
package/.eslintrc.yml DELETED
@@ -1,34 +0,0 @@
1
- env:
2
- node: true
3
-
4
- parserOptions:
5
- ecmaVersion: 9
6
- # Override eslint-config-standard, which incorrectly sets this to "module",
7
- # though that setting is only for ES6 modules, not CommonJS modules.
8
- sourceType: 'script'
9
-
10
- extends:
11
- - 'eslint:recommended'
12
- - standard
13
- - prettier
14
-
15
- rules:
16
- # TODO These are included in standard and should be cleaned up and turned on.
17
- node/no-deprecated-api: 'off' # we still make heavy use of url.parse
18
-
19
- # Nock additions.
20
- strict: ['error', 'safe']
21
- no-loop-func: 'error'
22
- no-var: 'error'
23
- prefer-const: 'error'
24
- object-shorthand: ['error', 'properties']
25
- prefer-template: 'error'
26
- arrow-body-style: ['error', 'as-needed']
27
- prefer-destructuring:
28
- [
29
- 'error',
30
- {
31
- 'VariableDeclarator': { 'array': false, 'object': true },
32
- 'AssignmentExpression': { 'array': false, 'object': false },
33
- },
34
- ]
@@ -1 +0,0 @@
1
- open_collective: nock
@@ -1,26 +0,0 @@
1
- ---
2
- name: 🐛 Bug report
3
- about: If something isn't working 🤕
4
- ---
5
-
6
- **What is the expected behavior?**
7
-
8
- **What is the actual behavior?**
9
-
10
- **Possible solution**
11
-
12
- **How to reproduce the issue**
13
-
14
- Runkit: _[Example link](https://runkit.com/gr2m/node-nock-nock-768)_
15
-
16
- _Having problem producing a test case? Try and ask the community for help. If the test case cannot be reproduced, the Nock community might not be able to help you._
17
-
18
- **Does the bug have a test case?**
19
-
20
- **Versions**
21
-
22
- | Software | Version(s) |
23
- | ---------- | ---------- |
24
- | Nock | |
25
- | Node | |
26
- | TypeScript | |
@@ -1,20 +0,0 @@
1
- ---
2
- name: 🚀 Feature request
3
- about: Let us know if you have a feature request 💡
4
- ---
5
-
6
- **Context**
7
-
8
- What are you trying to do and how would you want to do it differently? Is it something you currently you cannot do? Is this related to an issue/problem?
9
-
10
- **Alternatives**
11
-
12
- Can you achieve the same result doing it in an alternative way? Is the alternative considerable?
13
-
14
- **Has the feature been requested before?**
15
-
16
- Please provide a link to the issue.
17
-
18
- **If the feature request is accepted, would you be willing to submit a PR?**
19
-
20
- Yes / No _(Help can be provided if you need assistance submitting a PR)_
@@ -1,10 +0,0 @@
1
- ---
2
- name: ❓ Support
3
- about: If you need support, check out Nock on StackOverflow
4
- ---
5
-
6
- <!-- 👆 Click "Preview" for a nicer view! -->
7
-
8
- We primarily use GitHub as an issue tracker; for usage and support questions we primairly use StackOverflow. Please tag the questions with `nock` so the community can easily find it. [Go to StackOverflow](https://stackoverflow.com/questions/tagged/nock).
9
-
10
- If you want to submit a feature request you can do that [here](https://github.com/nock/nock/issues/new?template=feature_request.md) or bug reports [here](https://github.com/nock/nock/issues/new?template=bug_report.md).
@@ -1,20 +0,0 @@
1
- ---
2
- name: ❤️ Say thank you
3
- about: Tell us how you use nock & support our efforts in maintaining Nock
4
- ---
5
-
6
- # ❤️ I'm using Nock
7
-
8
- If you (or your company) are using Nock - please let us know. We'd love to hear from you!
9
-
10
- Nock is a community driven project, which means it's not maintained by a company. If you would like to help Nock - any of the following is greatly appreciated.
11
-
12
- - [ ] Give the repository a star ⭐️
13
- - [ ] Help out with issues
14
- - [ ] Review pull requests
15
- - [ ] Blog about Nock
16
- - [ ] Make tutorials
17
- - [ ] Give talks
18
- - [ ] Support us on [https://opencollective.com/nock](https://opencollective.com/nock)
19
-
20
- Thank you! 💐
package/.github/lock.yml DELETED
@@ -1,19 +0,0 @@
1
- # Configuration for lock-threads - https://github.com/dessant/lock-threads
2
-
3
- # Number of days of inactivity before a closed issue or pull request is locked
4
- daysUntilLock: 14
5
-
6
- # Issues and pull requests with these labels will not be locked. Set to `[]` to disable
7
- exemptLabels: []
8
-
9
- # Label to add before locking, such as `outdated`. Set to `false` to disable
10
- lockLabel: false
11
-
12
- # Comment to post before locking. Set to `false` to disable
13
- lockComment: >
14
- This thread has been automatically locked since there has not been
15
- any recent activity after it was closed. Please open a new issue and
16
- add a reference to this one if it’s related. Thank you!
17
-
18
- # Assign `resolved` as the reason for locking. Set to `false` to disable
19
- setLockReason: true
package/.github/stale.yml DELETED
@@ -1,25 +0,0 @@
1
- # Configuration for probot-stale - https://github.com/probot/stale
2
-
3
- # Number of days of inactivity before an Issue or Pull Request becomes stale
4
- daysUntilStale: 90
5
-
6
- # Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7
- # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8
- daysUntilClose: 7
9
-
10
- # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
11
- exemptLabels:
12
- - pinned
13
-
14
- # Label to use when marking as stale
15
- staleLabel: stale
16
-
17
- # Comment to post when marking as stale. Set to `false` to disable
18
- markComment: >
19
- This issue has been automatically marked as stale because it has not had
20
- recent activity. It will be closed if no further activity occurs. We try to
21
- do our best, but nock is maintained by volunteers and there is only so much
22
- we can do at a time. Thank you for your contributions.
23
-
24
- # Limit the number of actions per hour, from 1-30. Default is 30
25
- limitPerRun: 30
package/.github/toc.yml DELETED
@@ -1 +0,0 @@
1
- bullets: '-'
package/.istanbul.yml DELETED
@@ -1,5 +0,0 @@
1
- instrumentation:
2
- excludes: ['tests/**/*.js', 'examples/**/*.js', 'lib/recorder.js']
3
- check:
4
- global:
5
- lines: 90
package/.prettierignore DELETED
@@ -1,5 +0,0 @@
1
- package.json
2
- package-lock.json
3
- /.nyc_output
4
- /coverage
5
- /tests/browserify-public/browserify-bundle.js
package/.prettierrc.yml DELETED
@@ -1,4 +0,0 @@
1
- semi: false
2
- singleQuote: true
3
- trailingComma: es5
4
- bracketSpacing: true
package/.travis.yml DELETED
@@ -1,47 +0,0 @@
1
- language: node_js
2
- cache: npm
3
-
4
- # Trigger a push build on master and greenkeeper branches + PRs build on every branches
5
- # Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
6
- branches:
7
- only:
8
- - master
9
- - /^greenkeeper.*$/
10
- - beta # semantic-release preview releases
11
- - next # semantic-release @next releases
12
- - /^\d+\.x$/ # semantic-release maintenance releases
13
-
14
- stages:
15
- - lint
16
- - test
17
- - name: release
18
- if: branch =~ /^(\d+\.x|master|next|beta)$/ AND type IN (push)
19
- - name: update-prettier
20
- if: branch =~ ^greenkeeper/prettier
21
-
22
- jobs:
23
- include:
24
- - stage: update-prettier
25
- node_js: lts/*
26
- script:
27
- - git checkout $TRAVIS_BRANCH
28
- - npm run prettier
29
- # commit changes and push back to branch on GitHub. If there are no changes then exit without error
30
- - 'git commit -a -m "style: prettier" && git push "https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG" ${TRAVIS_BRANCH} || true'
31
- - stage: lint
32
- node_js: lts/*
33
- env: linting
34
- # Show prettier errors, even if lint fails.
35
- script: run-s --silent --continue-on-error lint prettier:check dtslint
36
- - stage: test
37
- node_js: 12
38
- - node_js: 10
39
- # Avoid running lint and prettier again.
40
- script: npm run --silent unit
41
- - node_js: 8
42
- # Avoid running lint and prettier again.
43
- script: npm run --silent unit
44
- - stage: release
45
- node_js: lts/*
46
- env: semantic-release
47
- script: npm run semantic-release
@@ -1,46 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- ## Our Standards
8
-
9
- Examples of behavior that contributes to creating a positive environment include:
10
-
11
- - Using welcoming and inclusive language
12
- - Being respectful of differing viewpoints and experiences
13
- - Gracefully accepting constructive criticism
14
- - Focusing on what is best for the community
15
- - Showing empathy towards other community members
16
-
17
- Examples of unacceptable behavior by participants include:
18
-
19
- - The use of sexualized language or imagery and unwelcome sexual attention or advances
20
- - Trolling, insulting/derogatory comments, and personal or political attacks
21
- - Public or private harassment
22
- - Publishing others' private information, such as a physical or electronic address, without explicit permission
23
- - Other conduct which could reasonably be considered inappropriate in a professional setting
24
-
25
- ## Our Responsibilities
26
-
27
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
-
29
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- ## Scope
32
-
33
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
-
35
- ## Enforcement
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at nock+coc@martynus.net or coc+nock@maintainer.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
-
39
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
-
41
- ## Attribution
42
-
43
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
-
45
- [homepage]: http://contributor-covenant.org
46
- [version]: http://contributor-covenant.org/version/1/4/
package/CONTRIBUTING.md DELETED
@@ -1,164 +0,0 @@
1
- # Contribute
2
-
3
- 👋 Thanks for thinking about contributing to nock! We, the maintainers, are glad you're here and will be excited to help you get started if you have any questions. For now, here are some basic instructions for how we manage this project.
4
-
5
- Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
6
-
7
- **Table of Contents**
8
-
9
- <!-- toc -->
10
-
11
- - [Branching](#branching)
12
- - [Backport a fix / feature to a previous version](#backport-a-fix--feature-to-a-previous-version)
13
- - [Submit a Beta / Next release](#submit-a-beta--next-release)
14
- - [Formatting & linting](#formatting--linting)
15
- - [Commit Message conventions](#commit-message-conventions)
16
- - [Generate README TOC](#generate-readme-toc)
17
- - [Running tests](#running-tests)
18
- - [Running only a single test](#running-only-a-single-test)
19
- - [Release Process](#release-process)
20
- - [GitHub Apps](#github-apps)
21
- - [Becoming a maintainer](#becoming-a-maintainer)
22
- - [Who is funding work on Nock?](#who-is-funding-work-on-nock)
23
- - [Priority Support](#priority-support)
24
- - [Is there a chat where I can talk to other maintainers and users?](#is-there-a-chat-where-i-can-talk-to-other-maintainers-and-users)
25
-
26
- <!-- tocstop -->
27
-
28
- ## Branching
29
-
30
- **TLDR: Most pull requests should be opened against the `beta` branch.**
31
-
32
- We use [semantic-release](https://github.com/semantic-release/semantic-release) to automate the release of new versions based on semantic commit messages as described above. Depending on the branch that a new pull request is merged into, it is published to different versions using different [npm dist-tags](https://docs.npmjs.com/cli/dist-tag).
33
-
34
- - `master`: Publish with `@latest`, or if the commits have been merged into `next` branch before, update the `@latest` dist-tag to point at the new version
35
- - `next`: Publish with `@next`
36
- - `beta`: Publish to `X.0.0-beta.Y`, where `X` is the next breaking version and `Y` is number that gets increased with each release.
37
- - `[Version].x`: For example `10.x`, where `10` is the major release number. No breaking changes are allowed on this branch. Publishes fix/feature versions to `[Version]` using a `@release-@[version].x` release tag
38
-
39
- ### Backport a fix / feature to a previous version
40
-
41
- If you want to **backport a fix** to version 10, and the last version released on version 10 is `10.0.4`, then you have to follow these steps
42
-
43
- 1. Create the `[Version].x` branch unless it already exists. If you don’t have write access, ask one of the maintainers to do it for you. In this example, the command is `git checkout -b 10.x v10.0.4`.
44
- 2. Push the branch to GitHub: `git push -u origin $(git symbolic-ref --short HEAD)`
45
- 3. Create a new branch based on `10.x`
46
- 4. Make your changes
47
- 5. Submit the pull request against the `10.x` branch
48
-
49
- ### Submit a Beta / Next release
50
-
51
- Create a new branch based off `beta` or `next`, depending on what you want. Make your changes and submit them to the same branches. If either `beta` or `next` is outdated, ask a maintainer to re-create them from `master`
52
-
53
- ## Formatting & linting
54
-
55
- This project formats its source code using Prettier. The most enjoyable way to
56
- use Prettier is to let it format code for you when you save. You can [integrate
57
- it into your editor][integrate prettier].
58
-
59
- [integrate prettier]: https://prettier.io/docs/en/editors.html
60
-
61
- If you don't want to integrate with your editor, you can run `npm run prettier`
62
- instead.
63
-
64
- Semantic issues are checked with ESLint via `npm run lint`.
65
-
66
- ## Commit Message conventions
67
-
68
- `nock` releases are automated using [semantic-release](https://github.com/semantic-release/semantic-release).
69
- To automatically calculate the correct version number as well as changelogs,
70
- three commit message conventions need to be followed
71
-
72
- - Commit bug fixes with `fix: ...` or `fix(scope): ...` prefix in commit subject
73
- - Commit new features with `feat: ...` or `feat(scope): ...` prefix in commit subject
74
- - Commit breaking changes by adding `BREAKING CHANGE:` in the commit body
75
- (not the subject line)
76
-
77
- Other helpful conventions are
78
-
79
- - Commit test files with `test: ...` or `test(scope): ...` prefix
80
- - Commit changes to `package.json`, `.gitignore` and other meta files with
81
- `chore(filename-without-ext): ...`
82
- - Commit changes to README files or comments with `docs: ...`
83
- - Code style changes with `style: standard`
84
-
85
- Don't stress this; if necessary the maintainers can fix commit message(s) of a pull request using the `squash & merge` button.
86
-
87
- ## Generate README TOC
88
-
89
- Make sure to update the README's table of contents whenever you update the README using the following npm script.
90
-
91
- ```
92
- $ npm run toc
93
- ```
94
-
95
- ## Running tests
96
-
97
- All of the tests work offline. None of them should hit the network.
98
-
99
- ```
100
- $ npm test
101
- ```
102
-
103
- ### Running only a single test
104
-
105
- When you're writing a test for a specific purpose, it may be useful to only run that test. In order to do this, you can pass a `only` option as the second argument to the [`tap`](https://www.node-tap.org/) testrunner. For instance in `tests/example.js`, like so:
106
-
107
- ```js
108
- test('description', { only: true }, t => {
109
- // ...
110
- })
111
- ```
112
-
113
- And then:
114
-
115
- ```sh
116
- $ tap --only tests/example_file.js
117
- ```
118
-
119
- ## Release Process
120
-
121
- All of our releases are automated using [semantic-release](https://github.com/semantic-release/semantic-release). The commit messages pushed to the master branch trigger new releases. Semantic-release requires that commits follow certain conventions, [described above](#commit-message-conventions). semantic-release creates a GitHub release, adds release notes and publishes the new version to npm. This is why we do not store release notes in the [`CHANGELOG`](CHANGELOG.md) file - they're already on GitHub.
122
-
123
- We use @nockbot as a separate account for releases, because npm tokens cannot be scoped to a single package. This improves our security model in case of a data breach involving npm tokens. @nockbot's credentials were set up by @gr2m; contact him if for any reason you need to change this in the future.
124
-
125
- ## GitHub Apps
126
-
127
- We use several GitHub apps to help maintain this repository. While we would like to address every issue and while we would like to be on hand to support every person, Nock is pretty much entirely volunteer run, and we simply don't have the time to do everything. Please don't be offended if an automated app posts in your issue! We're doing what we can with with we have.
128
-
129
- Currently, we use the [Stale](https://github.com/apps/stale) and [Lock](https://github.com/apps/lock) apps to mark old issues as stale, and to lock issues which have been closed to stop drive-by comments. You can see the configuration files for these in [.github/](.github).
130
-
131
- ## Becoming a maintainer
132
-
133
- So you want to do more than file a bug or submit a PR? Awesome!
134
-
135
- Nock is actively interested in having more maintainers. That means that we would love to have you (yes, you) get more involved if you want to! We don't have strict tests that you need to pass to become a maintainer. Instead, all we want is to find people who are frequent contributors, understand what Nock does, and are eager to help make this tool better.
136
-
137
- Here are some things you can do today to actively show the Nock team that you're interested in helping out in the long term:
138
-
139
- - **Triage issues!** We have more issues than we have bandwidth to deal with. For some of these issues, there are no labels, no comments suggesting how the issue could be resolved, and no follow-up after months or years of silence. It would be great if the issues actively reflected the state of the project. Go through old issues and suggesting labels in comments, ask for more information, and generally help out with the resolution process. This would be a great help!
140
- - **Review PRs.** We have a lot of open PRs! Some of these are probably ready to merge, and some of them probably need more work. Any extra eyes on PRs are encouraged. Comment on code patterns you think need work, suggest extra tests, and let us know if a PR 'LGTM' ("looks good to me"). The more reviewers we have, the faster we can merge issues, the better this project becomes.
141
- - **Help out!** If someone files a bug and no one has responded yet, see if you can resolve it! Suggest PRs, or file them yourself. While most contributors are going to only be interested in their own bugs, great maintainers help out with other people's bugs. This is one of the best ways to become an expert at Nock (and Node.js, JavaScript, or pretty much any project) - helping others.
142
- - **Write docs.** Are our docs missing something important? Are they not clear? Could they be better? Open a PR!
143
- - **Suggest examples.** Right now, we have a few examples, but we could always have more. Submit small example files and tutorials. At some point, we'll have to work on a better way to display these - for now, it's great to show others how to solve difficult mocking problems easily with Nock.
144
- - **Refactor.** This is one of the hardest things to do, but one of the most useful. Go through the code, and find examples where it could be written better - with better variable names, more useful abstractions, and more elegant patterns. Taking away ten lines of code that are unnecessary is more valuable than submitting a hundred new lines, sometimes. Open a PR or a comment and defend your position; ask for feedback.
145
-
146
- Once you've been around for a bit, ask a current Maintainer - one of [the team members](https://github.com/orgs/nock/people) - whether you can be elevated to Maintainer status and given permissions to close issues and merge PRs. We're interested in how well you know what Nock is about, and how involved you are in the community - not where you're from, how good your English is, or whether or not you can pass a whiteboard test blindfolded. If you think that you've been helpful, let us know. We're friendly, promise. :)
147
-
148
- ## Who is funding work on Nock?
149
-
150
- Nock is entirely self-funded by [our Open Collective](https://opencollective.com/nock). Open Collective allows us to get contributions from users and companies, without giving away our open source IP. Think of it like a kickstarter, or an old-fashioned system of art patrons.
151
-
152
- If you'd like to give money to support Nock, please do go to our profile and check it out.
153
-
154
- ## Priority Support
155
-
156
- As part of backing on Open Collective, we tag some issues as a priority if the user who opens them is also a backer, using the [Open Collective Bot](https://github.com/marketplace/open-collective-bot). In general, as maintainers we will give priority to support people who are working on these issues. The money in the Open Collective goes to the entire project, however, and maintainers are volunteers.
157
-
158
- ## Is there a chat where I can talk to other maintainers and users?
159
-
160
- We don't have a chat for a variety of reasons - mainly, because our maintainers' time is limited, and we don't want to be on the hook for enforcing codes of conduct or for checking in every day. However, we encourage you to open issues about anything related to Nock! Issues really are the best way to keep the conversation focused on development.
161
-
162
- We often have video calls to pair program or to hack together on Nock. Join us! Look at the issues for a notification about these, and, if there isn't one planned, open an issue and suggest one.
163
-
164
- On that note, thanks for reading this far. Go mock some tests now, there's nothing left to read here. :)
@@ -1 +0,0 @@
1
- Hello from the file!
Binary file