0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Fix test:vite-ci script (#12246)

This commit is contained in:
Bjorn Lu 2024-10-17 15:59:50 +08:00 committed by GitHub
parent 0bbf2fb526
commit c5cd5be36a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 40 deletions

View file

@ -25,12 +25,11 @@
"test:match": "cd packages/astro && pnpm run test:match", "test:match": "cd packages/astro && pnpm run test:match",
"test:unit": "cd packages/astro && pnpm run test:unit", "test:unit": "cd packages/astro && pnpm run test:unit",
"test:types": "cd packages/astro && pnpm run test:types", "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": "pnpm test:smoke:example && pnpm test:smoke:docs",
"test:smoke:example": "turbo run build --concurrency=100% --filter=\"@example/*\"", "test:smoke:example": "turbo run build --concurrency=100% --filter=\"@example/*\"",
"test:smoke:docs": "turbo run build --filter=docs", "test:smoke:docs": "turbo run build --filter=docs",
"test:check-examples": "node ./scripts/smoke/check.js", "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": "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:match": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e:match",
"test:e2e:hosts": "turbo run test:hosted", "test:e2e:hosts": "turbo run test:hosted",
@ -87,9 +86,6 @@
"allowAny": [ "allowAny": [
"astro" "astro"
] ]
},
"patchedDependencies": {
"fs-fixture@2.4.0": "patches/fs-fixture@2.4.0.patch"
} }
} }
} }

View file

@ -211,7 +211,7 @@
"eol": "^0.10.0", "eol": "^0.10.0",
"execa": "^8.0.1", "execa": "^8.0.1",
"expect-type": "^1.1.0", "expect-type": "^1.1.0",
"fs-fixture": "^2.4.0", "fs-fixture": "^2.5.0",
"mdast-util-mdx": "^3.0.0", "mdast-util-mdx": "^3.0.0",
"mdast-util-mdx-jsx": "^3.1.3", "mdast-util-mdx-jsx": "^3.1.3",
"node-mocks-http": "^1.16.1", "node-mocks-http": "^1.16.1",

View file

@ -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<FsFixture>;
+type CreateFixtureOptions = {
+ // An absolute path to a different directory than `os.tmpdir()`
+ tempDir?: string
+}
+declare const createFixture: (source?: string | FileTree, opts?: CreateFixtureOptions) => Promise<FsFixture>;
-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};

View file

@ -4,11 +4,6 @@ settings:
autoInstallPeers: false autoInstallPeers: false
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
patchedDependencies:
fs-fixture@2.4.0:
hash: hvkuaks2ic76pdflr3iifgi4ku
path: patches/fs-fixture@2.4.0.patch
importers: importers:
.: .:
@ -709,8 +704,8 @@ importers:
specifier: ^1.1.0 specifier: ^1.1.0
version: 1.1.0 version: 1.1.0
fs-fixture: fs-fixture:
specifier: ^2.4.0 specifier: ^2.5.0
version: 2.4.0(patch_hash=hvkuaks2ic76pdflr3iifgi4ku) version: 2.5.0
mdast-util-mdx: mdast-util-mdx:
specifier: ^3.0.0 specifier: ^3.0.0
version: 3.0.0 version: 3.0.0
@ -8264,8 +8259,8 @@ packages:
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==}
engines: {node: '>=6 <7 || >=8'} engines: {node: '>=6 <7 || >=8'}
fs-fixture@2.4.0: fs-fixture@2.5.0:
resolution: {integrity: sha512-aFoTWGj288IEOdXBeesdcbdMvRtExbqpOp1SCjE3nRdlT7vBBCD6bf76C9FCq8/6pIPSo56P7+HeT9zT/n8rMA==} resolution: {integrity: sha512-AzCSCaChZORdNcSa9w9IBnGWhDP2Bv/lOso0P9mAl5nJw2s7pjSEoDaHtzZ9VGIHQlSXR2fuTPO7ln1dM4HTNQ==}
engines: {node: '>=18.0.0'} engines: {node: '>=18.0.0'}
fsevents@2.3.2: fsevents@2.3.2:
@ -13791,7 +13786,7 @@ snapshots:
jsonfile: 4.0.0 jsonfile: 4.0.0
universalify: 0.1.2 universalify: 0.1.2
fs-fixture@2.4.0(patch_hash=hvkuaks2ic76pdflr3iifgi4ku): {} fs-fixture@2.5.0: {}
fsevents@2.3.2: fsevents@2.3.2:
optional: true optional: true