|
| 1 | +import { |
| 2 | + checkFilesExist, |
| 3 | + ensureNxProject, |
| 4 | + readJson, |
| 5 | + runNxCommandAsync, |
| 6 | + uniq, |
| 7 | +} from '@nrwl/nx-plugin/testing'; |
| 8 | +describe('plugin-tools e2e', () => { |
| 9 | + it('should create plugin-tools', async () => { |
| 10 | + const plugin = uniq('plugin-tools'); |
| 11 | + ensureNxProject('@nativescript/plugin-tools', 'dist/packages/plugin-tools'); |
| 12 | + await runNxCommandAsync( |
| 13 | + `generate @nativescript/plugin-tools:plugin-tools ${plugin}` |
| 14 | + ); |
| 15 | + |
| 16 | + const result = await runNxCommandAsync(`build ${plugin}`); |
| 17 | + expect(result.stdout).toContain('Executor ran'); |
| 18 | + }, 120000); |
| 19 | + |
| 20 | + describe('--directory', () => { |
| 21 | + it('should create src in the specified directory', async () => { |
| 22 | + const plugin = uniq('plugin-tools'); |
| 23 | + ensureNxProject( |
| 24 | + '@nativescript/plugin-tools', |
| 25 | + 'dist/packages/plugin-tools' |
| 26 | + ); |
| 27 | + await runNxCommandAsync( |
| 28 | + `generate @nativescript/plugin-tools:plugin-tools ${plugin} --directory subdir` |
| 29 | + ); |
| 30 | + expect(() => |
| 31 | + checkFilesExist(`libs/subdir/${plugin}/src/index.ts`) |
| 32 | + ).not.toThrow(); |
| 33 | + }, 120000); |
| 34 | + }); |
| 35 | + |
| 36 | + describe('--tags', () => { |
| 37 | + it('should add tags to nx.json', async () => { |
| 38 | + const plugin = uniq('plugin-tools'); |
| 39 | + ensureNxProject( |
| 40 | + '@nativescript/plugin-tools', |
| 41 | + 'dist/packages/plugin-tools' |
| 42 | + ); |
| 43 | + await runNxCommandAsync( |
| 44 | + `generate @nativescript/plugin-tools:plugin-tools ${plugin} --tags e2etag,e2ePackage` |
| 45 | + ); |
| 46 | + const nxJson = readJson('nx.json'); |
| 47 | + expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']); |
| 48 | + }, 120000); |
| 49 | + }); |
| 50 | +}); |
0 commit comments