Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.0 #171

Merged
merged 37 commits into from Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4bfec0e
chore!: bump jest from 27 to 28
andykenward Jul 24, 2022
da3a3aa
feat: update jest incompatibility check to support jest 28
andykenward Jul 24, 2022
72bf6f8
docs: remove jest 27 references
andykenward Jul 24, 2022
0164c1e
fix: jest 28 transformer
andykenward Jul 24, 2022
036d94b
feat: support older Jest
andykenward Jul 24, 2022
40f174e
docs: remove old link
andykenward Jul 24, 2022
0c5f51f
docs: troubleshooting Jest 27 support
andykenward Jul 24, 2022
5e2f62a
update yarn lock
yannbf Jul 26, 2022
2c6b041
chore: peerDependencies correct server version
andykenward Jul 26, 2022
91cf672
docs(README): add coverage recipes
yannbf Jul 27, 2022
51fa138
feat: add console logs on test failure
yannbf Aug 2, 2022
561bc7a
Merge pull request #154 from andykenward/feat/jest-28
yannbf Aug 5, 2022
4f0151c
improve logging and remove possible circular dependencies
yannbf Aug 5, 2022
045ea48
add extra space
yannbf Aug 5, 2022
66af119
support more logging methods
yannbf Aug 5, 2022
847a1c7
Merge pull request #157 from storybookjs/feat/add-console-logs-on-fai…
yannbf Aug 5, 2022
914bec3
use storybook@future on nightly script
yannbf Aug 16, 2022
ceb3d49
Merge pull request #162 from storybookjs/fix/nightly
yannbf Aug 16, 2022
54513b8
update stories [skip ci]
yannbf Aug 18, 2022
7aa853e
Merge pull request #164 from storybookjs/update-stories [skip ci]
yannbf Aug 18, 2022
8ce1905
add intended failure stories
yannbf Aug 18, 2022
686132c
rename story
yannbf Aug 18, 2022
1f73266
add skip snapshots for internal example
yannbf Aug 18, 2022
8585857
feat: throw error on unconfigured coverage when running with --coverage
yannbf Aug 18, 2022
2e94457
add failure test to nightly check [skip-release]
yannbf Aug 22, 2022
faf0331
Merge pull request #165 from storybookjs/fix/nightly
yannbf Aug 22, 2022
a10cf2e
document new cli options
yannbf Aug 22, 2022
f7ec650
fix story
yannbf Aug 22, 2022
d5bc7b5
Merge pull request #167 from storybookjs/document-new-cli-options [sk…
yannbf Aug 22, 2022
1531285
Merge pull request #166 from storybookjs/yann/sb-663-test-runner-fail…
yannbf Aug 22, 2022
33b5905
fix --watch cli option
yannbf Aug 22, 2022
97276b0
Merge pull request #168 from storybookjs/yann/sb-678-test-runner163-b…
yannbf Aug 22, 2022
4616a74
undo Jest 28 support
yannbf Aug 23, 2022
358e10d
Merge pull request #169 from storybookjs/undo-jest-28-support
yannbf Aug 23, 2022
f5728e0
add pre-commit hooks
yannbf Aug 23, 2022
9ca7e59
apply prettier on all files
yannbf Aug 23, 2022
4cae157
Merge pull request #170 from storybookjs/add-commit-hooks [skip ci]
yannbf Aug 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
114 changes: 108 additions & 6 deletions .github/workflows/nightly.yml
Expand Up @@ -3,10 +3,15 @@ name: Nightly checks
# runs every day at midnight
on:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling
push:
branches:
- fix/nightly

jobs:
test_storybook_prerelease:
assert_test_runner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -24,15 +29,14 @@ jobs:
echo "prev_sb_version=$(yarn list @storybook/react --depth=0 2> /dev/null | grep @storybook/react | awk -F'@' '{print $3}')" >> $GITHUB_ENV
echo "prev_sb_csf_version=$(yarn list @storybook/csf --depth=0 2> /dev/null | grep @storybook/csf | awk -F'@' '{print $3}')" >> $GITHUB_ENV

- name: Upgrade to storybook@next
- name: Upgrade to storybook@future
run: |
npx storybook upgrade --prerelease
npx storybook@future upgrade --prerelease --yes

# TODO: This should not be necessary once @storybook/csf is properly updated
- name: Fix local @storybook/csf version
run: |
yarn add @storybook/csf@0.0.2--canary.4566f4d.1

