-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate to the new Japa (#803)
- Loading branch information
1 parent
5e9ddf4
commit cb15d56
Showing
42 changed files
with
2,163 additions
and
2,035 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Assert } from '@japa/assert' | ||
|
||
declare module '@japa/runner' { | ||
interface TestContext { | ||
assert: Assert | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { assert } from '@japa/assert' | ||
import { specReporter } from '@japa/spec-reporter' | ||
import { runFailedTests } from '@japa/run-failed-tests' | ||
import { processCliArgs, configure, run } from '@japa/runner' | ||
import { remove } from 'fs-extra' | ||
import { join } from 'path' | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Configure tests | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The configure method accepts the configuration to configure the Japa | ||
| tests runner. | ||
| | ||
| The first method call "processCliArgs" process the command line arguments | ||
| and turns them into a config object. Using this method is not mandatory. | ||
| | ||
| Please consult japa.dev/runner-config for the config docs. | ||
*/ | ||
configure({ | ||
...processCliArgs(process.argv.slice(2)), | ||
...{ | ||
files: ['test/**/*.spec.ts', '!test/database/drop-table.spec.ts'], | ||
plugins: [assert(), runFailedTests()], | ||
reporters: [specReporter()], | ||
importer: (filePath: string) => import(filePath), | ||
teardown: [ | ||
async () => { | ||
await remove(join(__dirname, 'test-helpers', 'tmp')) | ||
}, | ||
], | ||
}, | ||
}) | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Run tests | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The following "run" method is required to execute all the tests. | ||
| | ||
*/ | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.