Skip to content

Commit

Permalink
Add integration test for js and json presets
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-drexler committed May 16, 2018
1 parent ac8f57f commit 42ec800
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/examples/*/node_modules/

/integration-tests/*/node_modules
!/integration-tests/presets/json/node_modules
!/integration-tests/presets/js/node_modules
/integration-tests/transform/*/coverage
/integration-tests/transform/*/node_modules

Expand Down
21 changes: 21 additions & 0 deletions integration-tests/__tests__/presets.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';

const runJest = require('../runJest');

test('supports json preset', () => {
const result = runJest('presets/json');
expect(result.status).toBe(0);
});

test('supports js preset', () => {
const result = runJest('presets/js');
expect(result.status).toBe(0);
});
11 changes: 11 additions & 0 deletions integration-tests/presets/js/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';

test('load file mapped by js preset', () => {
expect(require('./test.foo')).toEqual(42);
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions integration-tests/presets/js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"preset": "jest-preset-js"
}
}
11 changes: 11 additions & 0 deletions integration-tests/presets/json/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';

test('load file mapped by json preset', () => {
expect(require('./test.foo')).toEqual(42);
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions integration-tests/presets/json/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"preset": "jest-preset-json"
}
}

0 comments on commit 42ec800

Please sign in to comment.