18 lines
606 B
JavaScript
18 lines
606 B
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
function resolveImportTarget(wxssPath, importPath) {
|
|
return path.resolve(path.dirname(wxssPath), importPath)
|
|
}
|
|
|
|
describe('miniprogram compatibility', () => {
|
|
test('app.wxss imports a TDesign style entry that exists in the project output', () => {
|
|
const appWxssPath = path.join(process.cwd(), 'app.wxss')
|
|
const source = fs.readFileSync(appWxssPath, 'utf8')
|
|
const match = source.match(/@import ['"]([^'"]+)['"];/)
|
|
|
|
expect(match).not.toBeNull()
|
|
expect(fs.existsSync(resolveImportTarget(appWxssPath, match[1]))).toBe(true)
|
|
})
|
|
})
|