From c5cd5be36a81af2040461359ae5fd8d5028d00a8 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Thu, 17 Oct 2024 15:59:50 +0800 Subject: [PATCH] Fix test:vite-ci script (#12246) --- package.json | 6 +----- packages/astro/package.json | 2 +- patches/fs-fixture@2.4.0.patch | 24 ------------------------ pnpm-lock.yaml | 15 +++++---------- 4 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 patches/fs-fixture@2.4.0.patch diff --git a/package.json b/package.json index 683384edf3be..06a4c5188c5d 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,11 @@ "test:match": "cd packages/astro && pnpm run test:match", "test:unit": "cd packages/astro && pnpm run test:unit", "test:types": "cd packages/astro && pnpm run test:types", - "test:unit:match": "cd packages/astro && pnpm run test:unit:match", "test:smoke": "pnpm test:smoke:example && pnpm test:smoke:docs", "test:smoke:example": "turbo run build --concurrency=100% --filter=\"@example/*\"", "test:smoke:docs": "turbo run build --filter=docs", "test:check-examples": "node ./scripts/smoke/check.js", - "test:vite-ci": "cd packages/astro && pnpm run test:node", + "test:vite-ci": "cd packages/astro && pnpm run test:unit && pnpm run test:integration", "test:e2e": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e", "test:e2e:match": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e:match", "test:e2e:hosts": "turbo run test:hosted", @@ -87,9 +86,6 @@ "allowAny": [ "astro" ] - }, - "patchedDependencies": { - "fs-fixture@2.4.0": "patches/fs-fixture@2.4.0.patch" } } } diff --git a/packages/astro/package.json b/packages/astro/package.json index 7f6e52a3049c..0cf43e4753f4 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -211,7 +211,7 @@ "eol": "^0.10.0", "execa": "^8.0.1", "expect-type": "^1.1.0", - "fs-fixture": "^2.4.0", + "fs-fixture": "^2.5.0", "mdast-util-mdx": "^3.0.0", "mdast-util-mdx-jsx": "^3.1.3", "node-mocks-http": "^1.16.1", diff --git a/patches/fs-fixture@2.4.0.patch b/patches/fs-fixture@2.4.0.patch deleted file mode 100644 index 1ec3a3c4db07..000000000000 --- a/patches/fs-fixture@2.4.0.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/dist/index.d.mts b/dist/index.d.mts -index be5b88e034211892ba079c3c5c5c6f5d5f767cd4..55dcc0e99c66719d5fa68d4713b02c1919deae19 100644 ---- a/dist/index.d.mts -+++ b/dist/index.d.mts -@@ -61,6 +61,10 @@ type Api = ApiBase & { - type FileTree = { - [path: string]: string | FileTree | ((api: Api) => string | Symlink); - }; --declare const createFixture: (source?: string | FileTree) => Promise; -+type CreateFixtureOptions = { -+ // An absolute path to a different directory than `os.tmpdir()` -+ tempDir?: string -+} -+declare const createFixture: (source?: string | FileTree, opts?: CreateFixtureOptions) => Promise; - --export { type FileTree, FsFixture, createFixture }; -+export { type FileTree, FsFixture, CreateFixtureOptions, createFixture }; -diff --git a/dist/index.mjs b/dist/index.mjs -index cd6cab3beebf3f38fe4f1e2a9c58aff2b87258f7..ad24d852a357fd582f9e83ac20cb73bfbcb9bfc0 100755 ---- a/dist/index.mjs -+++ b/dist/index.mjs -@@ -1 +1 @@ --import s from"fs/promises";import o from"path";import y from"fs";import m from"os";typeof Symbol.asyncDispose!="symbol"&&Object.defineProperty(Symbol,"asyncDispose",{configurable:!1,enumerable:!1,writable:!1,value:Symbol.for("asyncDispose")});class w{path;constructor(t){this.path=t}getPath(...t){return o.join(this.path,...t)}exists(t=""){return s.access(this.getPath(t)).then(()=>!0,()=>!1)}rm(t=""){return s.rm(this.getPath(t),{recursive:!0,force:!0})}writeFile(t,r){return s.writeFile(this.getPath(t),r)}writeJson(t,r){return this.writeFile(t,JSON.stringify(r,null,2))}readFile(t,r){return s.readFile(this.getPath(t),r)}async[Symbol.asyncDispose](){await this.rm()}}const g=y.realpathSync(m.tmpdir()),b=`fs-fixture-${Date.now()}`;let l=0;const P=()=>(l+=1,l);class h{target;type;path;constructor(t,r){this.target=t,this.type=r}}const u=(i,t,r)=>{const e=[];for(const n in i){if(!Object.hasOwn(i,n))continue;const c=o.join(t,n);let a=i[n];if(typeof a=="function"){const f=Object.assign(Object.create(r),{filePath:c}),p=a(f);if(p instanceof h){p.path=c,e.push(p);continue}else a=p}typeof a=="string"?e.push({path:c,content:a}):e.push(...u(a,c,r))}return e},d=async i=>{const t=o.join(g,`${b}-${P()}/`);if(await s.mkdir(t,{recursive:!0}),i){if(typeof i=="string")await s.cp(i,t,{recursive:!0});else if(typeof i=="object"){const r={fixturePath:t,getPath:(...e)=>o.join(t,...e),symlink:(e,n)=>new h(e,n)};await Promise.all(u(i,t,r).map(async e=>{await s.mkdir(o.dirname(e.path),{recursive:!0}),e instanceof h?await s.symlink(e.target,e.path,e.type):await s.writeFile(e.path,e.content)}))}}return new w(t)};export{d as createFixture}; -+import s from"fs/promises";import o from"path";import y from"fs";import m from"os";typeof Symbol.asyncDispose!="symbol"&&Object.defineProperty(Symbol,"asyncDispose",{configurable:!1,enumerable:!1,writable:!1,value:Symbol.for("asyncDispose")});class w{path;constructor(t){this.path=t}getPath(...t){return o.join(this.path,...t)}exists(t=""){return s.access(this.getPath(t)).then(()=>!0,()=>!1)}rm(t=""){return s.rm(this.getPath(t),{recursive:!0,force:!0})}writeFile(t,r){return s.writeFile(this.getPath(t),r)}writeJson(t,r){return this.writeFile(t,JSON.stringify(r,null,2))}readFile(t,r){return s.readFile(this.getPath(t),r)}async[Symbol.asyncDispose](){await this.rm()}}const g=y.realpathSync(m.tmpdir()),b=`fs-fixture-${Date.now()}`;let l=0;const P=()=>(l+=1,l);class h{target;type;path;constructor(t,r){this.target=t,this.type=r}}const u=(i,t,r)=>{const e=[];for(const n in i){if(!Object.hasOwn(i,n))continue;const c=o.join(t,n);let a=i[n];if(typeof a=="function"){const f=Object.assign(Object.create(r),{filePath:c}),p=a(f);if(p instanceof h){p.path=c,e.push(p);continue}else a=p}typeof a=="string"?e.push({path:c,content:a}):e.push(...u(a,c,r))}return e},d=async (i, opts)=>{const t=o.join(opts?.tempDir ?? g,`${b}-${P()}/`);if(await s.mkdir(t,{recursive:!0}),i){if(typeof i=="string")await s.cp(i,t,{recursive:!0});else if(typeof i=="object"){const r={fixturePath:t,getPath:(...e)=>o.join(t,...e),symlink:(e,n)=>new h(e,n)};await Promise.all(u(i,t,r).map(async e=>{await s.mkdir(o.dirname(e.path),{recursive:!0}),e instanceof h?await s.symlink(e.target,e.path,e.type):await s.writeFile(e.path,e.content)}))}}return new w(t)};export{d as createFixture}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9fab03a8312..7006b7f97e21 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,11 +4,6 @@ settings: autoInstallPeers: false excludeLinksFromLockfile: false -patchedDependencies: - fs-fixture@2.4.0: - hash: hvkuaks2ic76pdflr3iifgi4ku - path: patches/fs-fixture@2.4.0.patch - importers: .: @@ -709,8 +704,8 @@ importers: specifier: ^1.1.0 version: 1.1.0 fs-fixture: - specifier: ^2.4.0 - version: 2.4.0(patch_hash=hvkuaks2ic76pdflr3iifgi4ku) + specifier: ^2.5.0 + version: 2.5.0 mdast-util-mdx: specifier: ^3.0.0 version: 3.0.0 @@ -8264,8 +8259,8 @@ packages: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} - fs-fixture@2.4.0: - resolution: {integrity: sha512-aFoTWGj288IEOdXBeesdcbdMvRtExbqpOp1SCjE3nRdlT7vBBCD6bf76C9FCq8/6pIPSo56P7+HeT9zT/n8rMA==} + fs-fixture@2.5.0: + resolution: {integrity: sha512-AzCSCaChZORdNcSa9w9IBnGWhDP2Bv/lOso0P9mAl5nJw2s7pjSEoDaHtzZ9VGIHQlSXR2fuTPO7ln1dM4HTNQ==} engines: {node: '>=18.0.0'} fsevents@2.3.2: @@ -13791,7 +13786,7 @@ snapshots: jsonfile: 4.0.0 universalify: 0.1.2 - fs-fixture@2.4.0(patch_hash=hvkuaks2ic76pdflr3iifgi4ku): {} + fs-fixture@2.5.0: {} fsevents@2.3.2: optional: true