Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/menduz/titere
Run browser tests from command line
https://github.com/menduz/titere
mocha puppeteer typescript
Last synced: 2 months ago
JSON representation
Run browser tests from command line
- Host: GitHub
- URL: https://github.com/menduz/titere
- Owner: menduz
- Created: 2018-03-28T14:38:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-24T00:36:38.000Z (6 months ago)
- Last Synced: 2024-10-03T10:47:36.187Z (3 months ago)
- Topics: mocha, puppeteer, typescript
- Language: TypeScript
- Size: 125 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# titere
Yet another run mocha in the browser using puppeteer package.
The usage is super simple:
```ts
// tests/index.js
// vanilla js or generated using webpackdescribe('a', function() {
it('does something', function() {
console.log('Hello!!!!1')
})
})// we control when do we run mocha.
mocha.run()
``````ts
import express = require('express')
import { run, serveIndex } from 'titere'const app = express()
// specify what test to run
app.get('/', serveIndex('tests/index.js'))// we do this to serve the test file
app.use('/tests', express.static('./tests/'))app.listen(7667, function() {
// once we are listening, trigger the test
doTest()
.then(() => process.exit(0))
.catch(err => {
console.error(err)
process.exit(1)
})
})async function doTest() {
const passingResult = await run({
file: 'http://localhost:7667'
})console.assert(passingResult.result.passed, 'It should pass')
}
```