Skip to content

Commit c8f47d2

Browse files
Merge pull request #99 from conveyal/dev
v3.1.1
2 parents 635464d + 811f874 commit c8f47d2

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

__mocks__/aws-sdk.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* global jest */
2+
3+
const AWS = module.exports = jest.genMockFromModule('aws-sdk')
4+
AWS.S3.prototype.upload = () => ({send: (fn) => fn()})

__tests__/lib/__snapshots__/test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Object {
1919
"another-folder",
2020
],
2121
"coverageDirectory": "coverage",
22+
"notify": true,
2223
"setupFiles": Array [
2324
"beforeTestsSetup.js",
2425
],

bin/mastarm

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ commander
1212
.option('-e, --env <environment>', 'Environment to use.')
1313
.option('-m, --minify', 'Minify built files.')
1414
.option('-O, --outdir <dir>', 'Publish directory', '')
15-
.option('-S, --skip-check-dependencies', '**DEPRECATED**')
1615

1716
commander
1817
.command('build [entries...]')
@@ -77,9 +76,10 @@ commander
7776
minify: get('minify'),
7877
s3bucket: get('s3bucket')
7978
}))).then(() => {
80-
console.log('Finished pushing to s3')
79+
console.log('Finished deploying!')
8180
process.exit(0)
8281
}).catch((err) => {
82+
console.error('Error while deploying!')
8383
console.error(err.stack)
8484
process.exit(1)
8585
})

lib/__tests__/push-to-s3.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* global describe, it */
2+
3+
const BUILD_DIR = '__tests__/test-utils/tmp'
4+
const MOCK_DIR = '__tests__/test-utils/mocks'
5+
6+
describe('lib > push to s3', () => {
7+
const configPush = require('../push-to-s3')
8+
const loadConfig = require('../load-config')
9+
10+
it('should compile JavaScript and CSS and send to s3 via aws-sdk', () => {
11+
const config = loadConfig(process.cwd(), '~/mastarm/configurations/default', 'test')
12+
const push = configPush({
13+
env: 'test',
14+
config,
15+
minify: false,
16+
s3bucket: 'test-bucket'
17+
})
18+
return Promise.all([
19+
push([`${MOCK_DIR}/index.js`, `${BUILD_DIR}/index.js`]),
20+
push([`${MOCK_DIR}/index.css`, `${BUILD_DIR}/index.css`])
21+
])
22+
})
23+
})

lib/push-to-s3.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ function upload ({
5454
console.log('building and pushing %s to s3 bucket %s', outfile, bucket)
5555
s3object
5656
.upload()
57-
.send(function (err, data) {
58-
if (err) reject(err)
57+
.send(function (err) {
58+
if (err) return reject(err)
5959
console.log('finished pushing %s to s3', outfile)
6060

6161
if (cloudfront) {
@@ -72,8 +72,8 @@ function upload ({
7272
]
7373
}
7474
}
75-
}, function (err, data) {
76-
if (err) reject(err)
75+
}, function (err) {
76+
if (err) return reject(err)
7777
done()
7878
})
7979
} else {

lib/test.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports.generateTestConfig = (patterns, options) => {
77
collectCoverage: options.coverage,
88
collectCoverageFrom: ['lib/**/*.js'],
99
coverageDirectory: 'coverage',
10+
notify: true,
1011
transform: { '.*': path.resolve(__dirname, 'jest-preprocessor.js') },
1112
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/__tests__/test-utils']
1213
}
@@ -41,5 +42,6 @@ module.exports.generateTestConfig = (patterns, options) => {
4142
if (patterns) {
4243
jestArguments = jestArguments.concat(patterns)
4344
}
45+
4446
return jestArguments
4547
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"mkdirp": "^0.5.1",
6262
"postcss": "^5.0.21",
6363
"postcss-cssnext": "^2.6.0",
64-
"postcss-import": "^8.1.2",
64+
"postcss-import": "^9.0.0",
6565
"postcss-reporter": "^2.0.0",
6666
"postcss-safe-parser": "^2.0.0",
6767
"rimraf": "^2.5.4",

0 commit comments

Comments
 (0)