Skip to content

test: fix test failing in windows #1153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2024
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
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"generate": "langium generate && npx ts-node script/generate-plist.ts",
"watch": "concurrently \"langium generate --watch\" \"tsc --watch\"",
"lint": "eslint src --ext ts",
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json 'syntaxes/**/*' dist && pnpm pack dist --pack-destination '../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json 'syntaxes/**/*' dist && pnpm pack dist --pack-destination ../../../.build",
"prepublishOnly": "pnpm build"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/misc/redwood/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && pnpm pack dist --pack-destination '../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && pnpm pack dist --pack-destination ../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"prepublishOnly": "pnpm build"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && copyfiles -u 1 ./src/plugin.zmodel dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && copyfiles -u 1 ./src/plugin.zmodel dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
16 changes: 8 additions & 8 deletions packages/plugins/openapi/tests/openapi-restful.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import OpenAPIParser from '@readme/openapi-parser';
import { getLiteral, getObjectLiteral } from '@zenstackhq/sdk';
import { Model, Plugin, isPlugin } from '@zenstackhq/sdk/ast';
import { loadZModelAndDmmf } from '@zenstackhq/testtools';
import { loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import fs from 'fs';
import path from 'path';
import * as tmp from 'tmp';
Expand All @@ -16,7 +16,7 @@ describe('Open API Plugin RESTful Tests', () => {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}

Expand Down Expand Up @@ -114,7 +114,7 @@ model Bar {
it('options', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '3.0.0'
title = 'My Awesome API'
version = '1.0.0'
Expand Down Expand Up @@ -151,7 +151,7 @@ model User {
it('security schemes valid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' },
myBearer: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
Expand Down Expand Up @@ -198,7 +198,7 @@ model Post {
it('security model level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -230,7 +230,7 @@ model User {
it('security schemes invalid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'invalid', scheme: 'basic' }
}
Expand All @@ -251,7 +251,7 @@ model User {
it('ignored model used as relation', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}

model User {
Expand Down Expand Up @@ -284,7 +284,7 @@ model Post {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}

Expand Down
24 changes: 12 additions & 12 deletions packages/plugins/openapi/tests/openapi-rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import OpenAPIParser from '@readme/openapi-parser';
import { getLiteral, getObjectLiteral } from '@zenstackhq/sdk';
import { Model, Plugin, isPlugin } from '@zenstackhq/sdk/ast';
import { loadZModelAndDmmf } from '@zenstackhq/testtools';
import { loadZModelAndDmmf, normalizePath } from '@zenstackhq/testtools';
import fs from 'fs';
import path from 'path';
import * as tmp from 'tmp';
Expand All @@ -16,7 +16,7 @@ describe('Open API Plugin RPC Tests', () => {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}

Expand Down Expand Up @@ -127,7 +127,7 @@ model Bar {
it('options', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '3.0.0'
title = 'My Awesome API'
version = '1.0.0'
Expand Down Expand Up @@ -164,7 +164,7 @@ model User {
it('security schemes valid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' },
myBearer: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },
Expand Down Expand Up @@ -198,7 +198,7 @@ model User {
it('security schemes invalid', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'invalid', scheme: 'basic' }
}
Expand All @@ -219,7 +219,7 @@ model User {
it('security model level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -247,7 +247,7 @@ model User {
it('security operation level override', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand Down Expand Up @@ -280,7 +280,7 @@ model User {
it('security inferred', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
securitySchemes = {
myBasic: { type: 'http', scheme: 'basic' }
}
Expand All @@ -306,7 +306,7 @@ model User {
it('v3.1.0 fields', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
summary = 'awesome api'
}

Expand All @@ -330,7 +330,7 @@ model User {
it('ignored model used as relation', async () => {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}

model User {
Expand Down Expand Up @@ -362,7 +362,7 @@ model Post {
for (const specVersion of ['3.0.0', '3.1.0']) {
const { model, dmmf, modelFile } = await loadZModelAndDmmf(`
plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
specVersion = '${specVersion}'
}

Expand Down Expand Up @@ -408,7 +408,7 @@ generator js {
}

plugin openapi {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
}

enum role {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup.config.ts --watch\"",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/swr/tests/swr.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="@types/jest" />

import { loadSchema } from '@zenstackhq/testtools';
import { loadSchema, normalizePath } from '@zenstackhq/testtools';
import path from 'path';

describe('SWR Plugin Tests', () => {
Expand Down Expand Up @@ -50,7 +50,7 @@ model Foo {
await loadSchema(
`
plugin swr {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
}

Expand All @@ -60,7 +60,7 @@ ${sharedModel}
provider: 'postgresql',
pushDb: false,
extraDependencies: [
`${path.join(__dirname, '../dist')}`,
`${normalizePath(path.join(__dirname, '../dist'))}`,
'react@18.2.0',
'@types/react@18.2.0',
'swr@^2',
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tanstack-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && tsup-node --config ./tsup-v5.config.ts && node scripts/postbuild && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup.config.ts && tsup-node --config ./tsup-v5.config.ts && node scripts/postbuild && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup.config.ts --watch\" \"tsup-node --config ./tsup-v5.config.ts --watch\"",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
14 changes: 7 additions & 7 deletions packages/plugins/tanstack-query/tests/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="@types/jest" />

import { loadSchema } from '@zenstackhq/testtools';
import { loadSchema, normalizePath } from '@zenstackhq/testtools';
import path from 'path';

describe('Tanstack Query Plugin Tests', () => {
Expand Down Expand Up @@ -50,7 +50,7 @@ model Foo {
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'react'
}
Expand All @@ -71,7 +71,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'react'
version = 'v5'
Expand All @@ -93,7 +93,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'vue'
}
Expand All @@ -114,7 +114,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'vue'
version = 'v5'
Expand All @@ -136,7 +136,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'svelte'
}
Expand All @@ -157,7 +157,7 @@ ${sharedModel}
await loadSchema(
`
plugin tanstack {
provider = '${path.resolve(__dirname, '../dist')}'
provider = '${normalizePath(path.resolve(__dirname, '../dist'))}'
output = '$projectRoot/hooks'
target = 'svelte'
version = 'v5'
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"clean": "rimraf dist",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination '../../../../.build'",
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination ../../../../.build",
"watch": "tsc --watch",
"lint": "eslint src --ext ts",
"test": "jest",
Expand Down
Loading