Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
refactor: migrate to new japa (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Feb 27, 2022
1 parent 2df3571 commit 2add0e5
Show file tree
Hide file tree
Showing 18 changed files with 233 additions and 200 deletions.
Empty file added .bin/japaTypes.ts
Empty file.
12 changes: 0 additions & 12 deletions .bin/test.js

This file was deleted.

40 changes: 40 additions & 0 deletions .bin/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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'

/*
|--------------------------------------------------------------------------
| 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'],
plugins: [assert(), runFailedTests()],
reporters: [specReporter()],
importer: (filePath: string) => import(filePath),
setup: [() => {
import('../src/disableLogger')
}]
},
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/
run()
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"scripts": {
"mrm": "mrm --preset=@adonisjs/mrm-preset",
"pretest": "npm run lint",
"test": "node .bin/test.js",
"test": "node -r ts-node/register/transpile-only .bin/test.ts",
"lint": "eslint . --ext=.ts",
"clean": "del build",
"clean": "del-cli build",
"compile": "npm run lint && npm run clean && tsc",
"build": "npm run compile",
"commit": "git-cz",
Expand All @@ -34,6 +34,10 @@
"@adonisjs/application": "^5.2.0",
"@adonisjs/mrm-preset": "^5.0.2",
"@adonisjs/require-ts": "^2.0.10",
"@japa/assert": "^1.2.3",
"@japa/run-failed-tests": "^1.0.3",
"@japa/runner": "^1.2.0",
"@japa/spec-reporter": "^1.1.7",
"@poppinss/dev-utils": "^2.0.2",
"@types/fs-extra": "^9.0.13",
"@types/ini": "^1.3.31",
Expand All @@ -51,7 +55,6 @@
"github-label-sync": "^2.0.2",
"husky": "^7.0.4",
"ini": "^2.0.0",
"japa": "^4.0.0",
"mrm": "^3.0.10",
"np": "^7.6.0",
"prettier": "^2.5.1",
Expand Down
Loading

0 comments on commit 2add0e5

Please sign in to comment.