diff --git a/.gitignore b/.gitignore index f0dc23c3..1b6fdd7c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,5 @@ yarn.lock /lib test/coverage.json temp/ -puppeteer-core-*.tgz new-docs/ -puppeteer-*.tgz +puppeteer.tgz diff --git a/scripts/test-ts-definition-files.ts b/scripts/test-ts-definition-files.ts index d9f15133..3ee8a331 100644 --- a/scripts/test-ts-definition-files.ts +++ b/scripts/test-ts-definition-files.ts @@ -1,6 +1,7 @@ import { spawnSync } from 'child_process'; import { version } from '../package.json'; import path from 'path'; +import fs from 'fs'; const PROJECT_FOLDERS_ROOT = 'test-ts-types'; const EXPECTED_ERRORS = new Map([ [ @@ -71,13 +72,23 @@ function packPuppeteer() { const result = spawnSync('npm', ['pack'], { encoding: 'utf-8', }); - if (result.status !== 0) { console.log('Failed to pack Puppeteer', result.stderr); process.exit(1); } - return `puppeteer-${version}.tgz`; + // Move from puppeteer-X.Y.Z.tgz to puppeteer.tgz so we don't have to update + // it when versions change. + const moveResult = spawnSync('mv', [ + `puppeteer-${version}.tgz`, + 'puppeteer.tgz', + ]); + if (moveResult.status !== 0) { + console.log('Failed to rename Puppeteer tar', moveResult.stderr); + process.exit(1); + } + + return `puppeteer.tgz`; } const tar = packPuppeteer(); @@ -112,12 +123,22 @@ function testProject(folder: string) { ); const tarLocation = path.relative(projectLocation, tarPath); - console.log('===> Installing Puppeteer from tar file'); + console.log('===> Clearing left over node_modules to ensure clean slate'); + try { + fs.rmdirSync(path.join(projectLocation, 'node_modules'), { + recursive: true, + }); + } catch (_error) { + // We don't care if this errors because if it did it's most likely because + // there was no node_modules folder, which is fine. + } + console.log('===> Installing Puppeteer from tar file', tarLocation); const { status, stderr, stdout } = spawnSync( 'npm', - ['install', '--no-package-lock', tarLocation], + ['install', tarLocation], { env: { + ...process.env, PUPPETEER_SKIP_DOWNLOAD: '1', }, cwd: projectLocation, diff --git a/test-ts-types/js-cjs-import-cjs-output/package.json b/test-ts-types/js-cjs-import-cjs-output/package.json index 3c0d055e..6141e954 100644 --- a/test-ts-types/js-cjs-import-cjs-output/package.json +++ b/test-ts-types/js-cjs-import-cjs-output/package.json @@ -7,6 +7,6 @@ "compile": "../../node_modules/.bin/tsc" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/js-cjs-import-esm-output/package.json b/test-ts-types/js-cjs-import-esm-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/js-cjs-import-esm-output/package.json +++ b/test-ts-types/js-cjs-import-esm-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/js-esm-import-cjs-output/package.json b/test-ts-types/js-esm-import-cjs-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/js-esm-import-cjs-output/package.json +++ b/test-ts-types/js-esm-import-cjs-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/js-esm-import-esm-output/package.json b/test-ts-types/js-esm-import-esm-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/js-esm-import-esm-output/package.json +++ b/test-ts-types/js-esm-import-esm-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/ts-cjs-import-cjs-output/package.json b/test-ts-types/ts-cjs-import-cjs-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/ts-cjs-import-cjs-output/package.json +++ b/test-ts-types/ts-cjs-import-cjs-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/ts-esm-import-cjs-output/package.json b/test-ts-types/ts-esm-import-cjs-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/ts-esm-import-cjs-output/package.json +++ b/test-ts-types/ts-esm-import-cjs-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } } diff --git a/test-ts-types/ts-esm-import-esm-output/package.json b/test-ts-types/ts-esm-import-esm-output/package.json index 27d6b18b..063237ea 100644 --- a/test-ts-types/ts-esm-import-esm-output/package.json +++ b/test-ts-types/ts-esm-import-esm-output/package.json @@ -10,6 +10,6 @@ "typescript": "^4.1.3" }, "dependencies": { - "puppeteer": "file:../../puppeteer-7.0.4-post.tgz" + "puppeteer": "file:../../puppeteer.tgz" } }