-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 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
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 |
---|---|---|
|
@@ -17,5 +17,5 @@ npm run lint:eslint | |
npm run lint:style | ||
|
||
# unit tests | ||
npm run test:headless | ||
npm run test:unit | ||
``` |
3 changes: 1 addition & 2 deletions
3
src/generators/test-unit/templates/configured/_element.test.js
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
11 changes: 3 additions & 8 deletions
11
src/generators/test-unit/templates/configured/_package.json
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,14 +1,9 @@ | ||
{ | ||
"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" | ||
}, | ||
"dependencies": { | ||
"@brightspace-ui/core": "^2" | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "d2l-test-runner" | ||
}, | ||
"devDependencies": { | ||
"@open-wc/testing": "^3", | ||
"@web/test-runner": "^0.17" | ||
"@brightspace-ui/testing": "^1" | ||
} | ||
} |
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 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,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)); | ||
} |
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,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 | ||
``` |
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,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(); | ||
}); | ||
|
||
}); |
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 @@ | ||
.vdiff/ |
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,5 @@ | ||
{ | ||
"scripts": { | ||
"test:vdiff": "d2l-test-runner vdiff" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/generators/test-vdiff/templates/static/.github/workflows/vdiff.yml
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,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.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/generators/test-visual-diff/templates/_element.visual-diff.html
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/generators/test-visual-diff/templates/_element.visual-diff.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/generators/test-visual-diff/templates/static/.github/workflows/visual-diff.yml
This file was deleted.
Oops, something went wrong.
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.
I'd like to rename
headless
tounit
since IMO it's a more meaningful name for these types of tests. If others agree, I can make the change in core as well.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.
Sounds good to me, I've never liked
headless
lol