Skip to content
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

29: Tests with Vitest #84

Merged
merged 25 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bec4148
One test working with vitest, config changes
RyanR712 Oct 7, 2023
5fdbe43
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 7, 2023
6b6e43c
README.md draft
RyanR712 Oct 7, 2023
c3807ea
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 7, 2023
1433d81
Moved the tests
James-Oswald Oct 7, 2023
a74938c
Ellipse.test.ts skeleton, documentation, new test
RyanR712 Oct 8, 2023
f2c14f4
Linting for tests
James-Oswald Oct 8, 2023
31c7035
Workflow attempt
RyanR712 Oct 8, 2023
d5c4e45
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 8, 2023
b165787
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 8, 2023
bbe7b0e
Point.test.ts creation, misc changes
RyanR712 Oct 8, 2023
96f26ff
Merge branch '29-using-vitest-for-unit-testing' of https://github.com…
RyanR712 Oct 8, 2023
531d328
Organized Point.test.ts with describe() statements
RyanR712 Oct 8, 2023
320b919
Comprehensive Point tests w/test.each()
RyanR712 Oct 8, 2023
4b26a2b
More tests and better organization
RyanR712 Oct 9, 2023
37415a9
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 9, 2023
67e2b21
Updated Rectangle() constructor
RyanR712 Oct 9, 2023
1249bc5
More Rectangle tests
RyanR712 Oct 9, 2023
5ef91b3
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 10, 2023
192cc52
Updated Rectangle containsPoint() tests, misc
RyanR712 Oct 10, 2023
611348b
More comprehensiver Rectangle tests
RyanR712 Oct 10, 2023
30c6642
Guess what? Yup. Tests got more comprehensive.
RyanR712 Oct 10, 2023
d20dc09
What's that?? MORE comprehensive tests?!
RyanR712 Oct 10, 2023
379cbf7
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 11, 2023
e271741
Merge branch 'master' into 29-using-vitest-for-unit-testing
RyanR712 Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build/
dist/
vite.config.js
public
public/
vite.config.js
18 changes: 18 additions & 0 deletions .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run all tests

on:
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install NPM dependencies
run: npm install

- name: Run all vitest tests
run: npm run test
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"styleguidelines",
"Subrina",
"Tiwari",
"vite",
"xshift",
"yshift"
],
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Sponsored by James Oswald (RAIR Lab)

## Development

**All listed commands should be run in the project root**
**All listed commands should be run in the project root (Peirce-My-Heart)**

### Documentation

Expand All @@ -35,6 +35,7 @@ We also use it to invoke all core development tools via `npm run`.
2. [**Vite**](https://vitejs.dev/) : Vite is an asset bundler and build system for large web projects with
many types of resources such as typescript. Additionally, it provides excellent debugging features.
We use it as a build system for Typescript, Asset Compressor, and Live Debugger.
* **Vitest** : a testing framework native to Vite with support for TypeScript. It allows for github workflow compatibility and running numerous tests with one command.

3. [**gts**](https://github.com/google/gts) : gts (Google TypeScript Style) is a set of style guidelines and tools for typescript
consistent and readable formatting. It provides defaults for the following tools we use:
Expand Down Expand Up @@ -97,18 +98,31 @@ open attached to the Vite server, any vs code breakpoints triggered in chrome
will be jumped to in VSC.


## Testing

Test your changes! Vitest will help here by looking for all .test.ts files in /tests/ and running them.
To perform this locally in a terminal, run the following:
```bash
npm run test
```


### Root Files and Folders Overview
```
/.github/ : The code for github workflows this project uses, used for automatically deploying.

/src/ : source code for the application

/tests/ : vitest compatible .test.ts files that are run on commits and must be passed before all merges to master

/.eslintignore : list of .js and .ts files the linter shouldn't look at

/.eslintrc.json : config for the linter, which catches semantic errors in your typescript code.

/.gitignore : list of files and folders shouldn't be uploaded with git version control

/.npmignore : list of the files NPM shouldn't peep

/.prettierrc.js : config for prettier, which catches syntactic errors in your typescript code.

/LICENSE : The legal jargon for who can use and sell the project.
Expand Down
Loading