- name: Run test runner
uses: mathiasvr/command-output@v1
id: tests
Expand All @@ -52,7 +56,7 @@ jobs:
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID }}"
channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
payload: |
{
"blocks": [
Expand Down Expand Up @@ -92,3 +96,101 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

assert_test_runner_failures:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Get current version of Storybook
run: |
echo "prev_sb_version=$(yarn list @storybook/react --depth=0 2> /dev/null | grep @storybook/react | awk -F'@' '{print $3}')" >> $GITHUB_ENV
echo "prev_sb_csf_version=$(yarn list @storybook/csf --depth=0 2> /dev/null | grep @storybook/csf | awk -F'@' '{print $3}')" >> $GITHUB_ENV

- name: Upgrade to storybook@future
run: |
npx storybook@future upgrade --prerelease --yes

# TODO: This should not be necessary once @storybook/csf is properly updated
- name: Fix local @storybook/csf version
run: |
yarn add @storybook/csf@0.0.2--canary.4566f4d.1

- name: Run test runner and expect failure
uses: mathiasvr/command-output@v1
with:
run: |
yarn build
yarn test-storybook:ci-failures

- name: Process test results
if: ${{ always() }}
id: tests
uses: sergeysova/jq-action@v2
with:
cmd: 'jq .numPassedTests test-results.json -r'

- name: Set failure check to env
if: ${{ always() }}
run: |
echo "FAILED=${{ steps.tests.outputs.value > 0 }}" >> $GITHUB_ENV

- name: Get prerelease version of Storybook
if: ${{ always() && env.FAILED == 'true' }}
run: |
echo "sb_version=$(yarn list @storybook/react --depth=0 2> /dev/null | grep @storybook/react | awk -F'@' '{print $3}')" >> $GITHUB_ENV
echo "sb_csf_version=$(yarn list @storybook/csf --depth=0 2> /dev/null | grep @storybook/csf | awk -F'@' '{print $3}')" >> $GITHUB_ENV

- name: Report if any test passes
if: ${{ always() && env.FAILED == 'true' }}
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":storybook: :runner: [Test Runner] The Nightly check for **failures** has passed :thinking_face:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*@storybook/react version:*\n${{ env.prev_sb_version }} >> ${{ env.sb_version }}"
},
{
"type": "mrkdwn",
"text": "*@storybook/csf version:*\n${{ env.prev_sb_csf_version }} >> ${{ env.sb_csf_version }}"
}
],
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "View failure",
"emoji": true
},
"value": "view_failure",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_id": "button-action"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -25,4 +25,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn release
yarn release
2 changes: 1 addition & 1 deletion .github/workflows/stress-test.yml
Expand Up @@ -2,7 +2,7 @@ name: Stress Tests

on:
pull_request:
types: [ labeled ]
types: [labeled]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
yarn build
yarn test-storybook:ci-coverage

- name: Generate code coverage
uses: codecov/codecov-action@v2
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -8,4 +8,5 @@ build-storybook.log
stories/atoms/StressTest.stories.js
yarn-error.log
.nyc_output
coverage
coverage
test-results.json
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
7 changes: 7 additions & 0 deletions .prettierignore
@@ -1 +1,8 @@
dist
node_modules
storybook-static
.cache
.env
*.snap
__snapshots__
CHANGELOG.md
20 changes: 12 additions & 8 deletions .storybook/main.js
@@ -1,4 +1,4 @@
const stories = [
let stories = [
'../stories/docs/**/*.stories.mdx',
// default title prefix
{
Expand All @@ -18,14 +18,18 @@ if (process.env.STRESS_TEST) {
stories.push('../stories/stress-test/*.stories.@(js|jsx|ts|tsx)');
}

if (process.env.TEST_FAILURES) {
stories = ['../stories/expected-failures/*.stories.@(js|jsx|ts|tsx)'];
}

const addons = [
process.env.WITHOUT_DOCS
? {
name: '@storybook/addon-essentials',
options: {
docs: false,
},
}
name: '@storybook/addon-essentials',
options: {
docs: false,
},
}
: '@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-coverage',
Expand All @@ -39,6 +43,6 @@ module.exports = {
buildStoriesJson: true,
},
core: {
disableTelemetry: true
}
disableTelemetry: true,
},
};
5 changes: 5 additions & 0 deletions .storybook/test-runner.ts
Expand Up @@ -4,6 +4,7 @@ import type { TestRunnerConfig } from '../dist/ts';

const snapshotsDir = process.env.SNAPSHOTS_DIR || '__snapshots__';
const customSnapshotsDir = `${process.cwd()}/${snapshotsDir}`;
const skipSnapshots = process.env.SKIP_SNAPSHOTS === 'true';

const config: TestRunnerConfig = {
setup() {
Expand All @@ -17,6 +18,10 @@ const config: TestRunnerConfig = {
return;
}

if (skipSnapshots) {
return;
}

// Visual snapshot tests
const image = await page.screenshot({ fullPage: true });
expect(image).toMatchImageSnapshot({
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Expand Up @@ -5,4 +5,4 @@
"titleBar.activeBackground": "#004752",
"titleBar.activeForeground": "#ECFCFF"
}
}
}