Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run TS directly #161

Merged
merged 4 commits into from
Jan 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions __tests__/command_helpers/checkCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ const outOfDateCLI = {
const context = require('gluegun')

test('error on missing binary', async () => {
expect(await checkCLI(doesNotExistCLI, context)).toBe(
`Binary '${doesNotExistCLI.binary}' not found`
)
expect(await checkCLI(doesNotExistCLI, context)).toBe(`Binary '${doesNotExistCLI.binary}' not found`)
})

test('fine on existing binary', async () => {
Expand All @@ -29,9 +27,7 @@ test('fine on existing binary', async () => {
test('returns message on improper version', async () => {
solidarityExtension(context)
context.solidarity.getVersion = () => '1'
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${
outOfDateCLI.semver
}'`
const message = `${outOfDateCLI.binary}: you have '1', but the project requires '${outOfDateCLI.semver}'`

expect(await checkCLI(outOfDateCLI, context)).toBe(message)
})
4 changes: 1 addition & 3 deletions __tests__/commands/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ describe('with a .solidarity file', () => {
it('will error message if prompt to complete rule is empty', async () => {
expect(requirements()).toEqual({})

const mockedPrompt = jest
.fn()
.mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))
const mockedPrompt = jest.fn().mockImplementationOnce(() => Promise.resolve({ whatRule: undefined }))

context.prompt = {
ask: mockedPrompt,
Expand Down
10 changes: 8 additions & 2 deletions bin/solidarity
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env node
var devMode = require('fs').existsSync(`${__dirname}/../src`)

// let's kick it off with the command line parameters
require(`${__dirname}/../dist/index.js`)(process.argv)
// devMode does in-memory TS translation
if (devMode) {
require('ts-node').register({ project: `${__dirname}/..` })
require(`${__dirname}/../src/index.ts`)(process.argv)
} else {
require(`${__dirname}/../dist/index.js`)(process.argv)
}
10 changes: 6 additions & 4 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const fs = require('fs')

const whitelistWords = JSON5.parse(fs.readFileSync('./.vscode/cSpell.json')).words
// let's spellcheck
schedule(spellcheck({
ignore: whitelistWords.map(word => word.toLowerCase()),
whitelistFiles: ['docs/existingContributors.md']
}))
schedule(
spellcheck({
ignore: whitelistWords.map(word => word.toLowerCase()),
whitelistFiles: ['docs/existingContributors.md'],
})
)

// Enforce yarn.lock updates
const packageChanged = danger.git.modified_files.includes('package.json')
Expand Down
Loading