Upgrade to 1.5.0, missing launch.json config added (#530)
This commit is contained in:
parent
9c7e33b521
commit
0af385ed17
|
@ -1,8 +1,11 @@
|
|||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"version": "1.4.1",
|
||||
"isCreatingSolution": true,
|
||||
"version": "1.5.0",
|
||||
"libraryName": "react-jest-testing",
|
||||
"libraryId": "9e16e13b-8d8c-4b89-8de4-dd654c5b6740",
|
||||
"environment": "spo"
|
||||
"environment": "spo",
|
||||
"packageManager": "npm",
|
||||
"componentType": "webpart"
|
||||
}
|
||||
}
|
|
@ -15,6 +15,10 @@ There is also a _Jest Watch_ (watcher) configuration that **will let live execut
|
|||
|
||||
![SharePoint Framework Jest Visual Studio Code - debugging unit test](./assets/Jest-Typescript-VSCode-debugging.png)
|
||||
|
||||
### Important: The dedug configurations should be placed in the .vscode -> launch.json file to make the debugging work
|
||||
|
||||
The sample has folder named `vscode` where the `launch.json` configuration for debuggind jest is stored. The configurations should be copied to your `.vscode` folder -> `launch.json` file. Once copied into your launch.json, then they will appear in your visual studio code debugging tab.
|
||||
|
||||
## Sinonjs is included as mocking framework for the SPFx solution
|
||||
|
||||
The solution also includes [Sinonjs](http://sinonjs.org/) that can be used to spawn spies, stubs and mocks.
|
||||
|
@ -58,7 +62,7 @@ The sample uses SPFx web part, but the same setup applies for SPFx extensions an
|
|||
|
||||
|
||||
## Used SharePoint Framework Version
|
||||
![drop](https://img.shields.io/badge/drop-1.4.1-green.svg)
|
||||
![drop](https://img.shields.io/badge/drop-1.5.0-green.svg)
|
||||
|
||||
## Applies to
|
||||
|
||||
|
@ -81,6 +85,7 @@ react-jest-testing | Velin Georgiev ( [@VelinGeorgiev](https://twitter.com/velin
|
|||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
0.0.1|May 9, 2018 | Initial commit
|
||||
0.0.2|June 12, 2018 | Update to 1.5.0, missing launch.json added
|
||||
|
||||
## 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.**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
|
||||
"version": "2.0",
|
||||
"bundles": {
|
||||
"ice-cream-shop-web-part": {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx-build/copy-assets.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
|
||||
"deployCdnPath": "temp/deploy"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
|
||||
"workingDir": "./temp/deploy/",
|
||||
"account": "<!-- STORAGE ACCOUNT NAME -->",
|
||||
"container": "react-jest-testing",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
|
||||
"solution": {
|
||||
"name": "react-jest-testing-client-side-solution",
|
||||
"id": "9e16e13b-8d8c-4b89-8de4-dd654c5b6740",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/core-build/serve.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
|
||||
"port": 4321,
|
||||
"https": true,
|
||||
"initialPage": "https://localhost:5432/workbench",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/core-build/tslint.schema.json",
|
||||
"$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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
|
||||
"cdnBasePath": "<!-- PATH TO CDN -->"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "react-jest-testing",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
@ -15,32 +15,33 @@
|
|||
"react-dom": "15.6.2",
|
||||
"@types/react": "15.6.6",
|
||||
"@types/react-dom": "15.5.6",
|
||||
"@microsoft/sp-core-library": "~1.4.1",
|
||||
"@microsoft/sp-webpart-base": "~1.4.1",
|
||||
"@microsoft/sp-lodash-subset": "~1.4.1",
|
||||
"@microsoft/sp-office-ui-fabric-core": "~1.4.1",
|
||||
"@types/webpack-env": ">=1.12.1 <1.14.0",
|
||||
"@pnp/common": "1.0.4",
|
||||
"@pnp/sp": "1.0.4",
|
||||
"@pnp/odata": "1.0.4",
|
||||
"@pnp/logging": "1.0.4"
|
||||
"@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/es6-promise": "0.0.33",
|
||||
"@pnp/common": "1.1.1",
|
||||
"@pnp/sp": "1.1.1",
|
||||
"@pnp/odata": "1.1.1",
|
||||
"@pnp/logging": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/sp-build-web": "~1.4.1",
|
||||
"@microsoft/sp-module-interfaces": "~1.4.1",
|
||||
"@microsoft/sp-webpart-workbench": "~1.4.1",
|
||||
"@microsoft/sp-build-web": "1.5.0",
|
||||
"@microsoft/sp-module-interfaces": "1.5.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.5.0",
|
||||
"gulp": "~3.9.1",
|
||||
"@types/chai": ">=3.4.34 <3.6.0",
|
||||
"@types/mocha": ">=2.2.33 <2.6.0",
|
||||
"@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",
|
||||
"enzyme-adapter-react-15": "1.0.5",
|
||||
"react-test-renderer": "15.6.2",
|
||||
"@types/sinon": "4.3.1",
|
||||
"sinon": "5.0.7",
|
||||
"jest-junit": "3.7.0"
|
||||
|
@ -57,7 +58,6 @@
|
|||
"testMatch": [
|
||||
"**/src/**/*.test.+(ts|tsx|js)"
|
||||
],
|
||||
"mapCoverage": true,
|
||||
"collectCoverage": true,
|
||||
"coverageReporters": [
|
||||
"json",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"$schema": "https://dev.office.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
|
||||
"id": "d67c5975-ba3e-49ec-9a23-245c15ea3cda",
|
||||
"alias": "IceCreamShopWebPart",
|
||||
"componentType": "WebPart",
|
||||
|
|
|
@ -12,7 +12,7 @@ export class IceCreamPnPJsProvider implements IIceCreamProvider {
|
|||
|
||||
public getAll(): Promise<IceCream[]> {
|
||||
|
||||
return new Promise<IceCream[]>(async (resolve, reject) => {
|
||||
return new Promise<IceCream[]>((resolve, reject) => {
|
||||
|
||||
const query: SearchQuery = {
|
||||
RowLimit: 10,
|
||||
|
|
|
@ -44,12 +44,15 @@ describe('Enzyme basics', () => {
|
|||
|
||||
it('should has the correct title', () => {
|
||||
|
||||
// Arrange
|
||||
// define contains/like css selector
|
||||
let cssSelector: string = 'h1';
|
||||
|
||||
// Act
|
||||
// find the elemet using css selector
|
||||
const text = reactComponent.find(cssSelector).text();
|
||||
|
||||
// Assert
|
||||
expect(text).toBe("PnP Ice Cream Shop");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "commonjs",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
/**
|
||||
* Install Chrome Debugger Extension for Visual Studio Code to debug your components with the
|
||||
* Chrome browser: https://aka.ms/spfx-debugger-extensions
|
||||
*/
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Local workbench",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "https://localhost:4321/temp/workbench.html",
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"sourceMaps": true,
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack:///../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../../src/*": "${webRoot}/src/*"
|
||||
},
|
||||
"runtimeArgs": [
|
||||
"--remote-debugging-port=9222"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Hosted workbench",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "https://enter-your-SharePoint-site/_layouts/workbench.aspx",
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"sourceMaps": true,
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack:///../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../src/*": "${webRoot}/src/*",
|
||||
"webpack:///../../../../../src/*": "${webRoot}/src/*"
|
||||
},
|
||||
"runtimeArgs": [
|
||||
"--remote-debugging-port=9222",
|
||||
"-incognito"
|
||||
]
|
||||
},
|
||||
//https://github.com/Microsoft/vscode-recipes/tree/master/debugging-jest-tests
|
||||
//https://github.com/facebook/jest/issues/1652
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest All",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest Watch",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand","--watch"], // jest --watch #runs jest -o by default
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
},
|
||||
{
|
||||
//https://facebook.github.io/jest/docs/en/cli.html
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Jest Watch All",
|
||||
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
|
||||
"args": ["--runInBand","--watchAll"],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue