Skip to content

Commit

Permalink
refactor: update to latest japa
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jul 2, 2023
1 parent ce6d987 commit 8d8aef9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 38 deletions.
36 changes: 4 additions & 32 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
import { assert } from '@japa/assert'
import { specReporter } from '@japa/spec-reporter'
import { fileSystem } from '@japa/file-system'
import { runFailedTests } from '@japa/run-failed-tests'
import { processCliArgs, configure, run } from '@japa/runner'
import { pathToFileURL } from 'node:url'
import { processCLIArgs, configure, run } from '@japa/runner'
import { BASE_URL } from '../test_helpers/index.js'

/*
|--------------------------------------------------------------------------
| 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.
*/
processCLIArgs(process.argv.slice(2))
configure({
...processCliArgs(process.argv.slice(2)),
...{
files: ['tests/**/*.spec.ts'],
plugins: [assert(), runFailedTests(), fileSystem({ basePath: BASE_URL })],
reporters: [specReporter()],
importer: (filePath: string) => import(pathToFileURL(filePath).href),
},
files: ['tests/**/*.spec.ts'],
plugins: [assert(), fileSystem({ basePath: BASE_URL })],
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/
run()
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"release": "np --message=\"chore(release): %s\"",
"version": "npm run build",
"sync-labels": "github-label-sync --labels .github/labels.json adonisjs/repl",
"quick:test": "node --loader=ts-node/esm bin/test.ts",
"quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts",
"format": "prettier --write .",
"prepublishOnly": "npm run build",
"index:commands": "adonis-kit index build/commands"
Expand All @@ -60,11 +60,9 @@
"@adonisjs/eslint-config": "^1.1.7",
"@adonisjs/prettier-config": "^1.1.7",
"@adonisjs/tsconfig": "^1.1.7",
"@japa/assert": "^1.4.1",
"@japa/file-system": "^1.1.0",
"@japa/run-failed-tests": "^1.1.1",
"@japa/runner": "^2.5.1",
"@japa/spec-reporter": "^1.3.3",
"@japa/assert": "^2.0.0-1",
"@japa/file-system": "^2.0.0-1",
"@japa/runner": "^3.0.0-2",
"@swc/core": "^1.3.67",
"@types/node": "^20.3.3",
"c8": "^8.0.0",
Expand Down

0 comments on commit 8d8aef9

Please # to comment.