Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(() => // Remove the original draft file
fs.unlink(src)).then(() => {
if (!config.post_asset_folder) return;
it('create config if not exist', () => fs.unlink(hexo.config_path).then(() => writeConfig('subtitle', 'Hello world')).then(config => {
config.subtitle.should.eql('Hello world');
}));
});
}).finally(() => {
return fs.unlink(includePath);
});
});
}).map(item => fs.unlink(item));
});
return fs.writeFile(configPath, '{}').then(() => config({_: ['title', 'My Blog']})).then(() => fs.readFile(configPath)).then(content => {
const json = JSON.parse(content);
json.title.should.eql('My Blog');
hexo.config_path = pathFn.join(hexo.base_dir, '_config.yml');
return fs.unlink(configPath);
});
});
return fs.writeFile(src, body).then(() => render({_: ['test.yml'], output: dest})).then(() => fs.readFile(dest)).then(result => {
JSON.parse(result).should.eql({
foo: 1,
bar: {
boo: 2
}
});
return Promise.all([
fs.unlink(src),
fs.unlink(dest)
]);
});
});
return fs.writeFile(packagePath, JSON.stringify(pkg)).then(() => updatePkg(hexo)).then(() => fs.readFile(packagePath)).then(content => {
JSON.parse(content).hexo.version.should.eql(hexo.version);
hexo.env.init.should.be.true;
return fs.unlink(packagePath);
});
});
}, true)).then(target => {
target.should.eql(path);
return fs.unlink(path);
});
});
function removeGitModules(target) {
return fs.unlink(pathFn.join(target, '.gitmodules')).catch(err => {
if (err.cause && err.cause.code === 'ENOENT') return;
throw err;
});
}