Fix failing PHP-CS-Fixer Beautifier specs, disable some on Windows

This commit is contained in:
Glavin Wiechert 2015-06-11 22:07:56 -03:00
parent b0d8dfa6fb
commit 6b7b3d6401
3 changed files with 66 additions and 51 deletions

View File

@ -7,6 +7,11 @@ Beautifier = require "../src/beautifiers/beautifier"
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
# Check if Windows
isWindows = process.platform is 'win32' or
process.env.OSTYPE is 'cygwin' or
process.env.OSTYPE is 'msys'
describe "Atom-Beautify", ->
beforeEach ->
@ -139,6 +144,7 @@ describe "Atom-Beautify", ->
p.then(cb, cb)
return p
unless isWindows
it "should error with Mac/Linux-specific help description \
when beautifier's program not found", ->
expect(beautifier).not.toBe(null)

View File

@ -7,6 +7,11 @@ path = require 'path'
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
# Check if Windows
isWindows = process.platform is 'win32' or
process.env.OSTYPE is 'cygwin' or
process.env.OSTYPE is 'msys'
describe "PHP-CS-Fixer Beautifier", ->
beforeEach ->
@ -43,11 +48,13 @@ describe "PHP-CS-Fixer Beautifier", ->
fixers: ""
levels: ""
}
# Mock PATH
beautifier.getShellEnvironment = -> Promise.resolve({
PATH: ''
})
#
# Mock spawn
beautifier.spawn = (exe, args, options) ->
# console.log('spawn', exe, args, options)
er = new Error('ENOENT')
er.code = 'ENOENT'
return beautifier.Promise.reject(er)
# Beautify
p = beautifier.beautify(text, language, options)
expect(p).not.toBe(null)
expect(p instanceof beautifier.Promise).toBe(true)
@ -119,6 +126,7 @@ describe "PHP-CS-Fixer Beautifier", ->
failWhichProgram('php')
failWhichProgram('php-cs-fixer')
unless isWindows
describe "Mac/Linux", ->
beforeEach ->

View File

@ -10,6 +10,11 @@ JsDiff = require('diff')
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
# Check if Windows
isWindows = process.platform is 'win32' or
process.env.OSTYPE is 'cygwin' or
process.env.OSTYPE is 'msys'
describe "BeautifyLanguages", ->
optionsDir = path.resolve(__dirname, "../examples")
@ -47,10 +52,6 @@ describe "BeautifyLanguages", ->
# Force activate package
pack = atom.packages.getLoadedPackage("atom-beautify")
pack.activateNow()
# Check if Windows
isWindows = process.platform is 'win32' or
process.env.OSTYPE is 'cygwin' or
process.env.OSTYPE is 'msys'
# Need more debugging on Windows
if isWindows
# Change logger level