Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Stub oniguruma as reloading native modules are not well supported i…
Browse files Browse the repository at this point in the history
…n Jest

Summary:
Use jest's functionality for mocking modules to always return
an empty object when `oniguruma` is required. This can be removed when
jestjs/jest#3552 is addressed.

Reviewed By: aaronabramov

Differential Revision: D7422795

fbshipit-source-id: c5a25511a058499ab2ad494a86f8772d7f4bc802
  • Loading branch information
Will Binns-Smith authored and facebook-github-bot committed Apr 3, 2018
1 parent 3c79f54 commit 74f667c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/nuclide-jest/emptyObject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
* @format
*/

// eslint-disable-next-line rulesdir/no-commonjs
module.exports = {};
5 changes: 5 additions & 0 deletions modules/nuclide-jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
rulesdir/no-commonjs: 0,
*/

const path = require('path');

module.exports = {
testMatch: ['**/spec/**/*-spec.js'],
transform: {
'\\.js$': 'nuclide-jest/jestTransformer.js',
},
moduleNameMapper: {
oniguruma: path.resolve(__dirname, 'emptyObject'),
},
};

0 comments on commit 74f667c

Please sign in to comment.