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

Build: Run unit tests on more node versions, mac, and windows #16744

Merged
merged 14 commits into from
Dec 15, 2021
Merged
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ module.exports = {
extends: ['@storybook/eslint-config-storybook', 'plugin:storybook/recommended'],
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'jest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['it.skipWindows', 'it.onWindows'] },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives us a way to write tests that don't run on windows or only run on windows. There were only a handful of times that I needed this, and maybe there are other ways around it, but it seemed like a useful enough utility that I thought it would be worth adding.

],
},
overrides: [
{
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
name: Unit tests

on: [push]
on:
push:
branches:
- next
pull_request:
types: [opened, reopened, labeled, synchronize]

jobs:
build:
name: Core Unit Tests
runs-on: ubuntu-latest
name: Core Unit Tests node-${{ matrix.node_version }}, ${{ matrix.os }}
if: |
${{ github.event.label.name == 'ci:matrix' ||
contains(github.event.pull_request.labels.*.name, 'ci:matrix') ||
github.event.type == 'push'}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node_version: [12, 14, 16]
include:
- os: macos-latest
node_version: 16
- os: windows-latest
node_version: 16
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: "12.x"
node-version: ${{ matrix.node_version }}
cache: yarn
- name: install, bootstrap
run: |
Expand Down
15 changes: 9 additions & 6 deletions addons/a11y/src/components/A11YPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ describe('A11YPanel', () => {
const { getByText } = render(<ThemedA11YPanel />);
const useChannelArgs = mockedApi.useChannel.mock.calls[0][0];
act(() => useChannelArgs[EVENTS.RESULT](axeResult));
await waitFor(() => {
expect(getByText(/Tests completed/)).toBeTruthy();
expect(getByText(/Violations/)).toBeTruthy();
expect(getByText(/Passes/)).toBeTruthy();
expect(getByText(/Incomplete/)).toBeTruthy();
});
await waitFor(
() => {
expect(getByText(/Tests completed/)).toBeTruthy();
expect(getByText(/Violations/)).toBeTruthy();
expect(getByText(/Passes/)).toBeTruthy();
expect(getByText(/Incomplete/)).toBeTruthy();
},
{ timeout: 2000 }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timeout didn't actually seem to help, this test still fails intermittently. Would love if someone who knows more about the a11y panel could take a look at why. But even so, I think it might be good to merge this even knowing this test is flakey, just so we can get some windows tests running.

);
});
});
Loading