This repository has been archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lint): new option to have stand alone lint bail
new option to have stand alone lint bail
- Loading branch information
1 parent
4055d73
commit b3bb906
Showing
7 changed files
with
115 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import * as lint from './lint'; | ||
import * as workerClient from './worker-client'; | ||
import * as Constants from './util/constants'; | ||
|
||
let originalEnv = process.env; | ||
|
||
describe('lint task', () => { | ||
describe('lint', () => { | ||
|
||
beforeEach(() => { | ||
originalEnv = process.env; | ||
process.env = {}; | ||
}); | ||
|
||
afterEach(() => { | ||
process.env = originalEnv; | ||
}); | ||
|
||
it('Should return resolved promise', (done: Function) => { | ||
// arrange | ||
spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.resolve()); | ||
// act | ||
const promise = lint.lint(null); | ||
|
||
// assert | ||
promise.then(() => { | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should return resolved promise when bail on error is not set', (done: Function) => { | ||
// arrange | ||
spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.reject(new Error('Simulating an error'))); | ||
// act | ||
const promise = lint.lint(null); | ||
|
||
// assert | ||
promise.then(() => { | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Should return rejected promise when bail on error is set', (done: Function) => { | ||
|
||
spyOn(workerClient, workerClient.runWorker.name).and.returnValue(Promise.reject(new Error('Simulating an error'))); | ||
process.env[Constants.ENV_BAIL_ON_LINT_ERROR] = 'true'; | ||
|
||
// act | ||
const promise = lint.lint(null); | ||
|
||
// assert | ||
promise.catch(() => { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters