diff --git a/test/scripts/generators/page.js b/test/scripts/generators/page.js index 9fae9f60fa..2371566fad 100644 --- a/test/scripts/generators/page.js +++ b/test/scripts/generators/page.js @@ -8,10 +8,10 @@ describe('page', () => { const Page = hexo.model('Page'); const generator = Promise.method(require('../../../lib/plugins/generator/page').bind(hexo)); - function locals() { + const locals = () => { hexo.locals.invalidate(); return hexo.locals.toObject(); - } + }; it('default layout', async () => { const page = await Page.insert({ diff --git a/test/scripts/hexo/load_database.js b/test/scripts/hexo/load_database.js index ece1549c7d..d711d9183c 100644 --- a/test/scripts/hexo/load_database.js +++ b/test/scripts/hexo/load_database.js @@ -29,11 +29,7 @@ describe('Load database', () => { hexo._dbLoaded = false; }); - after(async () => { - const exist = await exists(dbPath); - if (exist) await unlink(dbPath); - rmdir(hexo.base_dir); - }); + after(() => rmdir(hexo.base_dir)); it('database does not exist', () => loadDatabase(hexo)); @@ -57,6 +53,22 @@ describe('Load database', () => { await unlink(dbPath); }); +}); + +// #3975 workaround for Windows +describe('Load database - load failed', () => { + const Hexo = require('../../../lib/hexo'); + const hexo = new Hexo(join(__dirname, 'db_test'), {silent: true}); + const loadDatabase = require('../../../lib/hexo/load_database'); + const dbPath = hexo.database.options.path; + + before(() => mkdirs(hexo.base_dir)); + + beforeEach(() => { + hexo._dbLoaded = false; + }); + + after(() => rmdir(hexo.base_dir)); it('database load failed', async () => { await writeFile(dbPath, '{1423432: 324');