-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement tests with uvu/swc #104
Open
natemoo-re
wants to merge
12
commits into
main
Choose a base branch
from
chore/tests
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
12 commits
Select commit
Hold shift + click to select a range
ce56ef6
wip: [email protected] changes
natemoo-re c8308e3
fix: remove custom document logic from dev
natemoo-re de64be0
wip: remap [email protected] default output directories
natemoo-re 1eb8733
fix(#81): remove PostCSS from core dependencies
natemoo-re 669eab2
fix(#81): remove prettier from core dependencies
natemoo-re c33aeab
fix(83): exclude image/font MIME types from transform
natemoo-re 791a21b
test: setup testing configuration
natemoo-re 0606911
chore: add contributing docs
natemoo-re 6fc634c
test(microsite): add Document tests
natemoo-re 6d7aad9
chore: add GitHub test action
natemoo-re ee0ce6d
chore: add vscode launch config
natemoo-re 1853843
chore: update @swc-node/register
natemoo-re 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,5 @@ | ||
--- | ||
"microsite": patch | ||
--- | ||
|
||
Remove prettier from core dependencies |
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 @@ | ||
--- | ||
"microsite": patch | ||
--- | ||
|
||
Remove PostCSS logic from core dependencies. Microsite will prompt users to install PostCSS locally if detected. |
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,35 @@ | ||
# Contributing to Microsite | ||
|
||
This codebase is a monorepo, set up with [Lerna](https://github.com/lerna/lerna). You should start by familiarizing yourself with `lerna`, as it operates a little bit differently than the standard Node/NPM workflow. | ||
|
||
> Note: Commands should generally be run from the root directory of the monorepo rather than a subdirectory like `packages/microsite`. | ||
|
||
## Initial dev setup | ||
|
||
1. Install [Volta](https://volta.sh/) if you haven't already. It's our favorite tools for managing Node/NPM versions, and automatically picks up the correct Node version for this project. | ||
|
||
2. Install dependencies for the monorepo: `npm install`. | ||
|
||
3. Install and link dependencies in sub-packages: `npx lerna bootstrap` | ||
|
||
## Adding features/fixing bugs | ||
Please open an issue describing your feature/bug before opening a PR. | ||
|
||
Please ensure that your PR is covered by a test, if applicable. Microsite currently has very fews tests but this is something we hope to prioritize. | ||
|
||
## Testing | ||
|
||
Our tests are written in TypeScript with [`uvu`](https://github.com/lukeed/uvu). They are run with the `uvu` CLI and [`@swc-node/register`](https://github.com/Brooooooklyn/swc-node/tree/master/packages/register). | ||
|
||
> Note: as of `@swc-node/[email protected]`, `jsxFactory` and `jsxFragmentFactory` are not respected. This means any Preact components need to include the following comment at the top of the file: | ||
> `/* @jsx h */` | ||
> This should be fixed in the next version of `@swc-node/register`. | ||
|
||
```bash | ||
npm run test | ||
|
||
# Or watch mode (requires a file change to run the first time) | ||
npm run test:watch | ||
``` | ||
|
||
**VSCode:** There are launch actions included for both single-run and watch mode. |
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,21 @@ | ||
name: Test | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: volta-cli/action@v1 | ||
|
||
- run: npm ci | ||
|
||
- run: npm run bootstrap:ci | ||
|
||
- run: npm run test |
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,35 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Run tests", | ||
"request": "launch", | ||
"console": "integratedTerminal", | ||
"autoAttachChildProcesses": true, | ||
"runtimeArgs": [ | ||
"run-script", | ||
"test" | ||
], | ||
"runtimeExecutable": "npm", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "pwa-node" | ||
}, | ||
{ | ||
"name": "Watch tests", | ||
"request": "launch", | ||
"console": "integratedTerminal", | ||
"autoAttachChildProcesses": true, | ||
"runtimeArgs": [ | ||
"run-script", | ||
"test:watch" | ||
], | ||
"runtimeExecutable": "npm", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "pwa-node" | ||
}, | ||
] | ||
} |
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 see you’ve landed on leaving off
hoist
, is that intentional? I certainly think it’ll improve the top level dependency flow for now. But just wanted to check that this is actually the preferred flow.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.
Yep, intentional! Seems to work just fine.
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.
It’s a whole lot less fussy! I will say that I’m certain Yarn (1) would make hoisting work better for perf and a better FS impact. I can almost guarantee PNPM would too, just haven’t tried it. But this is definitely a case where perfection is something I’d avoid solving, I’m just happy to know I’m all good to install a top level dependency without wanting to take a smoke break during the re-bootrappening