Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
opts.atime = boolVal;
opts.atime = dateVal;
opts.mtime = boolVal;
opts.mtime = dateVal;
opts.ref = strVal;
opts.nocreate = boolVal;
// touch API tests
touch(strVal, (e) => console.log(e));
touch(strVal, opts, (e) => console.log(e));
touch.sync(strVal);
touch.sync(strVal, opts);
// ftouch API tests
touch.ftouch(numVal, (e) => console.log(e));
touch.ftouch(numVal, opts, (e) => console.log(e));
touch.ftouch.sync(numVal);
touch.ftouch.sync(numVal, opts);
touch.ftouchSync(numVal);
touch.ftouchSync(numVal, opts);
chai.use(require('chai-json-schema'));
//var expect = chai.expect;
var assert = chai.assert;
// import assertion multi tester
require('./tester')(chai, _);
// create some empty dirs (cannot check-in empty dirs to git)
mkdirp.sync('./test/tmp');
mkdirp.sync('./test/fixtures/empty');
mkdirp.sync('./test/fixtures/dir/.dotdir/empty');
mkdirp.sync('./test/fixtures/dir-copy/.dotdir/empty');
// change the times of alpha-copy.txt, so it will be equal, but not DEEP equal to alpha.txt
touch.sync('./test/fixtures/alpha-copy.txt', {time: '2016-01-01T00:00:00Z'});
// delete files that get created automatically by the OS (they mess-up directory listings)
del.sync('test/fixtures/**/.DS_Store', {dot: true});
del.sync('test/fixtures/**/Thumbs.db', {dot: true});
describe('initialized', function () {
assert.isDirectory('./test/tmp');
assert.isDirectory('./test/fixtures');
assert.isDirectory('./test/fixtures/empty');
assert.isDirectory('./test/fixtures/dir/.dotdir/empty');
assert.isDirectory('./test/fixtures/dir-copy/.dotdir/empty');
});
describe('chai-fs', function () {
it('exports module', function () {
assert.isFunction(chai_fs, 'chai_fs export');
// touch API tests
touch(strVal, (e) => console.log(e));
touch(strVal, opts, (e) => console.log(e));
touch.sync(strVal);
touch.sync(strVal, opts);
// ftouch API tests
touch.ftouch(numVal, (e) => console.log(e));
touch.ftouch(numVal, opts, (e) => console.log(e));
touch.ftouch.sync(numVal);
touch.ftouch.sync(numVal, opts);
touch.ftouchSync(numVal);
touch.ftouchSync(numVal, opts);
// touch API tests
touch(strVal, (e) => console.log(e));
touch(strVal, opts, (e) => console.log(e));
touch.sync(strVal);
touch.sync(strVal, opts);
// ftouch API tests
touch.ftouch(numVal, (e) => console.log(e));
touch.ftouch(numVal, opts, (e) => console.log(e));
touch.ftouch.sync(numVal);
touch.ftouch.sync(numVal, opts);
touch.ftouchSync(numVal);
touch.ftouchSync(numVal, opts);
opts.mtime = boolVal;
opts.mtime = dateVal;
opts.ref = strVal;
opts.nocreate = boolVal;
// touch API tests
touch(strVal, (e) => console.log(e));
touch(strVal, opts, (e) => console.log(e));
touch.sync(strVal);
touch.sync(strVal, opts);
// ftouch API tests
touch.ftouch(numVal, (e) => console.log(e));
touch.ftouch(numVal, opts, (e) => console.log(e));
touch.ftouch.sync(numVal);
touch.ftouch.sync(numVal, opts);
touch.ftouchSync(numVal);
touch.ftouchSync(numVal, opts);
opts.mtime = dateVal;
opts.ref = strVal;
opts.nocreate = boolVal;
// touch API tests
touch(strVal, (e) => console.log(e));
touch(strVal, opts, (e) => console.log(e));
touch.sync(strVal);
touch.sync(strVal, opts);
// ftouch API tests
touch.ftouch(numVal, (e) => console.log(e));
touch.ftouch(numVal, opts, (e) => console.log(e));
touch.ftouch.sync(numVal);
touch.ftouch.sync(numVal, opts);
touch.ftouchSync(numVal);
touch.ftouchSync(numVal, opts);
w.on('ready', function () {
touch.sync(f_dst); // touch the hard link
});
});
if( no_changes ) {
return filePath;
}
(global.DEBUG||{}).WATCH && console.log('NEW-FILE-CONTENT: '+filePath);
fs__write_file(filePath, fileContent);
if( ! noFileSet && session_object.is_first_session ) {
// Webpack bug fix
// - https://github.com/yessky/webpack-mild-compile
// - https://github.com/webpack/watchpack/issues/25
// - alternative solution: `require('webpack-mild-compile')`
const twelve_minutes = 1000*60*12;
const time = new Date() - twelve_minutes;
touch.sync(filePath, {time});
}
return filePath;
}
const FileCookieStore = require('tough-cookie-filestore');
const axiosCookieJarSupport = require('node-axios-cookiejar');
const {
getUrls, CODES, SP_ACCOUNTS, PUSH_HOST_LIST,
} = require('./conf');
Promise.promisifyAll(Datastore.prototype);
const debug = Debug('weixinbot');
let URLS = getUrls({});
const logo = fs.readFileSync(path.join(__dirname, 'logo.txt'), 'utf8');
// try persistent cookie
const cookiePath = path.join(process.cwd(), '.cookie.json');
touch.sync(cookiePath);
const jar = new tough.CookieJar(new FileCookieStore(cookiePath));
const req = axios.create({
timeout: 35e3,
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) ' +
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2652.0 Safari/537.36',
'Referer': 'https://wx2.qq.com/',
},
jar,
withCredentials: true,
xsrfCookieName: null,
xsrfHeaderName: null,
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),
// all and yml format
if (fileMode === 'all' && format === 'yml') {
touch.sync(savePath)
let currentConfig = fs.readFileSync(savePath, 'utf-8')
if (!currentConfig) {
finalConfig = rs.translations
} else {
finalConfig = mergeLang(yamlReader.safeLoad(currentConfig), rs.translations)
}
if (!currentConfig || (currentConfig && JSON.stringify(yamlReader.safeLoad(currentConfig)) !== JSON.stringify(finalConfig))) {
fs.writeFileSync(savePath, yamlReader.safeDump(finalConfig))
}
}
if (fileMode === 'all' && format === 'json') {
touch.sync(savePath)
let currentConfig = fs.readFileSync(savePath, 'utf-8')
if (!currentConfig) {
finalConfig = rs.translations
} else {
finalConfig = mergeLang(JSON.parse(currentConfig), rs.translations)
}
if (!currentConfig || (currentConfig && JSON.stringify(currentConfig) !== JSON.stringify(finalConfig))) {
fs.writeFileSync(savePath, JSON.stringify(finalConfig, null, 2))
}
}
// single and yml
if (fileMode === 'single' && format === 'yml') {
for (let i = 0; i < langs.length; i++) {
let lang = langs[i]