Repository: puppeteer/puppeteer
File: test/src/launcher.spec.ts (TypeScript)

Code before:
        const {context, close} = await launch({
          defaultViewport: null,
        });
        try {
          const page = await context.newPage();
          expect(page.viewport()).toBe(null);
        } finally {
          await close();
        }
      });
      it('should take fullPage screenshots when defaultViewport is null', async () => {
        const {server, context, close} = await launch({
          defaultViewport: null,
        });
        try {
          const page = await context.newPage();
          await page.goto(server.PREFIX + '/grid.html');
          const screenshot = await page.screenshot({
            fullPage: true,
          });
          expect(screenshot).toBeInstanceOf(Buffer);
        } finally {
          await close();
        }
      });
      it('should restore to original window size after taking fullPage screenshots when defaultViewport is null', async () => {
        const {server, context, close} = await launch({
          defaultViewport: null,
        });
        try {
          const page = await context.newPage();
          const originalSize = await page.evaluate(() => {
            return {width: window.innerWidth, height: window.innerHeight};
          });
          await page.goto(server.PREFIX + '/scrollbar.html');
          await page.screenshot({
            fullPage: true,
            captureBeyondViewport: false,
          });
          const size = await page.evaluate(() => {
            return {width: window.innerWidth, height: window.innerHeight};
          });
          expect(page.viewport()).toBe(null);
          expect(size.width).toBe(originalSize.width);
          expect(size.height).toBe(originalSize.height);
        } finally {
          await close();
        }
      });
      it('should set the debugging port', async () => {
        const {browser, close} = await launch({

Review comment (suggestion):
```suggestion
      it('should restore to original viewport size after taking fullPage screenshots when defaultViewport is null', async () => {
```

Code after:
        const {context, close} = await launch({
          defaultViewport: null,
        });
        try {
          const page = await context.newPage();
          expect(page.viewport()).toBe(null);
        } finally {
          await close();
        }
      });
      it('should set the debugging port', async () => {
        const {browser, close} = await launch({
          defaultViewport: null,
          debuggingPort: 9999,
        });
        try {
          const url = new URL(browser.wsEndpoint());
          expect(url.port).toBe('9999');
        } finally {
          await close();
        }
      });
      it('should not allow setting debuggingPort and pipe', async () => {
        const options = {
          defaultViewport: null,
          debuggingPort: 9999,
          pipe: true,
        };
        let error!: Error;
        await launch(options).catch(error_ => {
          return (error = error_);
        });
        expect(error.message).toContain('either pipe or debugging port');
      });

      it('throws an error if executable path is not valid with pipe=true', async () => {
        const options = {
          executablePath: '/tmp/does-not-exist',
          pipe: true,
        };
        let error!: Error;
        await launch(options).catch(error_ => {
          return (error = error_);
        });
        expect(error.message).toContain(
          'Browser was not found at the configured executablePath (/tmp/does-not-exist)'
        );
      });
    });

    describe('Puppeteer.launch', function () {