|
| 1 | +import getPrettier from '../../config/get-prettier.js'; |
| 2 | +import getPlugins from '../../config/get-plugins.js'; |
| 3 | + |
| 4 | +const prettier = await getPrettier(); |
| 5 | +const plugins = await getPlugins(); |
| 6 | + |
| 7 | +test('Prettier should report the supported options when multiple plugins are given', async () => { |
| 8 | + const supportedOptionsNames = ( |
| 9 | + await prettier.getSupportInfo({ plugins }) |
| 10 | + ).options.map((option) => option.name); |
| 11 | + |
| 12 | + expect(supportedOptionsNames).toContain('printWidth'); |
| 13 | + expect(supportedOptionsNames).toContain('tabWidth'); |
| 14 | + expect(supportedOptionsNames).toContain('useTabs'); |
| 15 | + expect(supportedOptionsNames).toContain('bracketSpacing'); |
| 16 | + expect(supportedOptionsNames).toContain('singleQuote'); |
| 17 | + expect(supportedOptionsNames).toContain('experimentalTernaries'); |
| 18 | + expect(supportedOptionsNames).toContain('experimentalOperatorPosition'); |
| 19 | + expect(supportedOptionsNames).toContain('compiler'); |
| 20 | +}); |
| 21 | + |
| 22 | +test('Prettier should report the supported options when a single plugin is given', async () => { |
| 23 | + const solidityPlugin = plugins[plugins.length - 1]; |
| 24 | + const supportedOptionsNames = ( |
| 25 | + await prettier.getSupportInfo({ |
| 26 | + plugins: [solidityPlugin] |
| 27 | + }) |
| 28 | + ).options.map((option) => option.name); |
| 29 | + |
| 30 | + expect(supportedOptionsNames).toContain('printWidth'); |
| 31 | + expect(supportedOptionsNames).toContain('tabWidth'); |
| 32 | + expect(supportedOptionsNames).toContain('useTabs'); |
| 33 | + expect(supportedOptionsNames).toContain('bracketSpacing'); |
| 34 | + expect(supportedOptionsNames).toContain('singleQuote'); |
| 35 | + expect(supportedOptionsNames).toContain('experimentalTernaries'); |
| 36 | + expect(supportedOptionsNames).toContain('experimentalOperatorPosition'); |
| 37 | + expect(supportedOptionsNames).toContain('compiler'); |
| 38 | +}); |
0 commit comments