2023-10-16 19:23:53 +03:00
|
|
|
module.exports = {
|
|
|
|
cjs: {
|
|
|
|
getFiles: () => 'tests/**/*.js',
|
|
|
|
runFile: (file) => `mocha ${file}`,
|
|
|
|
},
|
|
|
|
esm: {
|
|
|
|
getFiles: () => 'tests/**/*.js',
|
|
|
|
runFile: (file) => `mocha ${file}`,
|
|
|
|
},
|
|
|
|
ts: {
|
|
|
|
getFiles: () => 'tests/**/*.ts',
|
2023-12-23 22:00:20 +03:00
|
|
|
beforeAll: () => ['tsc', 'node build-esm.cjs'],
|
|
|
|
runFile: (file) => {
|
|
|
|
if (file.startsWith('tests/packaging/')) {
|
|
|
|
// packaging tests - we need to make sure everything imports and works
|
|
|
|
return [
|
|
|
|
`mocha -r ts-node/register ${file}`,
|
|
|
|
`mocha dist/${file.replace(/\.ts$/, '.js')}`,
|
|
|
|
`node run-esm.cjs ${file}`,
|
|
|
|
`mocha dist/esm/${file.replace(/\.ts$/, '.js')}`,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
// normal e2e tests - testing features etc
|
|
|
|
return `mocha dist/${file.replace(/\.ts$/, '.js')}`
|
|
|
|
},
|
2023-10-16 19:23:53 +03:00
|
|
|
},
|
|
|
|
}
|