-
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
feat: switch to d2l-test-runner and new vdiffs #82
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ npm run lint:eslint | |
npm run lint:style | ||
|
||
# unit tests | ||
npm run test:headless | ||
npm run test:unit | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
{ | ||
"scripts": { | ||
"test": "npm run lint && npm run test:headless", | ||
"test:headless": "web-test-runner --files \"./test/**/*.test.js\" --node-resolve", | ||
"test:headless:watch": "web-test-runner --files \"./test/**/*.test.js\" --node-resolve --watch" | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "d2l-test-runner" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me, I've never liked |
||
}, | ||
"dependencies": { | ||
"@brightspace-ui/core": "^2" | ||
}, | ||
"devDependencies": { | ||
"@open-wc/testing": "^3", | ||
"@web/test-runner": "^0.17" | ||
"@brightspace-ui/testing": "^1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { copyFile, copyFilesInDir, getDestinationPath, mergeJSON, mergeText, replaceText } from '../../helper.js'; | ||
|
||
export function run(templateData) { | ||
mergeJSON( | ||
`${__dirname}/templates/configured/_package.json`, | ||
`${getDestinationPath(templateData.hyphenatedName)}/package.json` | ||
); | ||
mergeText( | ||
`${__dirname}/templates/_README.md`, | ||
`${getDestinationPath(templateData.hyphenatedName)}/README.md` | ||
); | ||
mergeText( | ||
`${__dirname}/templates/_gitignore`, | ||
`${getDestinationPath(templateData.hyphenatedName)}/.gitignore` | ||
); | ||
|
||
copyFile( | ||
`${__dirname}/templates/_element.vdiff.js`, | ||
`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.vdiff.js` | ||
); | ||
replaceText(`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.vdiff.js`, templateData); | ||
|
||
copyFilesInDir(`${__dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName)); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
This repo uses [@brightspace-ui/testing](https://github.com/BrightspaceUI/testing)'s vdiff command to perform visual regression testing: | ||
|
||
```shell | ||
# vdiff | ||
npm run test:vdiff | ||
|
||
# re-generate goldens | ||
npm run test:vdiff golden | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import '../<%= hyphenatedName %>.js'; | ||
import { expect, fixture, html } from '@brightspace-ui/testing'; | ||
|
||
describe('<%= tagName %>', () => { | ||
|
||
it('default', async() => { | ||
const elem = await fixture(html`<<%= tagName %>></<%= tagName %>>`); | ||
await expect(elem).to.be.golden(); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vdiff/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"scripts": { | ||
"test:vdiff": "d2l-test-runner vdiff" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: vdiff | ||
on: pull_request | ||
jobs: | ||
vdiff: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: Brightspace/third-party-actions@actions/checkout | ||
- uses: Brightspace/third-party-actions@actions/setup-node | ||
with: | ||
node-version-file: .nvmrc | ||
- name: Install Dependencies | ||
run: npm install | ||
- name: vdiff Tests | ||
uses: BrightspaceUI/actions/vdiff@main | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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.
Wondering if this
runConstructor
should also move into@brightspace-ui/testing
... seems weird for it to be in core now that we have our own testing library.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.
Oh yeah it should, we talked about that somewhere else but I guess never made a story for it. Won't be able to remove it from
core
for a long time but might as well get started!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.
I've added
runConstructor
to@brightspace-ui/testing
and switched this to use it.