本文整理匯總了TypeScript中shelljs.ls函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript ls函數的具體用法?TypeScript ls怎麽用?TypeScript ls使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ls函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should have right fesm files', () => {
const expected = [
'example.js',
'example.js.map',
'secondary.js',
'secondary.js.map',
];
expect(shx.ls('-R', 'esm5').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
expect(shx.ls('-R', 'esm2015').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
});
示例2: it
it('should have right fesm files', () => {
const expected = [
'common.js',
'common.js.map',
'http',
'http.js',
'http.js.map',
'http/testing.js',
'http/testing.js.map',
'testing.js',
'testing.js.map',
];
expect(shx.ls('-R', 'fesm5').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
expect(shx.ls('-R', 'fesm2015').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
});
示例3: function
let writeFile = function (filename, dir, match: string[], prefix = '$') {
let res = shell.ls(dir);
for (let str of match) {
fs.writeFileSync(path.join(dir, `${str}_${filename}`), refFiles(res, str, prefix));
}
}
示例4: it
it('should generate valid samples .js that keeps the jsdoc top comment', () => {
ls('spec/assets/*Sample.ts').forEach((file) => {
let js = cat(file.replace('.ts', '.js'))
expect(js).toContain(' * @NApiVersion 2')
try {
parseScript(js)
} catch (ex) {
fail('invalid javascript generated')
console.log(ex, ex.stack)
}
})
})
示例5: expect
() => { expect(shx.ls('bundles/core-testing.umd.js').length).toBe(1, 'File not found'); });
示例6: then
then(() => shell.ls('-l', inputDir) as any as Promise<(fs.Stats & {name: string})[]>).