Skip to content

Commit

Permalink
Merge pull request #106 from conveyal/dev
Browse files Browse the repository at this point in the history
3.2.0
  • Loading branch information
trevorgerhardt authored Dec 15, 2016
2 parents c8f47d2 + 6adeb43 commit c1139e9
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 502 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Options:
--no-cache Run Jest without cache (defaults to using cache)
--coverage-paths <paths> Extra paths to collect code coverage from
--setup-files <paths> Setup files to run before each test
--test-environment <env> Jest test environment to use (Jest default is jsdom)
--test-path-ignore-patterns <patterns> File patterns to ignore when scanning for test files

```
Expand Down
1 change: 1 addition & 0 deletions __tests__/lib/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Object {
"setupFiles": Array [
"beforeTestsSetup.js",
],
"testEnvironment": "node",
"testPathIgnorePatterns": Array [
"<rootDir>/node_modules/",
"<rootDir>/__tests__/test-utils",
Expand Down
7 changes: 4 additions & 3 deletions __tests__/lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const testUtils = require('../../lib/test')
describe('test.js', () => {
it('generateTestConfig should generate proper config', () => {
const cfg = testUtils.generateTestConfig(['these', 'files', 'only'], {
coveragePaths: 'bin src another-folder',
updateSnapshots: true,
cache: false,
setupFiles: 'beforeTestsSetup.js'
coveragePaths: 'bin src another-folder',
setupFiles: 'beforeTestsSetup.js',
testEnvironment: 'node',
updateSnapshots: true
})
expect(cfg).toBeTruthy()
expect(cfg.length).toEqual(7)
Expand Down
1 change: 1 addition & 0 deletions bin/mastarm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ commander
.option('--no-cache', 'Run Jest without cache (defaults to using cache)')
.option('--coverage-paths <paths>', 'Extra paths to collect code coverage from')
.option('--setup-files <paths>', 'Setup files to run before each test')
.option('--test-environment <env>', 'Jest test environment to use (Jest default is jsdom)')
.option('--test-path-ignore-patterns <patterns>', 'File patterns to ignore when scanning for test files')
.action(function (patterns, options) {
const jest = require('jest')
Expand Down
4 changes: 4 additions & 0 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ module.exports.generateTestConfig = (patterns, options) => {
jestConfig.collectCoverageFrom = jestConfig.collectCoverageFrom.concat(options.coveragePaths.split(' '))
}

if (options.testEnvironment) {
jestConfig.testEnvironment = options.testEnvironment
}

const stringArrayOverrides = [
'setupFiles',
'testPathIgnorePatterns'
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"mastarm": "bin/mastarm"
},
"scripts": {
"cover": "bin/mastarm test --env test --coverage --coverage-paths bin",
"cover": "bin/mastarm test --env test --test-environment node --coverage --coverage-paths bin",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"test": "bin/mastarm lint && bin/mastarm test --env test"
"test": "bin/mastarm lint && bin/mastarm test --env test --test-environment node"
},
"repository": {
"type": "git",
Expand All @@ -38,7 +38,7 @@
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-env": "^0.0.9",
"babel-preset-env": "^1.1.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.17.0",
"babelify": "^7.3.0",
Expand All @@ -62,7 +62,7 @@
"postcss": "^5.0.21",
"postcss-cssnext": "^2.6.0",
"postcss-import": "^9.0.0",
"postcss-reporter": "^2.0.0",
"postcss-reporter": "^3.0.0",
"postcss-safe-parser": "^2.0.0",
"rimraf": "^2.5.4",
"standard": "^8.3.0",
Expand Down
Loading

0 comments on commit c1139e9

Please sign in to comment.