-
Notifications
You must be signed in to change notification settings - Fork 0
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
GitHub action jest #3
Open
bolonio
wants to merge
3
commits into
main
Choose a base branch
from
github-action-jest
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Lighthouse CI | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
jobs: | ||
lighthouseci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
- run: npm install && npm install -g @lhci/[email protected] | ||
- run: npm run build | ||
- run: lhci autorun |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 14.x, 15.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test |
Large diffs are not rendered by default.
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
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,9 +1,12 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
import React from "react" | ||
import App from "./App" | ||
import { render } from "@testing-library/react" | ||
import { axe, toHaveNoViolations } from "jest-axe" | ||
|
||
test('renders learn react link', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); | ||
expect.extend(toHaveNoViolations) | ||
|
||
it("should not have any accessibility violations", async () => { | ||
const { container } = render(<App />) | ||
const results = await axe(container) | ||
expect(results).toHaveNoViolations() | ||
}) |
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,26 +1,18 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import React from "react" | ||
import ReactDOM from "react-dom" | ||
import { ColorImage } from "./stories/ColorImage" | ||
|
||
if (process.env.NODE_ENV !== "production") { | ||
const axe = require("@axe-core/react") | ||
axe(React, ReactDOM, 1000) | ||
} | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
<div> | ||
<ColorImage role="asdfa" /> | ||
</div> | ||
); | ||
) | ||
} | ||
|
||
export default App; | ||
export default App |
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,7 @@ | ||
import React from "react" | ||
import Image from "./ColorImage.jpeg" | ||
|
||
export const ColorImage: React.FC = () => ( | ||
<img | ||
src={Image} | ||
alt="A bunch of chocolate candies with different colors" | ||
width="500px" | ||
/> | ||
) | ||
export const ColorImage: React.FC<{ alt?: string; role?: string }> = ({ | ||
alt, | ||
role, | ||
}) => <img src={Image} role={role} alt={alt} width="600px" /> |
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,41 +1,41 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": false, | ||
"allowSyntheticDefaultImports": true, | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"jsx": "react", | ||
"lib": ["dom", "es2018"], | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"paths": { | ||
"@content/*": ["content/*"], | ||
"@context/*": ["src/context/*"], | ||
"@components/*": ["src/components/*"], | ||
"@layouts/*": ["src/layouts/*"], | ||
"@hooks/*": ["src/hooks/*"], | ||
"@images/*": ["src/images/*"], | ||
"@data/*": ["src/data/*"], | ||
"@utils/*": ["src/utils/*"], | ||
"@styles/*": ["src/styles/*"], | ||
}, | ||
"preserveConstEnums": true, | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"typeRoots": [ | ||
"./src/types" | ||
] | ||
"allowJs": false, | ||
"allowSyntheticDefaultImports": true, | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"lib": [ | ||
"dom", | ||
"es2018" | ||
], | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"preserveConstEnums": true, | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"typeRoots": [ | ||
"./src/types" | ||
], | ||
"target": "es5", | ||
"module": "esnext", | ||
"noEmit": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["**/*.ts", "**/*.tsx"] | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"include": [ | ||
"**/*.ts", | ||
"**/*.tsx" | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential accessibility issue: Ensures all elements with a role attribute use a valid value