Skip to content

Commit

Permalink
Add vitest to GitHub actions (#9162)
Browse files Browse the repository at this point in the history
* Add vitest to GHA

* Make a clean install

* switching from jsx to React.createElement()

* Update and rename test.yml to vitest.yml

---------

Co-authored-by: Steve Persch <steve.persch@pantheon.io>
Co-authored-by: Steve Persch <stevector@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 8, 2024
1 parent a86a02b commit 8468bfa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/vitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: JavaScript Unit Tests
on:
pull_request:
paths:
- 'src/**'
- '.github/workflows/vitest.yml'
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'latest'
- run: npm ci
- run: npx vitest src/components
10 changes: 6 additions & 4 deletions src/components/omniSidebarNav/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const turnItemsIntoLinks = (item, activePage) => {
// If the link is external, add an icon to indicate that.
// Internal links will start with a slash.
if (item.link.startsWith('http')) {
linkText = (
<>
<Icon iconName="externalLink" /> {item.title}
</>
linkText = React.createElement(
React.Fragment,
null,
React.createElement(Icon, { iconName: "externalLink" }),
" ",
item.title
);
}

Expand Down

0 comments on commit 8468bfa

Please sign in to comment.