mtcute/e2e/config.js

31 lines
1,013 B
JavaScript
Raw Normal View History

module.exports = {
cjs: {
getFiles: () => 'tests/**/*.js',
runFile: (file) => `mocha ${file}`,
},
esm: {
getFiles: () => 'tests/**/*.js',
runFile: (file) => `mocha ${file}`,
},
ts: {
getFiles: () => 'tests/**/*.ts',
beforeAll: () => ['tsc', 'node build-esm.cjs'],
runFile: (file) => {
2024-03-04 01:39:18 +03:00
if (require('path').basename(file)[0] === '_') return null
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')}`
},
},
}