Skip to content

Commit

Permalink
feat(setup): add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kettei-sproutty committed Nov 12, 2023
1 parent 5e0ceb1 commit fc82d2b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on: push

jobs:
check-rs:
check:
runs-on: ubuntu-latest
steps:
# Checkout the repository
Expand All @@ -14,14 +14,7 @@ jobs:
- run: cargo fmt --all -- --check
# Check code with clippy
- run: cargo clippy --all --all-targets -- -D warnings
# Check if the code compiles
- run: cargo build --all --all-targets
check-js:
needs: check-rs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup bun
# # Setup Node and Bun
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.11
Expand All @@ -33,5 +26,7 @@ jobs:
- run: bun eslint --max-warnings 0 .
# Check toml
- run: bun taplo check
# Build
- run: bun run build
# Run tests
- run: bun test
- run: bun run test
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ pnpm-lock.yaml
# Misc
.DS_Store

# Build
dist
# Napi Build
index.cjs
index.d.ts
/*.node

# Publish (temp)
.npmignore
Expand Down
7 changes: 0 additions & 7 deletions __test__/index.spec.mjs

This file was deleted.

6 changes: 6 additions & 0 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import test from "ava";
import { sum } from '../index.cjs'

test("sum from native", async (t) => {
t.is(sum(1, 2), 3);
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "@scuderia-fe/atlas-generator",
"description": "Generate a spritesheet atlas from a folder of images",
"version": "0.1.0",
"type": "module",
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --platform --release",
"build": "napi build --platform --release --js index.cjs",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish -t npm",
"test": "ava",
Expand Down

0 comments on commit fc82d2b

Please sign in to comment.