Remove testURL hotfix from jest upgrade (#22953)

* [jest] disable testURL hotfix

* [console] mock jquery.ajax in tests

* [ui/share] update urls in snapshots
This commit is contained in:
Spencer 2018-09-12 15:05:24 -07:00 committed by GitHub
parent 8ed6084db9
commit 9847e82393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 9 deletions

View file

@ -16,13 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
import './setup_mocks';
import ace from 'brace';
import 'brace/mode/json';
const $ = require('jquery');
import $ from 'jquery';
import { initializeInput } from '../../src/input';
const tokenIterator = ace.acequire('ace/token_iterator');
describe('Input Tokenization', () => {

View file

@ -23,4 +23,10 @@ window.URL = {
createObjectURL: () => { return ''; }
};
jest.mock('../../src/storage');
document.queryCommandSupported = () => true;
document.queryCommandSupported = () => true;
import jQuery from 'jquery';
jest.spyOn(jQuery, 'ajax').mockImplementation(() => new Promise(() => {
// never resolve
}));

View file

@ -96,6 +96,4 @@ export default {
'default',
'<rootDir>/src/dev/jest/junit_reporter.js',
],
// TODO: prevent tests from making web requests that rely on this setting, see https://github.com/facebook/jest/pull/6792
testURL: 'about:blank',
};

View file

@ -129,7 +129,7 @@ exports[`render 1`] = `
<EuiCopy
afterMessage="Copied"
anchorClassName="sharePanel__copyAnchor"
textToCopy="about:blank"
textToCopy="http://localhost/"
/>
</EuiForm>
`;
@ -262,7 +262,7 @@ exports[`should enable saved object export option when objectId is provided 1`]
<EuiCopy
afterMessage="Copied"
anchorClassName="sharePanel__copyAnchor"
textToCopy="about:blank"
textToCopy="http://localhost/"
/>
</EuiForm>
`;

View file

@ -51,7 +51,5 @@ export function createJestConfig({
rootDirectory: xPackKibanaDirectory,
}]
],
// TODO: prevent tests from making web requests that rely on this setting, see https://github.com/facebook/jest/pull/6792
testURL: 'about:blank',
};
}