poi-preset-transform-test-files

10.0.0 • Public • Published

poi-preset-transform-test-files

How does this work:

  • Transform your test files with Poi.
  • Run custom test framework against transformed test file.

Install

yarn add poi-preset-transform-test-files --dev

Usage

Activate it in config file:

// poi.config.js
module.exports = {
  presets: [
    require('poi-preset-transform-test-files')(/* options */)
  ]
}

Then you can compile test files, by default it looks for **/*.test.js from the root, otherwise you could specify the directory by --baseDir:

poi test
# or somewhere else
poi test "src/*.test.js" "lib/*.spec.js"
# or from certain directory
poi test --baseDir "./test"

The default generated test files can be found at in place as [name].transfromed.js, you can finally run it with your favorite test framework like AVA:

poi test && ava ./test/example.test.transformed.js

If you want to bundle test files to certain directory, rather than at the same place as source. Please check the outputDir option below.

Note: You might put *.transfromed.js in .gitignore file.

Options

testFiles

Type: string Array
Default: **/*.{test,spec}.js

ignoreFiles

Type: Array
Default: ['!**/node_modules/**', '!**/vendor/**'])

baseDir

Type: string
Default: cwd

The directory to search testFiles.

outputDir

Type: string
Default: baseDir

The directory of transfromed test files.

// poi.config.js
module.exports = {
  presets: [
    require('poi-preset-transform-test-files')({
      outputDir: './test/_build'
    })
  ]
}

LICENSE

MIT © EGOIST

Readme

Keywords

none

Package Sidebar

Install

npm i poi-preset-transform-test-files

Weekly Downloads

8

Version

10.0.0

License

none

Last publish

Collaborators

  • rem