Skip to content

Commit

Permalink
fix(preprocessor): rebase and lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjbarton committed Aug 2, 2019
1 parent 7c2d4ba commit a6002c3
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions test/unit/preprocessor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('preprocessor', () => {
'graceful-fs': mockFs,
minimatch: require('minimatch')
}
emitterSetting = {'emitter': ['value', new events.EventEmitter()]}
emitterSetting = { 'emitter': ['value', new events.EventEmitter()] }
m = mocks.loadFile(path.join(__dirname, '/../../lib/preprocessor.js'), mocks_)
})

Expand All @@ -47,9 +47,9 @@ describe('preprocessor', () => {
'factory', function () { return fakePreprocessor }
]
}, emitterSetting])
pp = m.createPreprocessor({'**/*.js': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, () => {
expect(fakePreprocessor).to.have.been.called
Expand All @@ -68,9 +68,9 @@ describe('preprocessor', () => {
const injector = new di.Injector([{
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])
pp = m.createPreprocessor({'**/*.js': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/.dir/a.js', path: 'path'}
const file = { originalPath: '/some/.dir/a.js', path: 'path' }

pp(file, () => {
expect(fakePreprocessor).to.have.been.called
Expand All @@ -89,10 +89,10 @@ describe('preprocessor', () => {
const injector = new di.Injector([{
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])
const config = {'**/*.txt': ['fake']}
const config = { '**/*.txt': ['fake'] }
pp = m.createPreprocessor(config, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

config['**/*.js'] = ['fake']

Expand All @@ -112,9 +112,9 @@ describe('preprocessor', () => {
const injector = new di.Injector([{
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])
pp = m.createPreprocessor({'**/*.js': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/a.txt', path: 'path'}
const file = { originalPath: '/some/a.txt', path: 'path' }

pp(file, () => {
expect(fakePreprocessor).to.not.have.been.called
Expand All @@ -138,9 +138,9 @@ describe('preprocessor', () => {
'preprocessor:fake2': ['factory', function () { return fakePreprocessor2 }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*.js': ['fake1', 'fake2']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['fake1', 'fake2'] }, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, () => {
expect(fakePreprocessor1).to.have.been.calledOnce
Expand All @@ -153,7 +153,7 @@ describe('preprocessor', () => {

it('should compute SHA', (done) => {
pp = m.createPreprocessor({}, {}, null, new di.Injector([emitterSetting]))
const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, () => {
expect(file.sha).to.exist
Expand Down Expand Up @@ -182,10 +182,10 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/a.js': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/a.js': ['fake'] }, {}, null, injector)

const fileProcess = {originalPath: '/some/a.js', path: 'path'}
const fileSkip = {originalPath: '/some/b.js', path: 'path'}
const fileProcess = { originalPath: '/some/a.js', path: 'path' }
const fileSkip = { originalPath: '/some/b.js', path: 'path' }

pp(fileProcess, () => {
pp(fileSkip, () => {
Expand All @@ -208,9 +208,9 @@ describe('preprocessor', () => {
'preprocessor:failing': ['factory', function () { return failingPreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*.js': ['failing']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['failing'] }, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, (err) => {
expect(err).to.exist
Expand All @@ -232,9 +232,9 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*.js': ['failing', 'fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*.js': ['failing', 'fake'] }, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, () => {
expect(fakePreprocessor).not.to.have.been.called
Expand All @@ -243,7 +243,7 @@ describe('preprocessor', () => {
})

describe('when fs.readFile fails', () => {
const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }
const getReadFileCallback = (nthCall) => {
return mockFs.readFile.args[nthCall][1]
}
Expand All @@ -261,7 +261,7 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])

const pp = m.createPreprocessor({'**/*.js': ['fake']}, {}, null, injector)
const pp = m.createPreprocessor({ '**/*.js': ['fake'] }, {}, null, injector)

pp(file, () => {
expect(fakePreprocessor).to.have.been.called
Expand All @@ -277,7 +277,7 @@ describe('preprocessor', () => {
it('should throw after 3 retries', (done) => {
const injector = new di.Injector([{}, emitterSetting])

const pp = m.createPreprocessor({'**/*.js': []}, {}, null, injector)
const pp = m.createPreprocessor({ '**/*.js': [] }, {}, null, injector)

pp(file, () => { })

Expand All @@ -299,9 +299,9 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/photo.png', path: 'path'}
const file = { originalPath: '/some/photo.png', path: 'path' }

pp(file, (err) => {
if (err) throw err
Expand All @@ -322,9 +322,9 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { return fakePreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/photo.png', path: 'path'}
const file = { originalPath: '/some/photo.png', path: 'path' }

pp(file, (err) => {
if (err) throw err
Expand All @@ -344,9 +344,9 @@ describe('preprocessor', () => {
'preprocessor:fake': ['factory', function () { fakePreprocessor }]
}, emitterSetting])

pp = m.createPreprocessor({'**/*': ['fake']}, {}, null, injector)
pp = m.createPreprocessor({ '**/*': ['fake'] }, {}, null, injector)

const file = {originalPath: '/some/CAM_PHOTO.JPG', path: 'path'}
const file = { originalPath: '/some/CAM_PHOTO.JPG', path: 'path' }

pp(file, (err) => {
if (err) throw err
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('preprocessor', () => {
'/some/a.js': ['fakeD']
}, {}, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, (err) => {
if (err) throw err
Expand Down Expand Up @@ -430,15 +430,15 @@ describe('preprocessor', () => {
'preprocessor:fakeD': ['factory', function () { return fakePreprocessorD }]
}, emitterSetting])

const priority = {'fakeA': -1, 'fakeB': 1, 'fakeD': 100}
const priority = { 'fakeA': -1, 'fakeB': 1, 'fakeD': 100 }

pp = m.createPreprocessor({
'/*/a.js': ['fakeA', 'fakeB'],
'/some/*': ['fakeB', 'fakeC'],
'/some/a.js': ['fakeD']
}, priority, null, injector)

const file = {originalPath: '/some/a.js', path: 'path'}
const file = { originalPath: '/some/a.js', path: 'path' }

pp(file, (err) => {
if (err) throw err
Expand Down

0 comments on commit a6002c3

Please sign in to comment.