test: missing test dir deps, update cpa create project suite
This commit is contained in:
@@ -77,23 +77,31 @@ describe('createProject', () => {
|
|||||||
expect(packageJson.name).toEqual(projectName)
|
expect(packageJson.name).toEqual(projectName)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('db adapters and bundlers', () => {
|
describe('db adapters', () => {
|
||||||
const templates = getValidTemplates()
|
const templates = getValidTemplates()
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['blank', 'mongodb', 'webpack'],
|
['blank-3.0', 'mongodb'],
|
||||||
['blank', 'postgres', 'webpack'],
|
['blank-3.0', 'postgres'],
|
||||||
['website', 'mongodb', 'webpack'],
|
|
||||||
['website', 'postgres', 'webpack'],
|
// TODO: Re-enable these once 3.0 is stable and templates updated
|
||||||
['ecommerce', 'mongodb', 'webpack'],
|
// ['website', 'mongodb'],
|
||||||
['ecommerce', 'postgres', 'webpack'],
|
// ['website', 'postgres'],
|
||||||
])('update config and deps: %s, %s, %s', async (templateName, db, bundler) => {
|
// ['ecommerce', 'mongodb'],
|
||||||
|
// ['ecommerce', 'postgres'],
|
||||||
|
])('update config and deps: %s, %s', async (templateName, db) => {
|
||||||
const projectName = 'starter-project'
|
const projectName = 'starter-project'
|
||||||
|
|
||||||
const template = templates.find((t) => t.name === templateName)
|
const template = templates.find((t) => t.name === templateName)
|
||||||
|
|
||||||
|
const cliArgs = {
|
||||||
|
...args,
|
||||||
|
'--db': db,
|
||||||
|
'--local-template': templateName,
|
||||||
|
} as CliArgs
|
||||||
|
|
||||||
await createProject({
|
await createProject({
|
||||||
cliArgs: args,
|
cliArgs,
|
||||||
projectName,
|
projectName,
|
||||||
projectDir,
|
projectDir,
|
||||||
template: template as ProjectTemplate,
|
template: template as ProjectTemplate,
|
||||||
@@ -114,7 +122,7 @@ describe('createProject', () => {
|
|||||||
Object.keys(packageJson.dependencies).filter((n) => n.startsWith('@payloadcms/db-')),
|
Object.keys(packageJson.dependencies).filter((n) => n.startsWith('@payloadcms/db-')),
|
||||||
).toHaveLength(1)
|
).toHaveLength(1)
|
||||||
|
|
||||||
let payloadConfigPath = path.resolve(projectDir, 'src/payload.config.ts')
|
let payloadConfigPath = path.resolve(projectDir, 'payload.config.ts')
|
||||||
|
|
||||||
// Website and ecommerce templates have payload.config.ts in src/payload
|
// Website and ecommerce templates have payload.config.ts in src/payload
|
||||||
if (!fse.existsSync(payloadConfigPath)) {
|
if (!fse.existsSync(payloadConfigPath)) {
|
||||||
|
|||||||
@@ -8,5 +8,5 @@
|
|||||||
"rootDir": "./src" /* Specify the root folder within your source files. */
|
"rootDir": "./src" /* Specify the root folder within your source files. */
|
||||||
},
|
},
|
||||||
"exclude": ["dist", "build", "tests", "test", "node_modules", ".eslintrc.js"],
|
"exclude": ["dist", "build", "tests", "test", "node_modules", ".eslintrc.js"],
|
||||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"]
|
"include": ["src/**/*.ts", "src/**/*.spec.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"]
|
||||||
}
|
}
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -1562,6 +1562,9 @@ importers:
|
|||||||
'@payloadcms/ui':
|
'@payloadcms/ui':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../packages/ui
|
version: link:../packages/ui
|
||||||
|
comment-json:
|
||||||
|
specifier: ^4.2.3
|
||||||
|
version: 4.2.3
|
||||||
create-payload-app:
|
create-payload-app:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../packages/create-payload-app
|
version: link:../packages/create-payload-app
|
||||||
@@ -1571,9 +1574,18 @@ importers:
|
|||||||
eslint-plugin-playwright:
|
eslint-plugin-playwright:
|
||||||
specifier: 1.5.3
|
specifier: 1.5.3
|
||||||
version: 1.5.3(eslint@8.57.0)
|
version: 1.5.3(eslint@8.57.0)
|
||||||
|
execa:
|
||||||
|
specifier: 5.1.1
|
||||||
|
version: 5.1.1
|
||||||
payload:
|
payload:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../packages/payload
|
version: link:../packages/payload
|
||||||
|
tempy:
|
||||||
|
specifier: ^1.0.1
|
||||||
|
version: 1.0.1
|
||||||
|
typescript:
|
||||||
|
specifier: 5.4.2
|
||||||
|
version: 5.4.2
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ describe('create-payload-app', () => {
|
|||||||
'--debug': true,
|
'--debug': true,
|
||||||
projectDir,
|
projectDir,
|
||||||
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
||||||
|
packageManager: 'pnpm',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(result.success).toBe(true)
|
expect(result.success).toBe(true)
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
"create-payload-app": "workspace:*",
|
"create-payload-app": "workspace:*",
|
||||||
"eslint-plugin-playwright": "1.5.3",
|
"eslint-plugin-playwright": "1.5.3",
|
||||||
"eslint-plugin-payload": "workspace:*",
|
"eslint-plugin-payload": "workspace:*",
|
||||||
"payload": "workspace:*"
|
"payload": "workspace:*",
|
||||||
|
"execa": "5.1.1",
|
||||||
|
"tempy": "^1.0.1",
|
||||||
|
"comment-json": "^4.2.3",
|
||||||
|
"typescript": "5.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const createTestHooks = async (testSuiteName = '_community') => {
|
|||||||
|
|
||||||
await writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2) + '\n')
|
await writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2) + '\n')
|
||||||
|
|
||||||
execSync(`prettier --write ${tsConfigPath}`, { cwd: path.resolve(dirname, '../') })
|
execSync(`pnpm prettier --write ${tsConfigPath}`, { cwd: path.resolve(dirname, '../') })
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user