* Gets the config for babel transforms run during `amp [unit|integration|e2e]`. * * @return {!Object}
()
| 10 | * @return {!Object} |
| 11 | */ |
| 12 | function getTestConfig() { |
| 13 | const instanbulPlugin = [ |
| 14 | 'istanbul', |
| 15 | { |
| 16 | exclude: [ |
| 17 | 'ads/**/*.js', |
| 18 | 'build-system/**/*.js', |
| 19 | 'extensions/**/test/**/*.js', |
| 20 | 'third_party/**/*.js', |
| 21 | 'test/**/*.js', |
| 22 | 'testing/**/*.js', |
| 23 | ], |
| 24 | }, |
| 25 | ]; |
| 26 | const reactJsxPlugin = [ |
| 27 | '@babel/plugin-transform-react-jsx', |
| 28 | { |
| 29 | pragma: 'Preact.createElement', |
| 30 | pragmaFrag: 'Preact.Fragment', |
| 31 | useSpread: true, |
| 32 | }, |
| 33 | ]; |
| 34 | const presetEnv = [ |
| 35 | '@babel/preset-env', |
| 36 | { |
| 37 | bugfixes: true, |
| 38 | modules: 'commonjs', |
| 39 | loose: true, |
| 40 | targets: {'browsers': ['Last 2 versions']}, |
| 41 | shippedProposals: true, |
| 42 | }, |
| 43 | ]; |
| 44 | const presetTypescript = [ |
| 45 | '@babel/preset-typescript', |
| 46 | {jsxPragma: 'Preact', jsxPragmaFrag: 'Preact.Fragment'}, |
| 47 | ]; |
| 48 | const replacePlugin = getReplacePlugin(); |
| 49 | const replaceGlobalsPlugin = getReplaceGlobalsPlugin(); |
| 50 | const testPlugins = [ |
| 51 | getImportResolverPlugin(), |
| 52 | argv.coverage ? instanbulPlugin : null, |
| 53 | './build-system/babel-plugins/babel-plugin-amp-story-supported-languages', |
| 54 | replacePlugin, |
| 55 | replaceGlobalsPlugin, |
| 56 | './build-system/babel-plugins/babel-plugin-jsx-style-object', |
| 57 | './build-system/babel-plugins/babel-plugin-mangle-object-values', |
| 58 | './build-system/babel-plugins/babel-plugin-imported-helpers', |
| 59 | './build-system/babel-plugins/babel-plugin-transform-json-import', |
| 60 | './build-system/babel-plugins/babel-plugin-transform-json-configuration', |
| 61 | './build-system/babel-plugins/babel-plugin-transform-jss', |
| 62 | './build-system/babel-plugins/babel-plugin-transform-promise-resolve', |
| 63 | './build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace', |
| 64 | reactJsxPlugin, |
| 65 | ].filter(Boolean); |
| 66 | const testPresets = [presetTypescript, presetEnv]; |
| 67 | return { |
| 68 | compact: false, |
| 69 | plugins: testPlugins, |
nothing calls this directly
no test coverage detected