Skip to content

Commit

Permalink
feat: repo initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsimundra committed Aug 12, 2021
1 parent 3cd2777 commit bfdb493
Show file tree
Hide file tree
Showing 14 changed files with 5,412 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

// Generated - Do not modify. Controlled by @salesforce/dev-scripts
// See more at https://github.com/forcedotcom/sfdx-dev-packages/tree/master/packages/dev-scripts

module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/ban-types': 'off',
},
};
9 changes: 9 additions & 0 deletions .nycrc copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"nyc": {
"extends": "@salesforce/dev-config/nyc",
"lines": 100,
"statements": 100,
"functions": 100,
"branches": 100
}
}
1 change: 1 addition & 0 deletions .prettierrc copy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@salesforce/prettier-config"
3 changes: 3 additions & 0 deletions .sfdevrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "../dev-scripts/sfdevrc.schema.json"
}
158 changes: 158 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.3.21](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.20...@salesforce/ts-sinon@1.3.21) (2021-07-09)

### Bug Fixes

- sinon types match sinon ([acb2a07](https://github.com/forcedotcom/sfdx-dev-packages/commit/acb2a07f7b7ed40944254126428e170e2e587cd7))

## [1.3.20](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.19...@salesforce/ts-sinon@1.3.20) (2021-07-08)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.19](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.18...@salesforce/ts-sinon@1.3.19) (2021-07-08)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.18](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.17...@salesforce/ts-sinon@1.3.18) (2021-06-07)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.17](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.16...@salesforce/ts-sinon@1.3.17) (2021-06-07)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.16](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.15...@salesforce/ts-sinon@1.3.16) (2021-06-04)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.15](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.14...@salesforce/ts-sinon@1.3.15) (2021-06-03)

### Bug Fixes

- use existing published version of ts-types ([f1ae94a](https://github.com/forcedotcom/sfdx-dev-packages/commit/f1ae94a3e59794c7df7530547542da8d5ef40bef))

## [1.3.14](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.13...@salesforce/ts-sinon@1.3.14) (2021-06-03)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.13](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.12...@salesforce/ts-sinon@1.3.13) (2021-05-20)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.12](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.11...@salesforce/ts-sinon@1.3.12) (2021-05-12)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.11](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.10...@salesforce/ts-sinon@1.3.11) (2021-05-11)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.10](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.9...@salesforce/ts-sinon@1.3.10) (2021-05-11)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.9](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.8...@salesforce/ts-sinon@1.3.9) (2021-04-29)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.8](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.7...@salesforce/ts-sinon@1.3.8) (2021-04-29)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.7](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.6...@salesforce/ts-sinon@1.3.7) (2021-04-29)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.6](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.5...@salesforce/ts-sinon@1.3.6) (2021-04-19)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.5](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.4...@salesforce/ts-sinon@1.3.5) (2021-02-26)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.4](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.3...@salesforce/ts-sinon@1.3.4) (2021-02-26)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.3](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.2...@salesforce/ts-sinon@1.3.3) (2021-02-19)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.2](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.1...@salesforce/ts-sinon@1.3.2) (2021-02-19)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.3.1](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.3.0...@salesforce/ts-sinon@1.3.1) (2021-02-19)

**Note:** Version bump only for package @salesforce/ts-sinon

# [1.3.0](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.2.4...@salesforce/ts-sinon@1.3.0) (2021-01-28)

### Features

- update typescript version ([#109](https://github.com/forcedotcom/sfdx-dev-packages/issues/109)) ([399a0b0](https://github.com/forcedotcom/sfdx-dev-packages/commit/399a0b03aa831f25511bb3391702c10dc5c4a488))

## [1.2.4](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.2.3...@salesforce/ts-sinon@1.2.4) (2021-01-22)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.2.3](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.2.2...@salesforce/ts-sinon@1.2.3) (2020-09-14)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.2.2](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.2.1...@salesforce/ts-sinon@1.2.2) (2020-07-23)

### Bug Fixes

- missing ts-sinon merge and fixed eslint rules ([4d4325b](https://github.com/forcedotcom/sfdx-dev-packages/commit/4d4325b306e579e3ae9f3492b58a66f8eb8a4e56))

## [1.2.1](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.2.0...@salesforce/ts-sinon@1.2.1) (2020-07-21)

**Note:** Version bump only for package @salesforce/ts-sinon

# [1.2.0](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.1.3...@salesforce/ts-sinon@1.2.0) (2020-07-21)

### Features

- add eslint and use it in all packages ([0165cc8](https://github.com/forcedotcom/sfdx-dev-packages/commit/0165cc8853079c7f987dddfb60ced3efb00deea0))
- add javascipt eslint rules that typescript extends ([135ac73](https://github.com/forcedotcom/sfdx-dev-packages/commit/135ac73b8c513d8950ac69373349361d9f600a8c))
- add salesforce license linting ([3213135](https://github.com/forcedotcom/sfdx-dev-packages/commit/3213135f34956335ef2c123ec680c2de2bc7f10f))

## [1.1.3](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.1.2...@salesforce/ts-sinon@1.1.3) (2020-07-02)

### Bug Fixes

- **ts-sinon:** allow stubs to be returned in async methods ([bb3fb94](https://github.com/forcedotcom/sfdx-dev-packages/commit/bb3fb94))

## [1.1.2](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.1.1...@salesforce/ts-sinon@1.1.2) (2020-03-03)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.1.1](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.1.0...@salesforce/ts-sinon@1.1.1) (2019-08-30)

**Note:** Version bump only for package @salesforce/ts-sinon

# [1.1.0](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.0.6...@salesforce/ts-sinon@1.1.0) (2019-07-17)

### Features

- package updates ([69f3d02](https://github.com/forcedotcom/sfdx-dev-packages/commit/69f3d02))

## [1.0.6](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.0.5...@salesforce/ts-sinon@1.0.6) (2019-05-01)

**Note:** Version bump only for package @salesforce/ts-sinon

## [1.0.5](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.0.4...@salesforce/ts-sinon@1.0.5) (2019-03-22)

### Bug Fixes

- update yarn.lock ([6b4366c](https://github.com/forcedotcom/sfdx-dev-packages/commit/6b4366c))

## [1.0.4](https://github.com/forcedotcom/sfdx-dev-packages/compare/@salesforce/ts-sinon@1.0.3...@salesforce/ts-sinon@1.0.4) (2019-03-12)

**Note:** Version bump only for package @salesforce/ts-sinon
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# TypeScript-friendly utils for Sinon testing

This is a simple library to help create stubs with Sinon when working with TypeScript in order to leverage Sinon stubs and the type system more completely together as one without resorting to ugly, untyped hacks like casting stubbed functions to `any` or using associative array accesses, neither of which provide IDE-autocompletion of stub properties and methods, nor work well with stricter `tsc` and `tslint` rules applied to test sources.

## API

The API consists of the following functions:

### stubInterface

Used to provide a fully stubbed interface backed by an optional set of member properties which may form a subset of the overall interface. Function properties will be typed as proper `SinonStub`s along with any other specific type information provided by the interface.

### stubObject

Returns a fully stubbed proxy similar to those provided by `stubInterface`, but backed first by the optionally given members, and finally by a given object. This is useful for stubbing some properties of an existing object while providing test-specific returns for fakes for others.

### stubCallable

Like `stubObject` but works with callable TypeScript function types (i.e., functions with properties).

### fromStub

When using `stubObject` with objects created from classes with non-public members, the resulting `StubbedType<T>` often needs to be passed to a function or constructor that expects a `T`, but TypeScript's mapped types (which are the basis of `StubbedType`) do not capture non-public class members. Since the `StubbedType` returned from `stubObject` is backed by a real instance of type `T`, it can be simply reverted to type `T` by using `fromStub(instance)`. The implementation of this simply applies a type assertion, but using `fromStub` is preferred for clarity, especially given that this library exists to reduce the necessity of using type assertions in tests in the first place.
64 changes: 64 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@salesforce/ts-sinon",
"version": "1.3.21",
"description": "TypeScript helpers for Sinon",
"main": "lib/index.js",
"repository": "https://github.com/forcedotcom/ts-sinon",
"author": "Salesforce",
"license": "BSD-3-Clause",
"types": "lib/index.d.ts",
"files": [
"lib/**/*.js",
"lib/**/*.d.ts"
],
"dependencies": {
"@salesforce/ts-types": "^1.5.20",
"sinon": "^5.1.1",
"tslib": "^2.2.0"
},
"devDependencies": {
"@salesforce/dev-config": "^2.1.2",
"@salesforce/dev-scripts": "^0.9.18",
"@salesforce/prettier-config": "^0.0.2",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"chai": "^4.2.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-salesforce": "^0.1.6",
"eslint-config-salesforce-license": "^0.1.6",
"eslint-config-salesforce-typescript": "^0.2.7",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-jsdoc": "^35.1.2",
"eslint-plugin-prefer-arrow": "^1.2.1",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.3.8",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"pretty-quick": "^3.1.0",
"sinon": "10.0.0",
"ts-node": "^10.0.0",
"typescript": "^4.1.3"
},
"scripts": {
"build": "sf-build",
"clean": "sf-clean",
"clean-all": "sf-clean all",
"compile": "sf-compile",
"docs": "sf-docs",
"format": "sf-format",
"lint": "sf-lint",
"prepack": "sf-prepack",
"pretest": "sf-compile-test",
"test": "sf-test"
},
"husky": {
"hooks": {
"commit-msg": "sf-husky-commit-msg",
"pre-commit": "sf-husky-pre-commit",
"pre-push": "sf-husky-pre-push"
}
}
}

0 comments on commit bfdb493

Please sign in to comment.