From 024b1896c6fc4db2e290d3f52e626e4667fe2c1e Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Tue, 1 Aug 2023 13:55:25 +0200 Subject: [PATCH] Small tweaks to the compat tests Note: These are cherry-picked from the internal docker branch. --- compat-tests/fixtures/cra/package/package.json | 11 +++++++++-- compat-tests/fixtures/react18/package/package.json | 3 +++ compat-tests/fixtures/vite2/package/package.json | 2 +- compat-tests/fixtures/vite2/package/tsconfig.json | 2 +- compat-tests/scripts/scripts.mjs | 12 ++++++++---- jest.compat-tests.config.js | 1 + 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/compat-tests/fixtures/cra/package/package.json b/compat-tests/fixtures/cra/package/package.json index f59d7ae..934354c 100644 --- a/compat-tests/fixtures/cra/package/package.json +++ b/compat-tests/fixtures/cra/package/package.json @@ -29,10 +29,17 @@ "web-vitals": "^1.0.1" }, "eslintConfig": { - "extends": ["react-app", "react-app/jest"] + "extends": [ + "react-app", + "react-app/jest" + ] }, "browserslist": { - "production": [">0.2%", "not dead", "not op_mini all"], + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], "development": [ "last 1 chrome version", "last 1 firefox version", diff --git a/compat-tests/fixtures/react18/package/package.json b/compat-tests/fixtures/react18/package/package.json index 86f5a75..6e9c060 100644 --- a/compat-tests/fixtures/react18/package/package.json +++ b/compat-tests/fixtures/react18/package/package.json @@ -15,5 +15,8 @@ "react": "^18.1.0", "react-dom": "^18.1.0", "serve": "14.2.0" + }, + "devDependencies": { + "buffer": "^5.7.1" } } diff --git a/compat-tests/fixtures/vite2/package/package.json b/compat-tests/fixtures/vite2/package/package.json index f7b3f66..f0e738d 100644 --- a/compat-tests/fixtures/vite2/package/package.json +++ b/compat-tests/fixtures/vite2/package/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "dev": "vite", - "build": "tsc && vite build", + "build": "vite build", "preview": "vite preview" }, "dependencies": { diff --git a/compat-tests/fixtures/vite2/package/tsconfig.json b/compat-tests/fixtures/vite2/package/tsconfig.json index 3d0a51a..bc138a4 100644 --- a/compat-tests/fixtures/vite2/package/tsconfig.json +++ b/compat-tests/fixtures/vite2/package/tsconfig.json @@ -17,5 +17,5 @@ "jsx": "react-jsx" }, "include": ["src"], - "references": [{ "path": "./tsconfig.node.json" }] + "references": [{"path": "./tsconfig.node.json"}] } diff --git a/compat-tests/scripts/scripts.mjs b/compat-tests/scripts/scripts.mjs index 9095909..cfe7089 100644 --- a/compat-tests/scripts/scripts.mjs +++ b/compat-tests/scripts/scripts.mjs @@ -50,8 +50,10 @@ process.env.NPM_CONFIG_REGISTRY = config.VERDACCIO_URL const tempVersion = '0.0.1-COMPAT.' + - // a random integer between 1 and 50000 - (Math.floor(Math.random() * 50000) + 1).toString() + (typeof argv['version'] === 'number' + ? argv['version'].toString() + : // a random integer between 1 and 50000 + (Math.floor(Math.random() * 50000) + 1).toString()) /** * This script starts verdaccio and publishes all the packages in the monorepo to it, then @@ -65,7 +67,9 @@ export async function installFixtures() { return false }) - console.log('Using temporary version: ' + tempVersion) + console.log( + `Using temporary version: ${tempVersion} . Use --version=[NUMBER] to change.`, + ) console.log('Patching package.json files in ./test-*') const restoreTestPackageJsons = await patchTestPackageJsons() @@ -348,7 +352,7 @@ export async function getCompatibilityTestSetups() { */ export async function clean() { const toDelete = await globby( - './fixtures/*/package/(node_modules|yarn.lock|package-lock.json)', + './fixtures/*/package/(node_modules|yarn.lock|package-lock.json|.parcel-cache)', { cwd: config.PATH_TO_COMPAT_TESTS_ROOT, // node_modules et al are gitignored, but we still want to clean them diff --git a/jest.compat-tests.config.js b/jest.compat-tests.config.js index 7b5ff69..f06dc8e 100644 --- a/jest.compat-tests.config.js +++ b/jest.compat-tests.config.js @@ -5,6 +5,7 @@ module.exports = { '/compat-tests/*.compat-test.ts', ], moduleNameMapper: {}, + modulePathIgnorePatterns: ['/compat-tests/verdaccio'], // setupFiles: ['./theatre/shared/src/setupTestEnv.ts'], automock: false, // transform: {