Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions packages/@sanity/pkg-utils/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import path from 'node:path'
import {describe, expect, test} from 'vitest'
import {spawnProject} from './env/spawnProject'

// @TODO make these test suites work on Windows
const isWindows = process.platform === 'win32'

test.skipIf(isWindows)('should build `js` package', async () => {
test('should build `js` package', async () => {
const project = await spawnProject('js')

await project.install()
Expand All @@ -18,7 +15,7 @@ test.skipIf(isWindows)('should build `js` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `browser-bundle` package', async () => {
test('should build `browser-bundle` package', async () => {
const project = await spawnProject('browser-bundle')

await project.install()
Expand All @@ -37,7 +34,7 @@ test.skipIf(isWindows)('should build `browser-bundle` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `dummy-module` package', async () => {
test('should build `dummy-module` package', async () => {
const project = await spawnProject('dummy-module')

await project.install()
Expand Down Expand Up @@ -73,7 +70,7 @@ test.skipIf(isWindows)('should build `dummy-module` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `custom-dist` package', async () => {
test('should build `custom-dist` package', async () => {
const project = await spawnProject('custom-dist')

await project.install()
Expand All @@ -91,7 +88,7 @@ test.skipIf(isWindows)('should build `custom-dist` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `multi-export` package', async () => {
test('should build `multi-export` package', async () => {
const project = await spawnProject('multi-export')

await project.install()
Expand All @@ -117,7 +114,7 @@ test.skipIf(isWindows)('should build `multi-export` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `ts` package', async () => {
test('should build `ts` package', async () => {
const project = await spawnProject('ts')

await project.install()
Expand All @@ -131,7 +128,7 @@ test.skipIf(isWindows)('should build `ts` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `ts-without-extract` package', async () => {
test('should build `ts-without-extract` package', async () => {
const project = await spawnProject('ts-without-extract')

await project.install()
Expand All @@ -145,7 +142,7 @@ test.skipIf(isWindows)('should build `ts-without-extract` package', async () =>
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown-without-extract` package', async () => {
test('should build `ts-rolldown-without-extract` package', async () => {
const project = await spawnProject('ts-rolldown-without-extract')

await project.install()
Expand All @@ -163,7 +160,7 @@ test.skipIf(isWindows)('should build `ts-rolldown-without-extract` package', asy
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown-bundle-dev-dependency` package', async () => {
test('should build `ts-rolldown-bundle-dev-dependency` package', async () => {
const project = await spawnProject('ts-rolldown-bundle-dev-dependency')

await project.install()
Expand Down Expand Up @@ -218,7 +215,7 @@ test.skipIf(isWindows)('should build `ts-rolldown-bundle-dev-dependency` package
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown-bundle-peer-dependency` package', async () => {
test('should build `ts-rolldown-bundle-peer-dependency` package', async () => {
const project = await spawnProject('ts-rolldown-bundle-peer-dependency')

await project.install()
Expand Down Expand Up @@ -273,7 +270,7 @@ test.skipIf(isWindows)('should build `ts-rolldown-bundle-peer-dependency` packag
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown-bundle-prod-dependency` package', async () => {
test('should build `ts-rolldown-bundle-prod-dependency` package', async () => {
const project = await spawnProject('ts-rolldown-bundle-prod-dependency')

await project.install()
Expand Down Expand Up @@ -329,7 +326,7 @@ test.skipIf(isWindows)('should build `ts-rolldown-bundle-prod-dependency` packag
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown-inline-types-external-js` package', async () => {
test('should build `ts-rolldown-inline-types-external-js` package', async () => {
const project = await spawnProject('ts-rolldown-inline-types-external-js')

await project.install()
Expand Down Expand Up @@ -386,7 +383,7 @@ test.skipIf(isWindows)('should build `ts-rolldown-inline-types-external-js` pack
await project.remove()
})

test.skipIf(isWindows)('should build `ts-rolldown` package', async () => {
test('should build `ts-rolldown` package', async () => {
const project = await spawnProject('ts-rolldown')

await project.install()
Expand Down Expand Up @@ -421,7 +418,7 @@ test.skipIf(isWindows)('should build `ts-rolldown` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `tsgo` package', async () => {
test('should build `tsgo` package', async () => {
const project = await spawnProject('tsgo')

await project.install()
Expand All @@ -439,7 +436,7 @@ test.skipIf(isWindows)('should build `tsgo` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `ts-node16` package', async () => {
test('should build `ts-node16` package', async () => {
const project = await spawnProject('ts-node16')

await project.install()
Expand All @@ -453,7 +450,7 @@ test.skipIf(isWindows)('should build `ts-node16` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `ts-bundler` package', async () => {
test('should build `ts-bundler` package', async () => {
const project = await spawnProject('ts-bundler')

await project.install()
Expand All @@ -467,7 +464,7 @@ test.skipIf(isWindows)('should build `ts-bundler` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `react-18` package', async () => {
test('should build `react-18` package', async () => {
const project = await spawnProject('react-18')

await project.install()
Expand All @@ -483,7 +480,7 @@ test.skipIf(isWindows)('should build `react-18` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `react-19` package', async () => {
test('should build `react-19` package', async () => {
const project = await spawnProject('react-19')

await project.install()
Expand All @@ -499,7 +496,7 @@ test.skipIf(isWindows)('should build `react-19` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `css-export` package', async () => {
test('should build `css-export` package', async () => {
const project = await spawnProject('css-export')

await project.install()
Expand All @@ -512,7 +509,7 @@ test.skipIf(isWindows)('should build `css-export` package', async () => {
await project.remove()
})

test.skipIf(isWindows)('should build `sanity-plugin-with-styled-components` package', async () => {
test('should build `sanity-plugin-with-styled-components` package', async () => {
const project = await spawnProject('sanity-plugin-with-styled-components')

await project.install()
Expand Down Expand Up @@ -541,7 +538,7 @@ test.skipIf(isWindows)('should build `sanity-plugin-with-styled-components` pack
await project.remove()
})

test.skipIf(isWindows)('should build `sanity-plugin-with-vanilla-extract` package', async () => {
test('should build `sanity-plugin-with-vanilla-extract` package', async () => {
const project = await spawnProject('sanity-plugin-with-vanilla-extract')

await project.install()
Expand Down Expand Up @@ -604,7 +601,7 @@ describe.skip('runtime: next.js', () => {
})
})

test.skipIf(isWindows)('should build with `--quiet` flag suppressing output', async () => {
test('should build with `--quiet` flag suppressing output', async () => {
const project = await spawnProject('ts')

await project.install()
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/pkg-utils/test/env/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function runExec(cmd: string) {
try {
const env = {
...process.env,
PATH: `${process.env['PATH']}:${path.resolve(__dirname, '../../bin')}`,
PATH: `${process.env['PATH']}${path.delimiter}${path.resolve(__dirname, '../../bin')}`,
}
const tmpPath = path.resolve(__dirname, '../..')

Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/pkg-utils/test/env/spawnProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function spawnProject(name: string): Promise<{
try {
const env = {
...process.env,
PATH: `${process.env['PATH']}:${path.resolve(__dirname, '../../bin')}`,
PATH: `${process.env['PATH']}${path.delimiter}${path.resolve(__dirname, '../../bin')}`,
}

return exec(cmd, {cwd: tmpPath, env})
Expand Down
4 changes: 1 addition & 3 deletions packages/@sanity/pkg-utils/test/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {expect, test} from 'vitest'
import {spawnProject} from './env/spawnProject'

const isWindows = process.platform === 'win32'

test.skipIf(isWindows)('should build `node-api` package', async () => {
test('should build `node-api` package', async () => {
const project = await spawnProject('node-api')

await project.install()
Expand Down