Updates the react-jest-testing sample to SPFx version npm run 1.6.0 (#630)

This commit is contained in:
Velin Georgiev 2018-10-03 13:01:14 +01:00 committed by Vesa Juvonen
parent 5d971a1589
commit ccdc45b23e
9 changed files with 2231 additions and 4343 deletions

View File

@ -1,7 +1,7 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"isCreatingSolution": true, "isCreatingSolution": true,
"version": "1.5.0", "version": "1.6.0",
"libraryName": "react-jest-testing", "libraryName": "react-jest-testing",
"libraryId": "9e16e13b-8d8c-4b89-8de4-dd654c5b6740", "libraryId": "9e16e13b-8d8c-4b89-8de4-dd654c5b6740",
"environment": "spo", "environment": "spo",

View File

@ -62,7 +62,7 @@ The sample uses SPFx web part, but the same setup applies for SPFx extensions an
## Used SharePoint Framework Version ## Used SharePoint Framework Version
![drop](https://img.shields.io/badge/drop-1.5.0-green.svg) ![drop](https://img.shields.io/badge/drop-1.6.0-green.svg)
## Applies to ## Applies to
@ -86,6 +86,7 @@ Version|Date|Comments
-------|----|-------- -------|----|--------
0.0.1|May 9, 2018 | Initial commit 0.0.1|May 9, 2018 | Initial commit
0.0.2|June 12, 2018 | Update to 1.5.0, missing launch.json added 0.0.2|June 12, 2018 | Update to 1.5.0, missing launch.json added
0.0.3|September 27, 2018 | Update to 1.6.0
## Disclaimer ## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
@ -99,6 +100,11 @@ Version|Date|Comments
- `npm i` - `npm i`
- `npm test` **(NOT gulp test)** - `npm test` **(NOT gulp test)**
Note: You migh want to switch to a test fake offline provider to use the full functionality of the web part when on local workbench. You can do so by replacing the real pnpjs provider in IceCreamShopWebPart.ts with its fake one at line 37. Just replace IceCreamPnPJsProvider() with IceCreamFakeProvider().
```
iceCreamProvider: new IceCreamPnPJsProvider(sp), //new IceCreamFakeProvider() // replace with Fake provider when offline workbench.
```
## Features ## Features
This Web Part illustrates the following concepts on top of the SharePoint Framework: This Web Part illustrates the following concepts on top of the SharePoint Framework:

View File

@ -1,45 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/tslint.schema.json",
// Display errors as warnings
"displayAsWarning": true,
// The TSLint task may have been configured with several custom lint rules
// before this config file is read (for example lint rules from the tslint-microsoft-contrib
// project). If true, this flag will deactivate any of these rules.
"removeExistingRules": true,
// When true, the TSLint task is configured with some default TSLint "rules.":
"useDefaultConfigAsBase": false,
// Since removeExistingRules=true and useDefaultConfigAsBase=false, there will be no lint rules
// which are active, other than the list of rules below.
"lintConfig": {
// Opt-in to Lint rules which help to eliminate bugs in JavaScript
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-case": true,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"valid-typeof": true,
"variable-name": false,
"whitespace": false
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,40 +11,41 @@
"test": "jest" "test": "jest"
}, },
"dependencies": { "dependencies": {
"react": "15.6.2", "@microsoft/sp-core-library": "1.6.0",
"react-dom": "15.6.2", "@microsoft/sp-lodash-subset": "1.6.0",
"@microsoft/sp-office-ui-fabric-core": "1.6.0",
"@microsoft/sp-webpart-base": "1.6.0",
"@pnp/common": "1.2.1",
"@pnp/logging": "1.2.1",
"@pnp/odata": "1.2.1",
"@pnp/sp": "1.2.1",
"@types/es6-promise": "0.0.33",
"@types/react": "15.6.6", "@types/react": "15.6.6",
"@types/react-dom": "15.5.6", "@types/react-dom": "15.5.6",
"@microsoft/sp-core-library": "1.5.0",
"@microsoft/sp-webpart-base": "1.5.0",
"@microsoft/sp-lodash-subset": "1.5.0",
"@microsoft/sp-office-ui-fabric-core": "1.5.0",
"@types/webpack-env": "1.13.1", "@types/webpack-env": "1.13.1",
"@types/es6-promise": "0.0.33", "react": "15.6.2",
"@pnp/common": "1.1.1", "react-dom": "15.6.2"
"@pnp/sp": "1.1.1",
"@pnp/odata": "1.1.1",
"@pnp/logging": "1.1.1"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/sp-build-web": "1.5.0", "@microsoft/sp-build-web": "1.6.0",
"@microsoft/sp-module-interfaces": "1.5.0", "@microsoft/sp-module-interfaces": "1.6.0",
"@microsoft/sp-webpart-workbench": "1.5.0", "@microsoft/sp-webpart-workbench": "1.6.0",
"gulp": "~3.9.1",
"@types/chai": "3.4.34", "@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2",
"@types/jest": "22.2.3",
"jest": "22.4.3",
"ts-jest": "22.4.5",
"identity-obj-proxy": "3.0.0",
"react-test-renderer": "15.6.2",
"enzyme": "3.3.0",
"@types/enzyme": "3.1.10", "@types/enzyme": "3.1.10",
"enzyme-adapter-react-15": "1.0.5", "@types/jest": "22.2.3",
"@types/mocha": "2.2.38",
"@types/sinon": "4.3.1", "@types/sinon": "4.3.1",
"ajv": "~5.2.2",
"enzyme": "3.3.0",
"enzyme-adapter-react-15": "1.0.5",
"gulp": "~3.9.1",
"identity-obj-proxy": "3.0.0",
"jest": "22.4.3",
"jest-junit": "3.7.0",
"react-test-renderer": "15.6.2",
"sinon": "5.0.7", "sinon": "5.0.7",
"jest-junit": "3.7.0" "ts-jest": "22.4.5",
"tslint-microsoft-contrib": "5.0.0"
}, },
"jest": { "jest": {
"moduleFileExtensions": [ "moduleFileExtensions": [

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -10,7 +10,7 @@ import {
import * as strings from 'IceCreamShopWebPartStrings'; import * as strings from 'IceCreamShopWebPartStrings';
import IceCreamShop from './components/IceCreamShop'; import IceCreamShop from './components/IceCreamShop';
import { IIceCreamShopProps } from './components/IIceCreamShopProps'; import { IIceCreamShopProps } from './components/IIceCreamShopProps';
// import { IceCreamFakeProvider } from './iceCreamProviders/IceCreamFakeProvider'; // when offline workbench. import { IceCreamFakeProvider } from './iceCreamProviders/IceCreamFakeProvider'; // when offline workbench.
import { sp } from "@pnp/sp"; import { sp } from "@pnp/sp";
import { IceCreamPnPJsProvider } from './iceCreamProviders/IceCreamPnPJsProvider'; import { IceCreamPnPJsProvider } from './iceCreamProviders/IceCreamPnPJsProvider';
@ -34,7 +34,7 @@ export default class IceCreamShopWebPart extends BaseClientSideWebPart<IIceCream
const element: React.ReactElement<IIceCreamShopProps> = React.createElement( const element: React.ReactElement<IIceCreamShopProps> = React.createElement(
IceCreamShop, IceCreamShop,
{ {
iceCreamProvider: new IceCreamPnPJsProvider(sp), //new IceCreamFakeProvider() // when offline workbench. iceCreamProvider: new IceCreamPnPJsProvider(sp), //new IceCreamFakeProvider() // replace with Fake provider when offline workbench.
strings: strings strings: strings
} }
); );

View File

@ -9,6 +9,7 @@
"sourceMap": true, "sourceMap": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "lib",
"typeRoots": [ "typeRoots": [
"./node_modules/@types", "./node_modules/@types",
"./node_modules/@microsoft" "./node_modules/@microsoft"
@ -22,5 +23,12 @@
"dom", "dom",
"es2015.collection" "es2015.collection"
] ]
} },
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"lib"
]
} }

View File

@ -0,0 +1,32 @@
{
"rulesDirectory": [
"tslint-microsoft-contrib"
],
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"variable-name": false,
"whitespace": false
}
}