Skip to content

Commit

Permalink
Add long running test. Utilize cross-org standard workflow for ci..
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Oct 6, 2024
1 parent c771385 commit 46ee9a9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 88 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/bun.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/deno.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/node.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

jobs:
deno_ci:
uses: cross-org/workflows/.github/workflows/deno-ci.yml@main
with:
entrypoint: mod.ts
lint_docs: false
bun_ci:
uses: cross-org/workflows/.github/workflows/bun-ci.yml@main
with:
jsr_dependencies: "@std/assert @std/async"
npm_dependencies: "sinon"
node_ci:
uses: cross-org/workflows/.github/workflows/node-ci.yml@main
with:
test_target: "*.test.ts"
jsr_dependencies: "@std/assert @std/async"
npm_dependencies: "sinon"
14 changes: 11 additions & 3 deletions mod.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test } from "./mod.ts";
import { assertEquals, assertNotEquals } from "@std/assert";
import { delay } from "@std/async";

// Simple test
test("Multiplication", () => {
Expand All @@ -11,16 +12,23 @@ test("Multiplication with timeout", () => {
assertEquals(5 * 4, 20);
}, { timeout: 1000 });

// Test with done callback (useful for async operations)
test("Async test", (_context, done) => {
// Failing async test with done callback
test("Long async test", (_context, done) => {
setTimeout(() => {
assertNotEquals(5, 4);
done(); // Signal test completion
}, 500);
}, { waitForCallback: true });

// Test with done callback (useful for async operations)
test("Async test", (_context, done) => {
setTimeout(() => {
assertNotEquals(5, 4);
done(); // Signal test completion
}, 4500);
}, { waitForCallback: true, timeout: 5500 });

// Test async
import { delay } from "@std/async";
test("async hello world", async () => {
const x = 1 + 2;

Expand Down

0 comments on commit 46ee9a9

Please sign in to comment.