Skip to content
This repository was archived by the owner on Jan 8, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ This CLI tool allows to organize mocha tests in files and directories. It works
<ul>
<li>Install: <code>npm install --save mocha-per-file</code></li>
<li>Executable: <code>npx mocha-per-file</code></li>
<li>Require: <code>require('mocha-per-file')</code></li>
<li>Import: <code>import * as pkg from ('mocha-per-file')</code></li>
<li>Require: <code>const pkg = require('mocha-per-file')</code></li>
</ul>

<!-- /INSTALL -->
Expand Down
12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"testing",
"tree"
],
"bugs": {
"url": "https://github.com/dword-design/mocha-per-file/issues"
},
"repository": "dword-design/mocha-per-file",
"license": "MIT",
"author": "Sebastian Landwehr <info@dword-design.de>",
Expand All @@ -47,15 +44,10 @@
"mocha": "^6.2.2"
},
"devDependencies": {
"@dword-design/base": "^3.4.4",
"@dword-design/base": "^4.0.0",
"@dword-design/functions": "^2.2.2",
"expect": "^24.9.0",
"output-files": "^1.1.7",
"with-local-tmp-dir": "^2.2.0"
},
"contributors": [
"dword-design (http://www.dword-design.de)",
"Renovate Bot (http://renovatebot.com)"
],
"maintainers": []
}
}
13 changes: 9 additions & 4 deletions test/it-timeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ import { endent } from '@dword-design/functions'
export const it = () => withLocalTmpDir(__dirname, async () => {
await outputFile('test/foo.test.js', endent`
module.exports = {
timeout: 3000,
it: done => setTimeout(done, 2100),
timeout: 100,
it: done => setTimeout(done, 200),
}
`)
const { stdout } = await spawn('mocha-per-file', [], { capture: ['stdout'] })
expect(stdout).toMatch(/^\n\n ✓ foo.*?\n\n 1 passing \(.*?\)\n\n$/)
let stdout
try {
await spawn('mocha-per-file', [], { capture: ['stdout'] })
} catch (error) {
stdout = error.stdout
}
expect(stdout).toMatch('Error: Timeout of 100ms exceeded.')
})
export const timeout = 5000
2 changes: 1 addition & 1 deletion test/timeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import withLocalTmpDir from 'with-local-tmp-dir'
import { outputFile } from 'fs-extra'

export const it = () => withLocalTmpDir(__dirname, async () => {
await outputFile('test/foo.test.js', 'module.exports = () => new Promise(resolve => setTimeout(resolve, 500))')
await outputFile('test/foo.test.js', 'module.exports = () => new Promise(resolve => setTimeout(resolve, 200))')
let stdout
try {
await spawn('mocha-per-file', ['--timeout', 100], { capture: ['stdout'] })
Expand Down
Loading