Skip to content

Commit

Permalink
fix: more colors and experiental runner and autodetect
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Jun 29, 2023
1 parent 1dc59f4 commit 477ec99
Show file tree
Hide file tree
Showing 11 changed files with 708 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mocks/tops/all.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import('./test1.test.js')
import('./test2.test.js')
69 changes: 69 additions & 0 deletions mocks/tops/test1.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { test } from '../../src/taps/index.js'
import delay from 'delay'
import { type, is, equal } from 'uvu/assert'
import assert from 'assert'
// test.before(() => {
// console.log('before')
// })

// test.after(() => {
// console.log('after')
// })

// test.beforeEach(() => {
// console.log('before each')
// })

// test.afterEach(() => {
// console.log('after each')
// throw new Error('after each error')
// })

test('sum1', () => {
type(() => {}, 'function')
is(3, 3)
})

test.skip('sum2', async () => {
await delay(100)
type(() => {}, 'function')
is(3, 3)
})

// test('fail sum', () => {
// type(() => {}, 'function')
// is(3, 4)
// })

// test('fail sum 2', () => {
// type(() => {}, 'functions')
// is(3, 4)
// })

// test('fail sum 3', () => {
// equal({ a: 1, b: 2 }, { a: 2 })
// })

test('fail sum 4', () => {
assert.deepStrictEqual({ a: 1, b: 2 }, { a: 2 })
})

// test('failing test using Promises', () => {
// // Promises can be used directly as well.
// return new Promise((resolve, reject) => {
// setImmediate(() => {
// reject(new Error('this will cause the test to fail'))
// })
// })
// })

test('fail sum 45', (t) => {
t.test('sum2', async () => {
await delay(100)
type(() => {}, 'function')
is(3, 3)
})
t.test('fail sum 36', (t) => {
t.subset({ a: 1, b: 2 }, { b: 100000000000000, a: (v) => v === 3 })
})
})
11 changes: 11 additions & 0 deletions mocks/tops/test2.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { suite } from '../../src/taps/index.js'
import { type, is } from 'uvu/assert'

const test = suite('suite1')

test('sum suite 1', () => {
type(() => {}, 'function')
is(3, 3)
})

// suite1.run()
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
"devDependencies": {
"@types/mocha": "^10.0.1",
"@types/polka": "^0.5.4",
"acorn": "^8.9.0",
"assert": "^2.0.0",
"benchmark": "^2.1.4",
"copyfiles": "^2.4.1",
"debug": "^4.3.4",
Expand All @@ -93,6 +95,7 @@
"simple-git-hooks": "^2.8.1",
"tinybench": "^2.5.0",
"typescript": "^5.1.3",
"util": "^0.12.5",
"uvu": "^0.5.6",
"zora": "^5.2.0"
},
Expand Down
49 changes: 47 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 477ec99

Please sign in to comment.