(argv)
| 82 | } |
| 83 | |
| 84 | function run(argv) { |
| 85 | if (argv.length !== 1) { |
| 86 | console.error( |
| 87 | [ |
| 88 | "You must provide the path to a flow tests directory to sync from!", |
| 89 | "Example: node scripts/sync-flow-tests.cjs ../flow/tests/", |
| 90 | ].join("\n"), |
| 91 | ); |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | const syncDir = argv[0]; |
| 96 | let skipped; |
| 97 | |
| 98 | try { |
| 99 | skipped = syncTests(syncDir); |
| 100 | } catch (error) { |
| 101 | console.error(`Failed to sync.\n${error}`); |
| 102 | return 1; |
| 103 | } |
| 104 | |
| 105 | if (skipped.length > 0) { |
| 106 | console.log( |
| 107 | [ |
| 108 | "Some files were skipped due to syntax errors.", |
| 109 | "This is expected since flow tests for handling invalid code,", |
| 110 | "but that's not interesting for Prettier's tests.", |
| 111 | "This is the skipped stuff:", |
| 112 | "", |
| 113 | ...skipped, |
| 114 | "", |
| 115 | ].join("\n"), |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | console.log( |
| 120 | [ |
| 121 | "Done syncing! Now you need to:", |
| 122 | "", |
| 123 | `1. Optional: Adjust some ${SPEC_FILE_NAME} files.`, |
| 124 | "2. Run `jest -u` to create snapshots.", |
| 125 | "3. Run `git diff` to check how tests and snapshots have changed", |
| 126 | "4. Take a look at new snapshots to see if they're OK.", |
| 127 | ].join("\n"), |
| 128 | ); |
| 129 | |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | if (require.main === module) { |
| 134 | const exitCode = run(process.argv.slice(2)); |
no test coverage detected