Hacer que babel excluya archivos de prueba
En mi paso de compilación estoy usando babel para transpilar el código a es5 (de src
a dist
). ¿Cómo puedo hacer que excluya los archivos que terminan en .test.js
?
Paquete.json
"scripts": {
"build": "babel src --out-dir dist",
.babelrc
{
"presets": [ "es2015" ],
"ignore": "\\.test\\.js"
}
24
Author: loganfsmyth, 2016-02-15
2 answers
Basado en la documentación, debería ser capaz de escribir .babelrc
{
"ignore": [
"**/*.test.js"
]
}
Sin embargo, pude verificar que esto no parece funcionar. Lo probé con la versión 6.5.1 (babel-core 6.5.2).
Al mismo tiempo, lo siguiente funciona:
babel src --out-dir build --ignore '**/*.test.js'
Es el mismo patrón glob que se escribió en el archivo .babelrc
. Si instala cualquier biblioteca glob desde npm encontrará que este patrón glob funcionaría (así es como se me ocurrió...Actualmente no uso babel).
56
Author: Wil Moore III,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-15 21:09:28
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-15 21:09:28
A partir de hoy, lo siguiente funciona en .babelrc (babel-core: v6.26.3)
"ignore": [
"**/__tests__", // ignore the whole test directory
"**/*.test.js" // ignore test files only
]
1
Author: Pubudu Dodangoda,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-02 00:40:53
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-02 00:40:53