Skip to content

Commit

Permalink
add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed May 17, 2022
1 parent 19ace8a commit 291a81a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
49 changes: 49 additions & 0 deletions bin/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict'

const { specReporter } = require('@japa/spec-reporter')
const { runFailedTests } = require('@japa/run-failed-tests')
const { processCliArgs, configure, run } = require('@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.
*/

const plugins = []

if (!process.env.CI) {
plugins.push(runFailedTests())
}

configure({
...processCliArgs(process.argv.slice(2)),
...{
plugins,
timeout: 2000,
files: ['test/**/*.js'],
reporters: [specReporter()],
importer: (filePath) => require(filePath),
filters: {
// files: ['mongodb-service-provider.js']
}
}
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/
run()
13 changes: 13 additions & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict'

const config = require('../dist')
const { expect } = require('expect')
const { test } = require('@japa/runner')
const { isObject } = require('./helpers/utils')

test('test basic properties of config', () => {
// expect(isObject(config.env)).toBe(true)
expect(isObject(config.rules)).toBe(true)
// expect(isObject(config.globals)).toBe(true)
expect(isObject(config.parserOptions)).toBe(true)
})
5 changes: 5 additions & 0 deletions test/helpers/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports.isObject = function isObject (obj) {
return typeof obj === 'object' && obj !== null
}

0 comments on commit 291a81a

Please sign in to comment.