ant-design/tests/dekko/use-client.test.js

30 lines
930 B
JavaScript
Raw Normal View History

const $ = require('dekko');
const chalk = require('chalk');
const fs = require('fs');
const includeUseClient = (filename) =>
fs.readFileSync(filename).toString().includes('"use client"');
$('dist/*')
.isFile()
.assert("doesn't contain use client", (filename) => !includeUseClient(filename));
$('{es,lib}/index.js')
.isFile()
.assert('contain use client', (filename) => includeUseClient(filename));
$('{es,lib}/*/index.js')
.isFile()
.assert('contain use client', (filename) => includeUseClient(filename));
// check tsx files
$('{es,lib}/typography/*.js')
.isFile()
.assert('contain use client', (filename) => includeUseClient(filename));
$('{es,lib}/typography/Base/*.js')
.isFile()
.filter((filename) => !filename.endsWith('/util.js'))
.assert('contain use client', (filename) => includeUseClient(filename));
// eslint-disable-next-line no-console
console.log(chalk.green('✨ use client passed!'));