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: BedrockStreaming/superagent-mock
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.5.0
Choose a base ref
...
head repository: BedrockStreaming/superagent-mock
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Sep 14, 2017

  1. Adapt to change in superagent lib (#68)

    bmancini42 authored and Florent Dubost committed Sep 14, 2017
    Copy the full SHA
    85c9feb View commit details
  2. v3.6.0

    Florent Dubost authored Sep 14, 2017
    Copy the full SHA
    6e246bb View commit details

Commits on Oct 18, 2017

  1. Update package.json

    DevSide authored Oct 18, 2017
    Copy the full SHA
    37cefde View commit details

Commits on Feb 12, 2018

  1. Copy the full SHA
    fd535b0 View commit details

Commits on Feb 13, 2018

  1. Copy the full SHA
    68df77e View commit details
  2. Copy the full SHA
    acd33f5 View commit details
  3. cleanup es config (#76)

    DevSide authored Feb 13, 2018
    Copy the full SHA
    07d864d View commit details

Commits on Apr 4, 2018

  1. Copy the full SHA
    70d1549 View commit details

Commits on Dec 4, 2019

  1. Copy the full SHA
    f1781fd View commit details
  2. chore(travis): support superagent 4 (#82)

    * chore(travis): support superagent 4 and 5
    
    * 5 is not compatible
    Slashgear authored Dec 4, 2019
    Copy the full SHA
    2b15199 View commit details
  3. Copy the full SHA
    b7f4f05 View commit details

Commits on Oct 8, 2020

  1. Bump lodash from 4.17.15 to 4.17.19 (#96)

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.15...4.17.19)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 8, 2020
    Copy the full SHA
    299f394 View commit details
  2. Bump yargs-parser from 13.1.1 to 13.1.2 (#97)

    Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 13.1.1 to 13.1.2.
    - [Release notes](https://github.com/yargs/yargs-parser/releases)
    - [Changelog](https://github.com/yargs/yargs-parser/blob/master/docs/CHANGELOG-full.md)
    - [Commits](https://github.com/yargs/yargs-parser/commits)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 8, 2020
    Copy the full SHA
    38ba77f View commit details
  3. Bump acorn from 5.7.3 to 5.7.4 (#94)

    Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@5.7.3...5.7.4)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 8, 2020
    Copy the full SHA
    91d6a37 View commit details
  4. superagent peerDep >=3.6.0 (#92)

    This will prevent warnings in the console for versions of superagent >=4.0.0
    bernard-leech authored Oct 8, 2020
    Copy the full SHA
    a9b08bc View commit details

Commits on Mar 3, 2021

  1. Bump ini from 1.3.4 to 1.3.7 (#98)

    Bumps [ini](https://github.com/isaacs/ini) from 1.3.4 to 1.3.7.
    - [Release notes](https://github.com/isaacs/ini/releases)
    - [Commits](npm/ini@v1.3.4...v1.3.7)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 3, 2021
    Copy the full SHA
    1934675 View commit details
  2. Copy the full SHA
    dd67bb6 View commit details

Commits on Mar 15, 2021

  1. docs(readme): update readme page (#101)

    * docs(readme): update readme page
    
    * Update README.md
    Slashgear authored Mar 15, 2021
    Copy the full SHA
    d553e1b View commit details

Commits on Mar 16, 2021

  1. chore(devDeps): upgrade dependencies (#102)

    * chore(devDeps): upgrade dependencies
    
    * fix ci trigger
    
    * drop support of Node 8 caused by dependencies upgrade
    Slashgear authored Mar 16, 2021
    Copy the full SHA
    63643d5 View commit details
  2. v4.0.0

    Slashgear committed Mar 16, 2021
    Copy the full SHA
    121263f View commit details
  3. Copy the full SHA
    1435251 View commit details

Commits on Jul 31, 2023

  1. refactor of prettier

    Tetsu9901 committed Jul 31, 2023
    Copy the full SHA
    b116f69 View commit details
  2. Merge pull request #115 from BedrockStreaming/prettier-refactor

    chore(linter): refactor of prettier
    Tetsu9901 authored Jul 31, 2023
    Copy the full SHA
    b9a1d5e View commit details
  3. test update superagent

    Tetsu9901 committed Jul 31, 2023
    Copy the full SHA
    286045f View commit details
  4. Copy the full SHA
    cc5d774 View commit details
  5. update node

    Tetsu9901 committed Jul 31, 2023
    Copy the full SHA
    59280e4 View commit details
  6. update yarn-lock

    Tetsu9901 committed Jul 31, 2023
    Copy the full SHA
    4ad91f6 View commit details
  7. fix prettier

    Tetsu9901 committed Jul 31, 2023
    Copy the full SHA
    f4fe7db View commit details

Commits on Aug 1, 2023

  1. Merge pull request #114 from BedrockStreaming/update-superagent

    chore(superagent): Update superagent version
    Tetsu9901 authored Aug 1, 2023
    Copy the full SHA
    19d6415 View commit details
  2. v5.0.0

    Tetsu9901 committed Aug 1, 2023
    Copy the full SHA
    8380aa3 View commit details

Commits on Aug 2, 2023

  1. v5.0.0

    Tetsu9901 authored Aug 2, 2023
    Copy the full SHA
    4607f4c View commit details

Commits on Oct 18, 2023

  1. default Request object, fix unit test (#118)

    Co-authored-by: Ihor Bodnarchuk <ihor.bodnarchuk@ihsmarkit.com>
    ihorbond and Ihor Bodnarchuk authored Oct 18, 2023
    Copy the full SHA
    860eac6 View commit details
  2. v5.0.1

    fdubost committed Oct 18, 2023
    Copy the full SHA
    8e5ac37 View commit details
Showing with 4,645 additions and 2,839 deletions.
  1. +0 −3 .babelrc
  2. +1 −1 .eslintrc
  3. +25 −0 .github/workflows/node.js.yml
  4. +19 −0 .github/workflows/publish.yml
  5. +1 −2 .gitignore
  6. +0 −1 .npmignore
  7. +6 −0 .prettierrc
  8. +0 −7 .travis.yml
  9. +16 −10 README.md
  10. +11 −0 babel.config.js
  11. +19 −16 package.json
  12. +110 −44 src/superagent-mock.js
  13. +1 −1 tests/client.spec.js
  14. +32 −32 tests/support/config.js
  15. +294 −197 tests/support/expectations.js
  16. +4,110 −2,525 yarn.lock
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"no-multi-str": 0
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": "latest",
"sourceType": "module"
}
}
25 changes: 25 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Continous Integration

on:
push:
branches: [master]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
superagent-version: [8.0.9]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- run: yarn install
- run: yarn add superagent@~${{ matrix.superagent-version }} && yarn ci
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish package

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
*.log
lib
es
.idea
.idea
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.*
yarn.lock
tests
!es/
!lib/
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"printWidth": 120,
"trailingComma": "all",
"bracketSpacing": false
}
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
![](https://img.shields.io/badge/License-MIT-00CCFF.svg?style=flat-square)
![](https://img.shields.io/badge/superagent--mock-JS-FF0066.svg?style=flat-square)
[![NPM Downloads](http://img.shields.io/npm/dm/superagent-mock.svg?style=flat-square)](https://www.npmjs.org/package/superagent-mock)
[![Build Status](http://img.shields.io/travis/M6Web/superagent-mock.svg?style=flat-square)](https://travis-ci.org/M6Web/superagent-mock)
![npm](https://img.shields.io/npm/v/superagent-mock)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/superagent-mock)
![npm](https://img.shields.io/npm/dy/superagent-mock)
![GitHub last commit](https://img.shields.io/github/last-commit/M6web/superagent-mock)
![NPM](https://img.shields.io/npm/l/superagent-mock)
[![NPM Downloads](http://img.shields.io/npm/dm/superagent-mock.svg)](https://www.npmjs.org/package/superagent-mock)
[![Continous Integration](https://github.com/M6Web/superagent-mock/actions/workflows/node.js.yml/badge.svg)](https://github.com/M6Web/superagent-mock/actions/workflows/node.js.yml)

<p align="center">
<b><a href="#installation">Installation</a></b>
@@ -10,8 +13,6 @@
|
<b><a href="#supported-methods">Supported Methods</a></b>
|
<b><a href="#tests">Tests</a></b>
|
<b><a href="#credits">Credits</a></b>
|
<b><a href="#license">License</a></b>
@@ -21,14 +22,19 @@

[superagent](https://github.com/visionmedia/superagent) plugin allowing to simulate HTTP calls by returning data fixtures based on the requested URL.

See [this post](http://tech.m6web.fr/how-did-we-mock-the-backend-developers.html) to know why we use superagent-mock at M6Web.
See [this post](https://tech.bedrockstreaming.com//how-did-we-mock-the-backend-developers.html) to know why we use superagent-mock at Bedrock Streaming.

## Installation

Install with [npm](http://npmjs.org/): `npm install superagent-mock`

Install with [yarn](https://yarnpkg.com/): `yarn add superagent-mock`

## Requirements

node >= 8.0
superagent >= ^3.6.0

## Usage

First, you have to define the URLs to mock in a configuration file:
@@ -160,7 +166,7 @@ module.exports = [
*/
post: function (match, data) {
return {
code: 201
       status: 201
};
}
},
@@ -231,8 +237,8 @@ To build code: `yarn build`.

## Credits

Developped by the [Cytron Team](http://cytron.fr/) of [M6 Web](http://tech.m6web.fr/).
Tested with [nodeunit](https://github.com/caolan/nodeunit).
Developped by the Cytron Team of [Bedrock Streaming](https://tech.bedrockstreaming.com/).
Tested with [Jest](https://jestjs.io/).

## License

11 changes: 11 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'entry',
corejs: '3',
},
],
],
};
35 changes: 19 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
{
"name": "superagent-mock",
"description": "superagent plugin allowing to simulate HTTP calls by returning data fixtures based on the requested URL.",
"version": "3.5.0",
"version": "5.0.1",
"keywords": [
"superagent",
"mock",
"isomorphic"
],
"bugs": "https://github.com/M6Web/superagent-mock/issues",
"license": "MIT",
"main": "./lib/superagent-mock.js",
"main": "lib/superagent-mock.js",
"module": "es/superagent-mock.js",
"repository": {
"type": "git",
"url": "https://github.com/M6Web/superagent-mock"
"url": "git+https://github.com/M6Web/superagent-mock.git"
},
"engines": {
"node": ">=16.0.0"
},
"peerDependencies": {
"superagent": "^3.5.2"
"superagent": ">=8.0.9"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-jest": "^20.0.3",
"babel-preset-env": "^1.4.0",
"cross-env": "^5.0.0",
"eslint": "^3.19.0",
"jest": "20.0.3",
"rimraf": "^2.6.1",
"superagent": "^3.5.2"
"@babel/cli": "^7.7.4",
"@babel/preset-env": "^7.13.10",
"core-js": "^3.4.7",
"cross-env": "^7.0.3",
"eslint": "^7.22.0",
"jest": "^26.6.3",
"rimraf": "^3.0.0",
"superagent": "8.0.9"
},
"scripts": {
"ci": "yarn clean && yarn lint && yarn build && yarn test",
"clean": "rimraf lib es",
"test": "jest tests",
"lint": "eslint src tests",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build": "yarn build:commonjs && yarn build:es",
"prepublish": "yarn run clean && yarn lint && yarn build"
"build": "cross-env babel src --out-dir lib",
"prepublishOnly": "yarn ci"
}
}
Loading