Skip to content

Commit

Permalink
Merge branch 'v6' into add-flowtype-interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pirelenito authored Sep 24, 2016
2 parents f836b2e + 21fe9dd commit 1819762
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ script:
env:
matrix:
- TEST_TYPE=lint_and_test_unit
- TEST_TYPE=integration_test
- TEST_TYPE=test_create_project
cache:
directories:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"lodash.uniq": "^4.3.0",
"node-sass": "^3.3.3",
Expand Down
8 changes: 3 additions & 5 deletions src/index.integration-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ temp.track()
* Simulate a complete install of Sagui in a target folder.
*
* It symlinks all the dependencies in place
* and copies the Sagui source folder.
* and copies the require Sagui files.
*/
const npmInstall = (projectPath) => {
const saguiInNodeModules = path.join(projectPath, 'node_modules/sagui')
const nodeModules = path.join(__dirname, '../node_modules')
const packages = fs.readdirSync(nodeModules)

packages.forEach((name) => fs.ensureSymlinkSync(path.join(nodeModules, name), path.join(projectPath, 'node_modules', name)))

const saguiInNodeModules = path.join(projectPath, 'node_modules/sagui/karma-static-files')
fs.ensureDirSync(saguiInNodeModules)
fs.copySync(path.join(__dirname, '..'), saguiInNodeModules, {
filter: (file) => !file.match(/node_modules/)
})
fs.copySync(path.join(__dirname, '../karma-static-files'), saguiInNodeModules)
}

describe('[integration] sagui', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/karma/presets/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {

preprocessors: {
// add webpack as preprocessor
'node_modules/sagui/karma-static-files/test-bundle.js': ['webpack']
'node_modules/sagui/karma-static-files/test-bundle.js': ['webpack', 'sourcemap']
},

webpackServer: {
Expand Down
9 changes: 8 additions & 1 deletion src/karma/presets/reporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ export default {
name: 'frameworks',
configure () {
return {
reporters: ['mocha']
reporters: ['mocha'],

// first run will have the full output and
// the next runs just output the summary and
// errors in mocha style
mochaReporter: {
output: 'autowatch'
}
}
}
}
26 changes: 21 additions & 5 deletions src/webpack/presets/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,35 @@ import { NoErrorsPlugin } from 'webpack'
import path from 'path'
import actions from '../../actions'

/**
* Configure a proper devtool that best suits
* a specific action we want to perform
*
* see: http://webpack.github.io/docs/configuration.html#devtool
*/
const devtool = (action) => {
// generate the actual source map files on build
if (action === actions.BUILD) {
return 'source-map'
}

if (action === actions.TEST) {
return 'inline-source-map'
}

// Use a much faster cheap-module-eval-source-map setup when possible
return 'cheap-module-eval-source-map'
}

export default {
name: 'base',
configure ({ action, projectPath, saguiPath, watch }) {
const projectSourcePath = path.join(projectPath, 'src')

// Use a much faster cheap-module-eval-source-map setup when possible
// see: http://webpack.github.io/docs/configuration.html#devtool
const devtool = action === actions.BUILD ? 'source-map' : 'cheap-module-eval-source-map'

return {
context: projectSourcePath,

devtool,
devtool: devtool(action),

plugins: watch || action === actions.DEVELOP ? [] : [new NoErrorsPlugin()],

Expand Down
5 changes: 5 additions & 0 deletions src/webpack/presets/base.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ describe('base webpack preset', function () {
const config = preset.configure({ projectPath, saguiPath, action: actions.BUILD })
expect(config.devtool).equal('source-map')
})

it('should inline the source-map while testing', () => {
const config = preset.configure({ projectPath, saguiPath, action: actions.TEST })
expect(config.devtool).equal('inline-source-map')
})
})
})

0 comments on commit 1819762

Please sign in to comment.