I am importing a setup object to use in all my tests. However, I'm not sure how to prevent AVA from trying to assert the imported object. In my case this object is called store and is a Vuex store.
import test from 'ava'
import store from '../dist/test/setup/index.cjs.js'
test('mutations', t => {
const mutations = store._mutations
const expectedMutations = ['pokemonBox']
expectedMutations.forEach(m => t.true(
Object.keys(mutations).includes(m)
))
})
3 exceptions
✖ No tests found in test/setup/config.js, make sure to import "ava" at the top of your test file
✖ test/setup/index.js exited with a non-zero exit code: 1
✖ test/setup/store.js exited with a non-zero exit code: 1
Node.js v10.1.0
darwin 17.6.0
fish: Unknown command 'ava'
fish:
ava --version
^
5.6.0
From the docs:
Directories are recursed, with all *.js files being treated as test files. Directories named fixtures, helpers and node_modules are always ignored. So are files starting with _ which allows you to place helpers in the same directory as your test files.
So you need to either put the setup directory inside a directory named helpers or explicitly ignore that folder by specifying the globs to your test files in the files option or explicitly ignore that directory.
Most helpful comment
From the docs:
So you need to either put the
setupdirectory inside a directory namedhelpersor explicitly ignore that folder by specifying the globs to your test files in thefilesoption or explicitly ignore that directory.