-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3678 from storybooks/tmeasday/refactor-jest-addon
Refactor addon-jest to use a parameter-based pattern
- Loading branch information
Showing
8 changed files
with
216 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,101 @@ | ||
{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":1,"numPassedTests":3,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTotalTestSuites":1,"numTotalTests":3,"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeys":[],"unmatched":0,"updated":0},"startTime":1530186110081,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":["AppComponent"],"failureMessages":[],"fullName":"AppComponent should create the app","location":null,"status":"passed","title":"should create the app"},{"ancestorTitles":["AppComponent"],"failureMessages":[],"fullName":"AppComponent should have as title 'app'","location":null,"status":"passed","title":"should have as title 'app'"},{"ancestorTitles":["AppComponent"],"failureMessages":[],"fullName":"AppComponent should render title in a h1 tag","location":null,"status":"passed","title":"should render title in a h1 tag"}],"endTime":1530186112997,"message":"","name":"/Users/jetbrains/IdeaProjects/storybook/examples/angular-cli/src/app/app.component.spec.ts","startTime":1530186110782,"status":"passed","summary":""}],"wasInterrupted":false} | ||
{ | ||
"numFailedTestSuites": 0, | ||
"numFailedTests": 0, | ||
"numPassedTestSuites": 2, | ||
"numPassedTests": 6, | ||
"numPendingTestSuites": 0, | ||
"numPendingTests": 0, | ||
"numRuntimeErrorTestSuites": 0, | ||
"numTotalTestSuites": 2, | ||
"numTotalTests": 6, | ||
"snapshot": { | ||
"added": 0, | ||
"didUpdate": false, | ||
"failure": false, | ||
"filesAdded": 0, | ||
"filesRemoved": 0, | ||
"filesUnmatched": 0, | ||
"filesUpdated": 0, | ||
"matched": 0, | ||
"total": 0, | ||
"unchecked": 0, | ||
"uncheckedKeys": [], | ||
"unmatched": 0, | ||
"updated": 0 | ||
}, | ||
"startTime": 1527637782576, | ||
"success": true, | ||
"testResults": [ | ||
{ | ||
"assertionResults": [ | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should create the app", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should create the app" | ||
}, | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should have as title 'app'", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should have as title 'app'" | ||
}, | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should render title in a h1 tag", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should render title in a h1 tag" | ||
} | ||
], | ||
"endTime": 1527637787074, | ||
"message": "", | ||
"name": | ||
"/Users/jetbrains/IdeaProjects/storybook/examples/angular-cli/dist/app/app.component.spec.ts", | ||
"startTime": 1527637783974, | ||
"status": "passed", | ||
"summary": "" | ||
}, | ||
{ | ||
"assertionResults": [ | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should create the app", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should create the app" | ||
}, | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should have as title 'app'", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should have as title 'app'" | ||
}, | ||
{ | ||
"ancestorTitles": ["AppComponent"], | ||
"failureMessages": [], | ||
"fullName": "AppComponent should render title in a h1 tag", | ||
"location": null, | ||
"status": "passed", | ||
"title": "should render title in a h1 tag" | ||
} | ||
], | ||
"endTime": 1527637787196, | ||
"message": "", | ||
"name": | ||
"/Users/jetbrains/IdeaProjects/storybook/examples/angular-cli/src/app/app.component.spec.ts", | ||
"startTime": 1527637783968, | ||
"status": "passed", | ||
"summary": "" | ||
} | ||
], | ||
"wasInterrupted": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { storiesOf } from '@storybook/angular'; | ||
import { withTests } from '@storybook/addon-jest'; | ||
|
||
import { AppComponent } from '../app/app.component'; | ||
import { wTests } from '../../.storybook/withTests'; | ||
import * as results from '../../addon-jest.testresults.json'; | ||
|
||
storiesOf('Addon|Jest', module) | ||
.addDecorator(wTests('app.component')) | ||
.add('app.component with jest tests', () => ({ | ||
component: AppComponent, | ||
props: {}, | ||
})); | ||
.addDecorator( | ||
withTests({ | ||
results, | ||
filesExt: '((\\.specs?)|(\\.tests?))?(\\.ts)?$', | ||
}) | ||
) | ||
.add( | ||
'app.component with jest tests', | ||
() => ({ | ||
component: AppComponent, | ||
props: {}, | ||
}), | ||
{ | ||
jest: 'app.component', | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters