UNPKG

1.49 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var Constants = require("./util/constants");
4var workerClient = require("./worker-client");
5var lint_1 = require("./lint");
6var originalEnv = process.env;
7describe('lint task', function () {
8 describe('lint', function () {
9 beforeEach(function () {
10 originalEnv = process.env;
11 process.env = {};
12 });
13 afterEach(function () {
14 process.env = originalEnv;
15 });
16 it('should return a resolved promise', function (done) {
17 spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.resolve());
18 lint_1.lint(null).then(function () {
19 done();
20 });
21 });
22 it('should return resolved promise when bailOnLintError is not set', function (done) {
23 spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.reject(new Error('Simulating an error')));
24 lint_1.lint(null).then(function () {
25 done();
26 });
27 });
28 it('should return rejected promise when bailOnLintError is set', function (done) {
29 spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.reject(new Error('Simulating an error')));
30 process.env[Constants.ENV_BAIL_ON_LINT_ERROR] = 'true';
31 lint_1.lint(null).catch(function () {
32 done();
33 });
34 });
35 });
36});