From eaaeade956fdc04ff697bbe34fb2f39ba297e1e9 Mon Sep 17 00:00:00 2001 From: kengos Date: Thu, 22 Sep 2016 11:41:26 +0900 Subject: [PATCH] remove unnecessary requires and method --- tests/classes/Utils.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/classes/Utils.js b/tests/classes/Utils.js index 08362e850..56952475f 100644 --- a/tests/classes/Utils.js +++ b/tests/classes/Utils.js @@ -5,13 +5,7 @@ const os = require('os'); const expect = require('chai').expect; const Serverless = require('../../lib/Serverless'); const testUtils = require('../../tests/utils'); -const BbPromise = require('bluebird'); -const fse = BbPromise.promisifyAll(require('fs-extra')); -const writeFileSync = (filePath, contents) => { - fse.mkdirsSync(path.dirname(filePath)); - return fse.writeFileSync(filePath, contents); -}; const serverless = new Serverless(); describe('Utils', () => { @@ -134,8 +128,9 @@ describe('Utils', () => { it('should throw YAMLException with filename if yml file is invalid format', () => { const tmpFilePath = testUtils.getTmpFilePath('invalid.yml'); - const contents = ': a'; - writeFileSync(tmpFilePath, contents); + + serverless.utils.writeFileSync(tmpFilePath, ': a'); + expect(() => { serverless.utils.readFileSync(tmpFilePath); }).to.throw(new RegExp(`in "${tmpFilePath}"`));