Skip to content

Commit

Permalink
use patchFiles for other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 4, 2024
1 parent eafe7c3 commit 0c15ce8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 39 deletions.
34 changes: 16 additions & 18 deletions tests/_selftest.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import path from 'node:path'
import fs from 'node:fs'
import { runInRepo } from '../utils'
import { RunOptions } from '../types'

export async function test(options: RunOptions) {
await runInRepo({
...options,
repo: 'vuejs/ecosystem-ci',
build: async () => {
const dir = path.resolve(options.workspace, 'ecosystem-ci')
const pkgFile = path.join(dir, 'package.json')
const pkg = JSON.parse(await fs.promises.readFile(pkgFile, 'utf-8'))
if (pkg.name !== '@vue/ecosystem-ci') {
throw new Error(
`invalid checkout, expected package.json with "name": "@vue/ecosystem-ci" in ${dir}`,
)
}
pkg.scripts.selftestscript =
"[ -d ../../core/packages/vue/dist ] || (echo 'vue build failed' && exit 1)"
await fs.promises.writeFile(
pkgFile,
JSON.stringify(pkg, null, 2),
'utf-8',
)
},
test: 'pnpm run selftestscript',
verify: false,
patchFiles: {
'package.json': (content) => {
const pkg = JSON.parse(content)
if (pkg.name !== '@vue/ecosystem-ci') {
throw new Error(
`invalid checkout, expected package.json with "name": "@vue/ecosystem-ci" in ${path.resolve(
options.workspace,
'ecosystem-ci',
)}`,
)
}
pkg.scripts.selftestscript =
"[ -d ../../core/packages/vue/dist ] || (echo 'vue build failed' && exit 1)"
return JSON.stringify(pkg, null, 2)
},
},
})
}
31 changes: 10 additions & 21 deletions tests/quasar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import fs from 'node:fs'
import path from 'node:path'
import { runInRepo } from '../utils'
import { RunOptions } from '../types'

Expand All @@ -9,26 +7,17 @@ export async function test(options: RunOptions) {
repo: 'quasarframework/quasar',
branch: 'dev',
build: 'vue-ecosystem-ci:build',
test: 'vue-ecosystem-ci:test',
// Need to skip QSelect tests until https://github.com/quasarframework/quasar-testing/issues/343 is resolved
beforeTest: async () => {
const dir = path.resolve(options.workspace, 'quasar')
const cypressConfigPath = path.resolve(dir, 'ui/dev/cypress.config.cjs')
const cypressConfigFile = await fs.promises.readFile(
cypressConfigPath,
'utf-8',
)
await fs.promises.writeFile(
cypressConfigPath,
cypressConfigFile +
`
module.exports.component.excludeSpecPattern = [
'../src/components/**/QSelect.cy.js',
'../src/composables/**/use-validate.cy.js'
]
`,
'utf-8',
)
patchFiles: {
'ui/dev/cypress.config.cjs': (content) =>
content +
`
module.exports.component.excludeSpecPattern = [
'../src/components/**/QSelect.cy.js',
'../src/composables/**/use-validate.cy.js'
]
`,
},
test: 'vue-ecosystem-ci:test',
})
}

0 comments on commit 0c15ce8

Please sign in to comment.