* Entry point for `amp babel-plugin-tests`. Runs the jest-based tests for * AMP's custom babel plugins. * @return {Promise }
()
| 9 | * @return {Promise<void>} |
| 10 | */ |
| 11 | async function babelPluginTests() { |
| 12 | const projects = ['./build-system/babel-plugins']; |
| 13 | const options = { |
| 14 | automock: false, |
| 15 | coveragePathIgnorePatterns: ['/node_modules/'], |
| 16 | detectOpenHandles: true, |
| 17 | modulePathIgnorePatterns: ['/test/fixtures/', '<rootDir>/build/'], |
| 18 | reporters: [ |
| 19 | isCiBuild() ? 'jest-silent-reporter' : 'jest-progress-bar-reporter', |
| 20 | ], |
| 21 | setupFiles: ['./build-system/babel-plugins/testSetupFile.js'], |
| 22 | testEnvironment: 'node', |
| 23 | testPathIgnorePatterns: ['/node_modules/'], |
| 24 | testRegex: '/babel-plugins/[^/]+/test/.+\\.m?js$', |
| 25 | transformIgnorePatterns: ['/node_modules/'], |
| 26 | }; |
| 27 | |
| 28 | // The `jest.runCLI` command is undocumented. See the types file for object shape: |
| 29 | // https://github.com/facebook/jest/blob/bd76829f66c5c0f3c6907b80010f19893cb0fc8c/packages/jest-test-result/src/types.ts#L74-L91. |
| 30 | const aggregatedResults = await jest.runCLI( |
| 31 | // TODO(#23582) the typing for jest.Config.Argv seems to be a little off. |
| 32 | /** @type {*} */ (options), |
| 33 | projects |
| 34 | ); |
| 35 | if (!aggregatedResults.results.success) { |
| 36 | throw new Error('See the logs above for details.'); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | module.exports = { |
| 41 | babelPluginTests, |
nothing calls this directly
no test coverage detected